Skip to content

Commit

Permalink
Edit Post: Optimize legacy post content layout (#44506)
Browse files Browse the repository at this point in the history
  • Loading branch information
tyxla authored Sep 28, 2022
1 parent b5aacb3 commit 4a4d110
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions packages/edit-post/src/components/visual-editor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,14 +266,21 @@ export default function VisualEditor( { styles } ) {
const layout = postContentBlock?.attributes?.layout || {};

// Update type for blocks using legacy layouts.
const postContentLayout =
layout &&
( layout?.type === 'constrained' ||
layout?.inherit ||
layout?.contentSize ||
layout?.wideSize )
const postContentLayout = useMemo( () => {
return layout &&
( layout?.type === 'constrained' ||
layout?.inherit ||
layout?.contentSize ||
layout?.wideSize )
? { ...globalLayoutSettings, ...layout, type: 'constrained' }
: { ...globalLayoutSettings, ...layout, type: 'default' };
}, [
layout?.type,
layout?.inherit,
layout?.contentSize,
layout?.wideSize,
globalLayoutSettings,
] );

// If there is a Post Content block we use its layout for the block list;
// if not, this must be a classic theme, in which case we use the fallback layout.
Expand Down

0 comments on commit 4a4d110

Please sign in to comment.