From bb8a3b9e6350b945af40fb0765757482d6135991 Mon Sep 17 00:00:00 2001 From: tellthemachines Date: Tue, 3 Oct 2023 14:22:32 +1100 Subject: [PATCH] Fix output of Navigation block classnames in the editor. (#54992) --- .../src/navigation/edit/index.js | 43 +++++++++++-------- .../src/navigation/edit/inner-blocks.js | 1 + 2 files changed, 27 insertions(+), 17 deletions(-) diff --git a/packages/block-library/src/navigation/edit/index.js b/packages/block-library/src/navigation/edit/index.js index 483e8abaab24f1..7c29f18d4940d4 100644 --- a/packages/block-library/src/navigation/edit/index.js +++ b/packages/block-library/src/navigation/edit/index.js @@ -93,6 +93,7 @@ function Navigation( { // navigation block settings. hasSubmenuIndicatorSetting = true, customPlaceholder: CustomPlaceholder = null, + __unstableLayoutClassNames: layoutClassNames, } ) { const { openSubmenusOnClick, @@ -293,23 +294,31 @@ function Navigation( { const isResponsive = 'never' !== overlayMenu; const blockProps = useBlockProps( { ref: navRef, - className: classnames( className, { - 'items-justified-right': justifyContent === 'right', - 'items-justified-space-between': justifyContent === 'space-between', - 'items-justified-left': justifyContent === 'left', - 'items-justified-center': justifyContent === 'center', - 'is-vertical': orientation === 'vertical', - 'no-wrap': flexWrap === 'nowrap', - 'is-responsive': isResponsive, - 'has-text-color': !! textColor.color || !! textColor?.class, - [ getColorClassName( 'color', textColor?.slug ) ]: - !! textColor?.slug, - 'has-background': !! backgroundColor.color || backgroundColor.class, - [ getColorClassName( 'background-color', backgroundColor?.slug ) ]: - !! backgroundColor?.slug, - [ `has-text-decoration-${ textDecoration }` ]: textDecoration, - 'block-editor-block-content-overlay': hasBlockOverlay, - } ), + className: classnames( + className, + { + 'items-justified-right': justifyContent === 'right', + 'items-justified-space-between': + justifyContent === 'space-between', + 'items-justified-left': justifyContent === 'left', + 'items-justified-center': justifyContent === 'center', + 'is-vertical': orientation === 'vertical', + 'no-wrap': flexWrap === 'nowrap', + 'is-responsive': isResponsive, + 'has-text-color': !! textColor.color || !! textColor?.class, + [ getColorClassName( 'color', textColor?.slug ) ]: + !! textColor?.slug, + 'has-background': + !! backgroundColor.color || backgroundColor.class, + [ getColorClassName( + 'background-color', + backgroundColor?.slug + ) ]: !! backgroundColor?.slug, + [ `has-text-decoration-${ textDecoration }` ]: textDecoration, + 'block-editor-block-content-overlay': hasBlockOverlay, + }, + layoutClassNames + ), style: { color: ! textColor?.slug && textColor?.color, backgroundColor: ! backgroundColor?.slug && backgroundColor?.color, diff --git a/packages/block-library/src/navigation/edit/inner-blocks.js b/packages/block-library/src/navigation/edit/inner-blocks.js index 812b37ea71a641..19258213f26e5f 100644 --- a/packages/block-library/src/navigation/edit/inner-blocks.js +++ b/packages/block-library/src/navigation/edit/inner-blocks.js @@ -118,6 +118,7 @@ export default function NavigationInnerBlocks( { : false, placeholder: showPlaceholder ? placeholder : undefined, __experimentalCaptureToolbars: true, + __unstableDisableLayoutClassNames: true, } );