import * as React from 'react'; import { __ } from '@wordpress/i18n'; import { BlockEditProps } from '@wordpress/blocks'; import { Placeholder, ExternalLink, ToolbarButton } from '@wordpress/components'; import { edit } from '@wordpress/icons'; import { BlockControls, InspectorControls, } from '@wordpress/block-editor'; import { ReactComponent as CogIcon } from '@/assets/cogicon.svg'; import SelectDialog from '@/components/select-dialog'; import PreviewForm from '@/components/preview-form'; import { BlockAttributes, EmbedMode } from '@/types'; const Edit: React.FC> = ( { attributes, setAttributes, className } ) => { const handleForm = ( form: { [key: string]: any } ) => { setAttributes( { formId: form.formId, seamlessEmbedCode: form.embedCodes.Seamless, iframeEmbedCode: form.embedCodes.IFrame, ampEmbedCode: form.embedCodes.Amp, embedMode: EmbedMode.Seamless, } ); }; const resetForm = () => { // Create a new object which sets all attributes to null const nullAttributes = Object.keys( attributes ).reduce( ( accumulator, current ) => { // @ts-ignore accumulator[ current ] = null; return accumulator; }, {} ); setAttributes( nullAttributes ); }; if ( ! attributes.formId ) { return (

{ __( 'Learn more about embeds' ) }
); } return (
{ resetForm() } /> }
{ __( 'Background color', 'gutenpride' ) } {/* */}
{ __( 'Text color', 'gutenpride' ) } {/* */}
); }; export default Edit;