Skip to content

Commit

Permalink
Fix the layout definition in the template mode (#32425)
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed Jun 7, 2021
1 parent bbc0041 commit b9d9d71
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/block-editor/src/hooks/duotone.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ const withDuotoneStyles = createHigherOrderComponent(
);
const selectorsGroup = selectorsScoped.join( ', ' );

const className = classnames( props?.classname, id );
const className = classnames( props?.className, id );

return (
<>
Expand Down
11 changes: 6 additions & 5 deletions packages/block-editor/src/hooks/style.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,11 +265,12 @@ const withElementsStyles = createHigherOrderComponent(
<BlockListBlock
{ ...props }
className={
elements &&
classnames(
props.classname,
blockElementsContainerIdentifier
)
elements
? classnames(
props.className,
blockElementsContainerIdentifier
)
: props.className
}
/>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
8 changes: 6 additions & 2 deletions packages/edit-post/src/components/visual-editor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,10 @@ export default function VisualEditor( { styles } ) {
);

const layout = useMemo( () => {
if ( isTemplateMode ) {
return { type: 'default' };
}

if ( themeSupportsLayout ) {
const alignments =
contentSize || wideSize
Expand All @@ -183,7 +187,7 @@ export default function VisualEditor( { styles } ) {
};
}
return undefined;
}, [ themeSupportsLayout, contentSize, wideSize ] );
}, [ isTemplateMode, themeSupportsLayout, contentSize, wideSize ] );

return (
<div
Expand Down Expand Up @@ -222,7 +226,7 @@ export default function VisualEditor( { styles } ) {
styles={ styles }
style={ { paddingBottom } }
>
{ themeSupportsLayout && (
{ themeSupportsLayout && ! isTemplateMode && (
<LayoutStyle
selector=".edit-post-visual-editor__post-title-wrapper, .block-editor-block-list__layout.is-root-container"
layout={ defaultLayout }
Expand Down

0 comments on commit b9d9d71

Please sign in to comment.