From 4bc1f2a9c49c5f4eb443172c6647af17f7c3344b Mon Sep 17 00:00:00 2001 From: Michael Thomas Date: Fri, 28 Jan 2022 12:09:02 -0500 Subject: [PATCH] Add embed mode selector --- src/edit.tsx | 61 +++++++++++++++++++++++----------------------------- 1 file changed, 27 insertions(+), 34 deletions(-) diff --git a/src/edit.tsx b/src/edit.tsx index b965368..d04077d 100644 --- a/src/edit.tsx +++ b/src/edit.tsx @@ -2,13 +2,17 @@ import * as React from 'react'; import { __ } from '@wordpress/i18n'; import { BlockEditProps } from '@wordpress/blocks'; -import { Placeholder, ExternalLink, ToolbarButton } from '@wordpress/components'; +import { + Placeholder, + ToolbarButton, + RadioControl, + PanelBody, + PanelRow, + ExternalLink, +} from '@wordpress/components'; import { edit } from '@wordpress/icons'; -import { - BlockControls, - InspectorControls, -} from '@wordpress/block-editor'; +import { BlockControls, InspectorControls } from '@wordpress/block-editor'; import { ReactComponent as CogIcon } from '@/assets/cogicon.svg'; import SelectDialog from '@/components/select-dialog'; @@ -50,16 +54,6 @@ const Edit: React.FC> = ( { attributes, setAttri ) } > -
-
- - { __( 'Learn more about embeds' ) } - -
); @@ -78,28 +72,27 @@ const Edit: React.FC> = ( { attributes, setAttri } -
-
- - { __( 'Background color', 'gutenpride' ) } - - {/* */} -
-
- - { __( 'Text color', 'gutenpride' ) } - - {/* */} -
-
+ + + + The type of embed code to use with your form. Learn more + + } + selected={ attributes.embedMode } + options={ [ + { label: 'Seamless', value: EmbedMode.Seamless }, + { label: 'Iframe', value: EmbedMode.IFrame }, + ] } + onChange={ ( value: EmbedMode ) => setAttributes( { embedMode: parseInt( value.toString() ) } ) } + /> + +