Skip to content

Commit

Permalink
Restore typewriter padding
Browse files Browse the repository at this point in the history
  • Loading branch information
ellatrix committed Mar 1, 2024
1 parent e4275f7 commit 81bd1a5
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions packages/edit-post/src/components/visual-editor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
store as editorStore,
privateApis as editorPrivateApis,
} from '@wordpress/editor';
import { useMemo } from '@wordpress/element';
import { useSelect } from '@wordpress/data';
import { store as blocksStore } from '@wordpress/blocks';

Expand All @@ -26,6 +27,7 @@ const isGutenbergPlugin = process.env.IS_GUTENBERG_PLUGIN ? true : false;
export default function VisualEditor( { styles } ) {
const {
isWelcomeGuideVisible,
renderingMode,
isBlockBasedTheme,
hasV3BlocksOnly,
isEditingTemplate,
Expand All @@ -47,6 +49,27 @@ export default function VisualEditor( { styles } ) {
};
}, [] );

let paddingBottom;

// Add a constant padding for the typewritter effect. When typing at the
// bottom, there needs to be room to scroll up.
if ( renderingMode === 'post-only' ) {
paddingBottom = '40vh';
}

styles = useMemo(
() => [
...styles,
{
// We should move this in to future to the body.
css: paddingBottom
? `body{padding-bottom:${ paddingBottom }}`
: '',
},
],
[ styles, paddingBottom ]
);

const isToBeIframed =
hasV3BlocksOnly ||
isGutenbergPlugin ||
Expand Down

0 comments on commit 81bd1a5

Please sign in to comment.