From 12ce13a14b8405425939774a1de1780b3c5f9db2 Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Thu, 3 Jun 2021 13:37:09 +0100 Subject: [PATCH] Fix the layout definition in the template mode (#32425) --- packages/block-editor/src/hooks/duotone.js | 2 +- packages/block-editor/src/hooks/style.js | 11 ++++++----- .../src/components/sidebar/template/actions.js | 4 +++- .../edit-post/src/components/visual-editor/index.js | 8 ++++++-- 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/packages/block-editor/src/hooks/duotone.js b/packages/block-editor/src/hooks/duotone.js index 6ec04dee153863..c4845b34b49f83 100644 --- a/packages/block-editor/src/hooks/duotone.js +++ b/packages/block-editor/src/hooks/duotone.js @@ -224,7 +224,7 @@ const withDuotoneStyles = createHigherOrderComponent( ); const selectorsGroup = selectorsScoped.join( ', ' ); - const className = classnames( props?.classname, id ); + const className = classnames( props?.className, id ); return ( <> diff --git a/packages/block-editor/src/hooks/style.js b/packages/block-editor/src/hooks/style.js index cec440b45d79da..859bde72addcfb 100644 --- a/packages/block-editor/src/hooks/style.js +++ b/packages/block-editor/src/hooks/style.js @@ -268,11 +268,12 @@ const withElementsStyles = createHigherOrderComponent( diff --git a/packages/edit-post/src/components/sidebar/template/actions.js b/packages/edit-post/src/components/sidebar/template/actions.js index ab9884b1638d8c..49b1b8c15ce40e 100644 --- a/packages/edit-post/src/components/sidebar/template/actions.js +++ b/packages/edit-post/src/components/sidebar/template/actions.js @@ -84,7 +84,9 @@ function PostTemplateActions() { createBlock( 'core/site-tagline' ), createBlock( 'core/separator' ), createBlock( 'core/post-title' ), - createBlock( 'core/post-content' ), + createBlock( 'core/post-content', { + layout: { inherit: true }, + } ), ]; __unstableSwitchToTemplateMode( { slug: diff --git a/packages/edit-post/src/components/visual-editor/index.js b/packages/edit-post/src/components/visual-editor/index.js index a1bd43cd8cca0b..9164bdfd2c9549 100644 --- a/packages/edit-post/src/components/visual-editor/index.js +++ b/packages/edit-post/src/components/visual-editor/index.js @@ -171,6 +171,10 @@ export default function VisualEditor( { styles } ) { ); const layout = useMemo( () => { + if ( isTemplateMode ) { + return { type: 'default' }; + } + if ( themeSupportsLayout ) { const alignments = contentSize || wideSize @@ -183,7 +187,7 @@ export default function VisualEditor( { styles } ) { }; } return undefined; - }, [ themeSupportsLayout, contentSize, wideSize ] ); + }, [ isTemplateMode, themeSupportsLayout, contentSize, wideSize ] ); return (
- { themeSupportsLayout && ( + { themeSupportsLayout && ! isTemplateMode && (