From ee2340aa613e85423de8bede179771ac43ec9685 Mon Sep 17 00:00:00 2001 From: tellthemachines Date: Mon, 12 Feb 2024 16:26:52 +1100 Subject: [PATCH 1/3] Fix Spacer orientation when inside a block with default flex layout. --- packages/block-library/src/spacer/edit.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/block-library/src/spacer/edit.js b/packages/block-library/src/spacer/edit.js index 11133732042d3..d397e0d784eb9 100644 --- a/packages/block-library/src/spacer/edit.js +++ b/packages/block-library/src/spacer/edit.js @@ -93,9 +93,13 @@ const SpacerEdit = ( { return editorSettings?.disableCustomSpacingSizes; } ); const { orientation } = context; - const { orientation: parentOrientation, type } = parentLayout || {}; + const { + orientation: parentOrientation, + type, + default: { type: defaultType } = {}, + } = parentLayout || {}; // Check if the spacer is inside a flex container. - const isFlexLayout = type === 'flex'; + const isFlexLayout = type === 'flex' || defaultType === 'flex'; // If the spacer is inside a flex container, it should either inherit the orientation // of the parent or use the flex default orientation. const inheritedOrientation = From 240209f5893b1243722823fb23c637978f269805 Mon Sep 17 00:00:00 2001 From: tellthemachines Date: Mon, 12 Feb 2024 16:48:49 +1100 Subject: [PATCH 2/3] Update packages/block-library/src/spacer/edit.js check there's no type before using default type Co-authored-by: Andrew Serong <14988353+andrewserong@users.noreply.github.com> --- packages/block-library/src/spacer/edit.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/block-library/src/spacer/edit.js b/packages/block-library/src/spacer/edit.js index d397e0d784eb9..4e00262d412cd 100644 --- a/packages/block-library/src/spacer/edit.js +++ b/packages/block-library/src/spacer/edit.js @@ -99,7 +99,7 @@ const SpacerEdit = ( { default: { type: defaultType } = {}, } = parentLayout || {}; // Check if the spacer is inside a flex container. - const isFlexLayout = type === 'flex' || defaultType === 'flex'; + const isFlexLayout = type === 'flex' || ( ! type && defaultType === 'flex' ); // If the spacer is inside a flex container, it should either inherit the orientation // of the parent or use the flex default orientation. const inheritedOrientation = From bed3611d494b286baeb20a2a44f3d4a1aa2105ae Mon Sep 17 00:00:00 2001 From: Andrew Serong <14988353+andrewserong@users.noreply.github.com> Date: Mon, 12 Feb 2024 16:56:43 +1100 Subject: [PATCH 3/3] Fix linting error --- packages/block-library/src/spacer/edit.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/block-library/src/spacer/edit.js b/packages/block-library/src/spacer/edit.js index 4e00262d412cd..d384f7997ec38 100644 --- a/packages/block-library/src/spacer/edit.js +++ b/packages/block-library/src/spacer/edit.js @@ -99,7 +99,8 @@ const SpacerEdit = ( { default: { type: defaultType } = {}, } = parentLayout || {}; // Check if the spacer is inside a flex container. - const isFlexLayout = type === 'flex' || ( ! type && defaultType === 'flex' ); + const isFlexLayout = + type === 'flex' || ( ! type && defaultType === 'flex' ); // If the spacer is inside a flex container, it should either inherit the orientation // of the parent or use the flex default orientation. const inheritedOrientation =