Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 13 additions & 17 deletions packages/block-library/src/shortcode/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,25 @@
import { __ } from '@wordpress/i18n';
import { PlainText, useBlockProps } from '@wordpress/block-editor';
import { useInstanceId } from '@wordpress/compose';
import { Icon, shortcode } from '@wordpress/icons';
import { Placeholder } from '@wordpress/components';
import { shortcode } from '@wordpress/icons';

export default function ShortcodeEdit( { attributes, setAttributes } ) {
const instanceId = useInstanceId( ShortcodeEdit );
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() }>
<Placeholder icon={ shortcode } label={ __( 'Shortcode' ) }>
<PlainText
className="blocks-shortcode__textarea"
id={ inputId }
value={ attributes.text }
aria-label={ __( 'Shortcode text' ) }
placeholder={ __( 'Write shortcode here…' ) }
onChange={ ( text ) => setAttributes( { text } ) }
/>
</Placeholder>
</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;
}
}
Comment on lines -1 to -5

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This style is intended to override the Placeholder's minimum height. However, since min-height has been removed in #54216, it is no longer needed.


// 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