From 33a36d8a52fe2858f1996eed22914a945711e602 Mon Sep 17 00:00:00 2001 From: Michael Thomas Date: Sun, 30 Jan 2022 15:51:32 -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() ) } ) } + /> + +