From 9772f535968f51f1e4752923f4e371ccd13980e2 Mon Sep 17 00:00:00 2001 From: tellthemachines Date: Tue, 28 Mar 2023 15:55:55 +1100 Subject: [PATCH 1/2] Show child layout controls by default --- .../src/components/global-styles/dimensions-panel.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/block-editor/src/components/global-styles/dimensions-panel.js b/packages/block-editor/src/components/global-styles/dimensions-panel.js index b63d9c5d063739..c61704396ea7fd 100644 --- a/packages/block-editor/src/components/global-styles/dimensions-panel.js +++ b/packages/block-editor/src/components/global-styles/dimensions-panel.js @@ -189,6 +189,7 @@ const DEFAULT_CONTROLS = { margin: true, blockGap: true, minHeight: true, + childLayout: true, }; export default function DimensionsPanel( { @@ -612,7 +613,11 @@ export default function DimensionsPanel( { hasValue={ hasChildLayoutValue } label={ childLayoutOrientationLabel } onDeselect={ resetChildLayoutValue } - isShownByDefault={ defaultControls.childLayout } + isShownByDefault={ + typeof defaultControls.childLayout === 'boolean' + ? defaultControls.childLayout + : DEFAULT_CONTROLS.childLayout + } panelId={ panelId } > Date: Fri, 31 Mar 2023 13:58:35 +1100 Subject: [PATCH 2/2] Add consistency to control display defaults --- .../global-styles/dimensions-panel.js | 42 ++++++++++++------- .../global-styles/dimensions-panel.js | 11 +++++ 2 files changed, 38 insertions(+), 15 deletions(-) diff --git a/packages/block-editor/src/components/global-styles/dimensions-panel.js b/packages/block-editor/src/components/global-styles/dimensions-panel.js index c61704396ea7fd..19f9d97c02aace 100644 --- a/packages/block-editor/src/components/global-styles/dimensions-panel.js +++ b/packages/block-editor/src/components/global-styles/dimensions-panel.js @@ -183,12 +183,12 @@ function DimensionsToolsPanel( { } const DEFAULT_CONTROLS = { - contentSize: true, - wideSize: true, - padding: true, - margin: true, - blockGap: true, - minHeight: true, + contentSize: false, + wideSize: false, + padding: false, + margin: false, + blockGap: false, + minHeight: false, childLayout: true, }; @@ -421,7 +421,10 @@ export default function DimensionsPanel( { label={ __( 'Content size' ) } hasValue={ hasUserSetContentSizeValue } onDeselect={ resetContentSizeValue } - isShownByDefault={ defaultControls.contentSize } + isShownByDefault={ + defaultControls.contentSize ?? + DEFAULT_CONTROLS.contentSize + } panelId={ panelId } > @@ -447,7 +450,9 @@ export default function DimensionsPanel( { label={ __( 'Wide size' ) } hasValue={ hasUserSetWideSizeValue } onDeselect={ resetWideSizeValue } - isShownByDefault={ defaultControls.wideSize } + isShownByDefault={ + defaultControls.wideSize ?? DEFAULT_CONTROLS.wideSize + } panelId={ panelId } > @@ -472,7 +477,9 @@ export default function DimensionsPanel( { hasValue={ hasPaddingValue } label={ __( 'Padding' ) } onDeselect={ resetPaddingValue } - isShownByDefault={ defaultControls.padding } + isShownByDefault={ + defaultControls.padding ?? DEFAULT_CONTROLS.padding + } className={ classnames( { 'tools-panel-item-spacing': showSpacingPresetsControl, } ) } @@ -511,7 +518,9 @@ export default function DimensionsPanel( { hasValue={ hasMarginValue } label={ __( 'Margin' ) } onDeselect={ resetMarginValue } - isShownByDefault={ defaultControls.margin } + isShownByDefault={ + defaultControls.margin ?? DEFAULT_CONTROLS.margin + } className={ classnames( { 'tools-panel-item-spacing': showSpacingPresetsControl, } ) } @@ -550,7 +559,9 @@ export default function DimensionsPanel( { hasValue={ hasGapValue } label={ __( 'Block spacing' ) } onDeselect={ resetGapValue } - isShownByDefault={ defaultControls.blockGap } + isShownByDefault={ + defaultControls.blockGap ?? DEFAULT_CONTROLS.blockGap + } className={ classnames( { 'tools-panel-item-spacing': showSpacingPresetsControl, } ) } @@ -596,7 +607,9 @@ export default function DimensionsPanel( { hasValue={ hasMinHeightValue } label={ __( 'Min. height' ) } onDeselect={ resetMinHeightValue } - isShownByDefault={ defaultControls.minHeight } + isShownByDefault={ + defaultControls.minHeight ?? DEFAULT_CONTROLS.minHeight + } panelId={ panelId } > diff --git a/packages/edit-site/src/components/global-styles/dimensions-panel.js b/packages/edit-site/src/components/global-styles/dimensions-panel.js index 7875591c5676f5..0d43d71cec3d12 100644 --- a/packages/edit-site/src/components/global-styles/dimensions-panel.js +++ b/packages/edit-site/src/components/global-styles/dimensions-panel.js @@ -16,6 +16,16 @@ const { DimensionsPanel: StylesDimensionsPanel, } = unlock( blockEditorPrivateApis ); +const DEFAULT_CONTROLS = { + contentSize: true, + wideSize: true, + padding: true, + margin: true, + blockGap: true, + minHeight: true, + childLayout: false, +}; + export default function DimensionsPanel( { name, variation = '' } ) { let prefixParts = []; if ( variation ) { @@ -66,6 +76,7 @@ export default function DimensionsPanel( { name, variation = '' } ) { onChange={ onChange } settings={ settings } includeLayoutControls + defaultControls={ DEFAULT_CONTROLS } /> ); }