Skip to content

Commit

Permalink
Shortcode Block: fix layout margin override
Browse files Browse the repository at this point in the history
  • Loading branch information
t-hamano committed May 12, 2024
1 parent f73d44e commit be42fea
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 22 deletions.
34 changes: 18 additions & 16 deletions packages/block-library/src/shortcode/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,24 @@ export default function ShortcodeEdit( { attributes, setAttributes } ) {
const inputId = `blocks-shortcode-input-${ instanceId }`;

return (
<div { ...useBlockProps( { 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 { ...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>
);
}
6 changes: 0 additions & 6 deletions packages/block-library/src/shortcode/editor.scss
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down

0 comments on commit be42fea

Please sign in to comment.