From 8c0c1a58ac743ca74f483a6fccc1bd9b8c74c2a7 Mon Sep 17 00:00:00 2001 From: tellthemachines Date: Wed, 5 Oct 2022 14:25:53 +1100 Subject: [PATCH] Legacy Group inner block wrapper should work with constrained layout. (#44660) * Legacy Group inner block wrapper should work with constrained layout. * Also restore wrapper on the front end. * Allow Group blocks with inner wrapper to show placeholder * More specific CSS selectors. --- lib/block-supports/layout.php | 2 +- .../src/components/button-block-appender/style.scss | 4 +++- packages/block-library/src/group/edit.js | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/block-supports/layout.php b/lib/block-supports/layout.php index 060aa079018109..e2ae3077746255 100644 --- a/lib/block-supports/layout.php +++ b/lib/block-supports/layout.php @@ -429,7 +429,7 @@ function gutenberg_restore_group_inner_container( $block_content, $block ) { if ( WP_Theme_JSON_Resolver_Gutenberg::theme_has_support() || 1 === preg_match( $group_with_inner_container_regex, $block_content ) || - ( isset( $block['attrs']['layout']['type'] ) && 'default' !== $block['attrs']['layout']['type'] ) + ( isset( $block['attrs']['layout']['type'] ) && 'flex' === $block['attrs']['layout']['type'] ) ) { return $block_content; } diff --git a/packages/block-editor/src/components/button-block-appender/style.scss b/packages/block-editor/src/components/button-block-appender/style.scss index dfeb3241c7bb70..45358b9a0f0503 100644 --- a/packages/block-editor/src/components/button-block-appender/style.scss +++ b/packages/block-editor/src/components/button-block-appender/style.scss @@ -35,7 +35,9 @@ // When the appender shows up in empty container blocks, such as Group and Columns, add an extra click state. .block-list-appender:only-child { .is-layout-constrained.block-editor-block-list__block:not(.is-selected) > &, - .is-layout-flow.block-editor-block-list__block:not(.is-selected) > & { + .is-layout-flow.block-editor-block-list__block:not(.is-selected) > &, + .is-layout-constrained.block-editor-block-list__block:not(.is-selected) > .block-editor-block-list__layout > &, + .is-layout-flow.block-editor-block-list__block:not(.is-selected) > .block-editor-block-list__layout > & { pointer-events: none; &::after { diff --git a/packages/block-library/src/group/edit.js b/packages/block-library/src/group/edit.js index e9e318b6b10a7a..9d43c4339ba1f5 100644 --- a/packages/block-library/src/group/edit.js +++ b/packages/block-library/src/group/edit.js @@ -53,7 +53,7 @@ function GroupEdit( { attributes, setAttributes, clientId } ) { ? { ...defaultLayout, ...layout, type: 'default' } : { ...defaultLayout, ...layout }; const { type = 'default' } = usedLayout; - const layoutSupportEnabled = themeSupportsLayout || type !== 'default'; + const layoutSupportEnabled = themeSupportsLayout || type === 'flex'; const blockProps = useBlockProps();