From 58decd0d28b051dd405441fa9b971e337df8343a Mon Sep 17 00:00:00 2001 From: Mitchell Austin Date: Mon, 2 Sep 2024 16:28:22 -0700 Subject: [PATCH 1/4] Fix minimally --- .../edit-post/src/components/layout/use-padding-appender.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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..d2f2239b6f243f 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; } From ff1aa9365f790c90469b4f94d745fcc397718ff4 Mon Sep 17 00:00:00 2001 From: Mitchell Austin Date: Mon, 2 Sep 2024 16:28:45 -0700 Subject: [PATCH 2/4] Revise comment --- packages/edit-post/src/components/layout/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/edit-post/src/components/layout/index.js b/packages/edit-post/src/components/layout/index.js index 519b32691c6a49..185f97ba45a56f 100644 --- a/packages/edit-post/src/components/layout/index.js +++ b/packages/edit-post/src/components/layout/index.js @@ -126,8 +126,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' && From 036988a2d6d9502f5e03ed5bd57701215cf50f17 Mon Sep 17 00:00:00 2001 From: Mitchell Austin Date: Tue, 3 Sep 2024 08:44:10 -0700 Subject: [PATCH 3/4] =?UTF-8?q?Stop=20propagation=20and=20don=E2=80=99t=20?= =?UTF-8?q?prevent=20default?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../edit-post/src/components/layout/use-padding-appender.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 d2f2239b6f243f..7c4484c938eb55 100644 --- a/packages/edit-post/src/components/layout/use-padding-appender.js +++ b/packages/edit-post/src/components/layout/use-padding-appender.js @@ -38,7 +38,7 @@ export function usePaddingAppender() { return; } - event.preventDefault(); + event.stopPropagation(); const blockOrder = registry .select( blockEditorStore ) From 8839ca6e365fa65a820e0608ba4d68f6c42cb8cd Mon Sep 17 00:00:00 2001 From: Mitchell Austin Date: Tue, 3 Sep 2024 10:04:39 -0700 Subject: [PATCH 4/4] Insert default block if no blocks are present --- .../src/components/layout/use-padding-appender.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) 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 7c4484c938eb55..efd46a485058ca 100644 --- a/packages/edit-post/src/components/layout/use-padding-appender.js +++ b/packages/edit-post/src/components/layout/use-padding-appender.js @@ -45,18 +45,13 @@ export function usePaddingAppender() { .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();