Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shortcode Block: fix layout margin override #55028

Merged
merged 1 commit into from
May 13, 2024
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.
Jump to
Jump to file
Failed to load files.
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
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