Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the layout definition in the template mode #32425

Merged
merged 1 commit into from
Jun 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -268,11 +268,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