diff --git a/packages/edit-post/src/components/layout/index.js b/packages/edit-post/src/components/layout/index.js index 711d7866229ba4..50f0a95f274bb2 100644 --- a/packages/edit-post/src/components/layout/index.js +++ b/packages/edit-post/src/components/layout/index.js @@ -117,8 +117,8 @@ function useEditorStyles() { ? editorSettings.styles ?? [] : defaultEditorStyles; - // Add a constant padding for the typewriter effect. When typing at the - // bottom, there needs to be room to scroll up. + // Add a space for the typewriter effect. When typing in the last block, + // there needs to be room to scroll up. if ( ! isZoomedOutView && renderingMode === 'post-only' && diff --git a/packages/edit-post/src/components/layout/use-padding-appender.js b/packages/edit-post/src/components/layout/use-padding-appender.js index ff342ded90817a..efd46a485058ca 100644 --- a/packages/edit-post/src/components/layout/use-padding-appender.js +++ b/packages/edit-post/src/components/layout/use-padding-appender.js @@ -18,12 +18,12 @@ export function usePaddingAppender() { const { ownerDocument } = node; const { defaultView } = ownerDocument; - const paddingBottom = defaultView.parseInt( - defaultView.getComputedStyle( node ).paddingBottom, + const pseudoHeight = defaultView.parseInt( + defaultView.getComputedStyle( node, ':after' ).height, 10 ); - if ( ! paddingBottom ) { + if ( ! pseudoHeight ) { return; } @@ -38,25 +38,20 @@ export function usePaddingAppender() { return; } - event.preventDefault(); + event.stopPropagation(); const blockOrder = registry .select( blockEditorStore ) .getBlockOrder( '' ); const lastBlockClientId = blockOrder[ blockOrder.length - 1 ]; - // Do nothing when only default block appender is present. - if ( ! lastBlockClientId ) { - return; - } - const lastBlock = registry .select( blockEditorStore ) .getBlock( lastBlockClientId ); const { selectBlock, insertDefaultBlock } = registry.dispatch( blockEditorStore ); - if ( isUnmodifiedDefaultBlock( lastBlock ) ) { + if ( lastBlock && isUnmodifiedDefaultBlock( lastBlock ) ) { selectBlock( lastBlockClientId ); } else { insertDefaultBlock();