From 8aff2e69f58af7f35425ab9246a1231e162b2ddc Mon Sep 17 00:00:00 2001 From: Tetsuaki Hamano Date: Wed, 4 Oct 2023 14:31:34 +0900 Subject: [PATCH] Shortcode Block: fix layout margin override --- packages/block-library/src/shortcode/edit.js | 34 ++++++++++--------- .../block-library/src/shortcode/editor.scss | 6 ---- 2 files changed, 18 insertions(+), 22 deletions(-) diff --git a/packages/block-library/src/shortcode/edit.js b/packages/block-library/src/shortcode/edit.js index aecebd115a983..f4aa1ebbe55a8 100644 --- a/packages/block-library/src/shortcode/edit.js +++ b/packages/block-library/src/shortcode/edit.js @@ -11,22 +11,24 @@ export default function ShortcodeEdit( { attributes, setAttributes } ) { const inputId = `blocks-shortcode-input-${ instanceId }`; return ( -
- - setAttributes( { text } ) } - /> + <div { ...useBlockProps() }> + <div className="components-placeholder"> + <label + htmlFor={ inputId } + className="components-placeholder__label" + > + <Icon icon={ shortcode } /> + { __( 'Shortcode' ) } + </label> + <PlainText + className="blocks-shortcode__textarea" + id={ inputId } + value={ attributes.text } + aria-label={ __( 'Shortcode text' ) } + placeholder={ __( 'Write shortcode here…' ) } + onChange={ ( text ) => setAttributes( { text } ) } + /> + </div> </div> ); } diff --git a/packages/block-library/src/shortcode/editor.scss b/packages/block-library/src/shortcode/editor.scss index 56586df8eefd2..6e7f482ad19f4 100644 --- a/packages/block-library/src/shortcode/editor.scss +++ b/packages/block-library/src/shortcode/editor.scss @@ -1,9 +1,3 @@ -[data-type="core/shortcode"] { - &.components-placeholder { - min-height: 0; - } -} - // The editing view for the Shortcode block is equivalent to block UI. // Therefore we increase specificity to avoid theme styles bleeding in. .blocks-shortcode__textarea {