From 81bd1a57e028cd30633b99ec1a827e1e7239b900 Mon Sep 17 00:00:00 2001 From: Ella Date: Fri, 1 Mar 2024 14:10:32 +0200 Subject: [PATCH] Restore typewriter padding --- .../src/components/visual-editor/index.js | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/packages/edit-post/src/components/visual-editor/index.js b/packages/edit-post/src/components/visual-editor/index.js index 06f28d9b4e1a2f..d1f08a2b21f57f 100644 --- a/packages/edit-post/src/components/visual-editor/index.js +++ b/packages/edit-post/src/components/visual-editor/index.js @@ -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'; @@ -26,6 +27,7 @@ const isGutenbergPlugin = process.env.IS_GUTENBERG_PLUGIN ? true : false; export default function VisualEditor( { styles } ) { const { isWelcomeGuideVisible, + renderingMode, isBlockBasedTheme, hasV3BlocksOnly, isEditingTemplate, @@ -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 ||