Skip to content

Commit

Permalink
Fix big canvas in the post editor when editing patterns
Browse files Browse the repository at this point in the history
  • Loading branch information
talldan committed Jun 6, 2024
1 parent 6c406e5 commit 37326a9
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions packages/edit-post/src/components/layout/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ const DESIGN_POST_TYPES = [
'wp_navigation',
];

const TYPEWRITER_STYLE = {
css: 'body{padding-bottom: 40vh}',
};

function useEditorStyles() {
const {
hasThemeStyleSupport,
Expand Down Expand Up @@ -114,21 +118,23 @@ function useEditorStyles() {
} );
}

const baseStyles = hasThemeStyles
let baseStyles = hasThemeStyles
? 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}',
} );
baseStyles.push( TYPEWRITER_STYLE );
} else if ( baseStyles.includes( TYPEWRITER_STYLE ) ) {
baseStyles = baseStyles.filter(
( style ) => style !== TYPEWRITER_STYLE
);
}

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

Expand Down

0 comments on commit 37326a9

Please sign in to comment.