Skip to content

Commit

Permalink
Fix increasingly big canvas in the post editor when editing patterns (#…
Browse files Browse the repository at this point in the history
…62360)

* Fix big canvas in the post editor when editing patterns

* Avoid adding multiple padding rules

* Revert "Avoid adding multiple padding rules"

This reverts commit 91edeb9.

* Revert "Fix big canvas in the post editor when editing patterns"

This reverts commit 37326a9.

* Ensure `useEditorStyles` recomputes whenever the postType changes

* Fix mutation of `editorSettings.styles` resulting in editor styles incorrectly persisting and being duplicated

----

Co-authored-by: talldan <talldanwp@git.wordpress.org>
Co-authored-by: youknowriad <youknowriad@git.wordpress.org>
Co-authored-by: ellatrix <ellatrix@git.wordpress.org>
  • Loading branch information
4 people authored Jun 10, 2024
1 parent e04b36c commit b8fca79
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions packages/edit-post/src/components/layout/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,17 +126,20 @@ function useEditorStyles() {
? editorSettings.styles ?? []
: defaultEditorStyles;

// Add a constant padding for the typewritter effect. When typing at the
// Add a constant padding for the typewriter effect. When typing at the
// bottom, there needs to be room to scroll up.
if (
! isZoomedOutView &&
! hasMetaBoxes &&
renderingMode === 'post-only' &&
! DESIGN_POST_TYPES.includes( postType )
) {
baseStyles.push( {
css: 'body{padding-bottom: 40vh}',
} );
return [
...baseStyles,
{
css: 'body{padding-bottom: 40vh}',
},
];
}

return baseStyles;
Expand All @@ -145,6 +148,7 @@ function useEditorStyles() {
editorSettings.disableLayoutStyles,
editorSettings.styles,
hasThemeStyleSupport,
postType,
] );
}

Expand Down

0 comments on commit b8fca79

Please sign in to comment.