diff --git a/src/edit.tsx b/src/edit.tsx index f00e35c..ade1e83 100644 --- a/src/edit.tsx +++ b/src/edit.tsx @@ -2,7 +2,13 @@ import * as React from 'react'; import { __ } from '@wordpress/i18n'; import { BlockEditProps } from '@wordpress/blocks'; -import { Placeholder, ExternalLink } from '@wordpress/components'; +import { Placeholder, ExternalLink, ToolbarButton } from '@wordpress/components'; +import { edit } from '@wordpress/icons'; + +import { + BlockControls, + InspectorControls, +} from '@wordpress/block-editor'; import CogIcon from '@/assets/cogicon'; import SelectDialog from '@/components/select-dialog'; @@ -20,36 +26,83 @@ const Edit: React.FC> = ( { attributes, setAttri } ); }; + 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' ) } - -
-
+
+ + +
+
+ + { __( 'Learn more about embeds' ) } + +
+
+
); } return ( - +
+ { + + resetForm() } + /> + + } + + +
+
+ + { __( 'Background color', 'gutenpride' ) } + + {/* */} +
+
+ + { __( 'Text color', 'gutenpride' ) } + + {/* */} +
+
+
+ + +
); };