From b4463046008e1a9eb02222178fe31ce217012c89 Mon Sep 17 00:00:00 2001 From: Aki Hamano <54422211+t-hamano@users.noreply.github.com> Date: Wed, 21 Aug 2024 19:24:21 +0900 Subject: [PATCH] Embed Block: Replace native input element with InputControl component (#64668) * Embed Block: Replace native input element with InputControl component * Don't use hardcoded label Co-authored-by: t-hamano Co-authored-by: Mamaduka Co-authored-by: jasmussen --- packages/block-library/src/embed/edit.js | 2 +- packages/block-library/src/embed/editor.scss | 4 ++++ packages/block-library/src/embed/embed-placeholder.js | 11 +++++++---- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/packages/block-library/src/embed/edit.js b/packages/block-library/src/embed/edit.js index 0b589eb68ecf4..6978e14479404 100644 --- a/packages/block-library/src/embed/edit.js +++ b/packages/block-library/src/embed/edit.js @@ -226,7 +226,7 @@ const EmbedEdit = ( props ) => { } } value={ url } cannotEmbed={ cannotEmbed } - onChange={ ( event ) => setURL( event.target.value ) } + onChange={ ( value ) => setURL( value ) } fallback={ () => fallback( url, onReplace ) } tryAgain={ () => { invalidateResolution( 'getEmbedPreview', [ url ] ); diff --git a/packages/block-library/src/embed/editor.scss b/packages/block-library/src/embed/editor.scss index 6d1fc5496bc73..eda859eee9040 100644 --- a/packages/block-library/src/embed/editor.scss +++ b/packages/block-library/src/embed/editor.scss @@ -12,6 +12,10 @@ justify-content: center; } + .wp-block-embed__placeholder-input { + flex: 1 1 auto; + } + // Stops long URLs from breaking out of the no preview available screen .components-placeholder__error { word-break: break-word; diff --git a/packages/block-library/src/embed/embed-placeholder.js b/packages/block-library/src/embed/embed-placeholder.js index 7b4cd5f8db9aa..57aa0645ee3d9 100644 --- a/packages/block-library/src/embed/embed-placeholder.js +++ b/packages/block-library/src/embed/embed-placeholder.js @@ -8,6 +8,7 @@ import { ExternalLink, __experimentalHStack as HStack, __experimentalVStack as VStack, + __experimentalInputControl as InputControl, } from '@wordpress/components'; import { BlockIcon } from '@wordpress/block-editor'; @@ -31,15 +32,17 @@ const EmbedPlaceholder = ( { ) } >
- -