Skip to content
Closed
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
18 changes: 12 additions & 6 deletions packages/block-library/src/button/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import {
__experimentalGetElementClassName,
store as blockEditorStore,
useBlockEditingMode,
useSettings,
} from '@wordpress/block-editor';
import { displayShortcut, isKeyboardEvent, ENTER } from '@wordpress/keycodes';
import { link, linkOff } from '@wordpress/icons';
Expand Down Expand Up @@ -256,6 +257,9 @@ function ButtonEdit( props ) {
[ context, isSelected, metadata?.bindings?.url ]
);

const [ buttonWidth ] = useSettings( 'blocks.core/button' );
const isWidthPanelEnabled = false !== buttonWidth?.[ 0 ]?.width;

return (
<>
<div
Expand Down Expand Up @@ -370,12 +374,14 @@ function ButtonEdit( props ) {
/>
</Popover>
) }
<InspectorControls>
<WidthPanel
selectedWidth={ width }
setAttributes={ setAttributes }
/>
</InspectorControls>
{ isWidthPanelEnabled && (
<InspectorControls>
<WidthPanel
selectedWidth={ width }
setAttributes={ setAttributes }
/>
</InspectorControls>
) }
<InspectorControls group="advanced">
{ isLinkTag && (
<TextControl
Expand Down