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 committed Jun 11, 2024
1 parent cbaef08 commit 58518e1
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 @@ -118,17 +118,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 @@ -137,6 +140,7 @@ function useEditorStyles() {
editorSettings.disableLayoutStyles,
editorSettings.styles,
hasThemeStyleSupport,
postType,
] );
}

Expand Down

0 comments on commit 58518e1

Please sign in to comment.