From b8fca79e9425f260b1578187dede80a175d3f743 Mon Sep 17 00:00:00 2001 From: Daniel Richards Date: Mon, 10 Jun 2024 18:21:49 +0800 Subject: [PATCH] Fix increasingly big canvas in the post editor when editing patterns (#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 91edeb9a2ffec90ff5c069fb983146803c2c7c38. * Revert "Fix big canvas in the post editor when editing patterns" This reverts commit 37326a90f0c374b6bc719ce6bfc82747148ca5e9. * 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 Co-authored-by: youknowriad Co-authored-by: ellatrix --- packages/edit-post/src/components/layout/index.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/edit-post/src/components/layout/index.js b/packages/edit-post/src/components/layout/index.js index 9e50d8fb9b6c2..e20732cb646bc 100644 --- a/packages/edit-post/src/components/layout/index.js +++ b/packages/edit-post/src/components/layout/index.js @@ -126,7 +126,7 @@ 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 && @@ -134,9 +134,12 @@ function useEditorStyles() { renderingMode === 'post-only' && ! DESIGN_POST_TYPES.includes( postType ) ) { - baseStyles.push( { - css: 'body{padding-bottom: 40vh}', - } ); + return [ + ...baseStyles, + { + css: 'body{padding-bottom: 40vh}', + }, + ]; } return baseStyles; @@ -145,6 +148,7 @@ function useEditorStyles() { editorSettings.disableLayoutStyles, editorSettings.styles, hasThemeStyleSupport, + postType, ] ); }