From d5b4224b60636fd2ebd8c14e3a387fac788ecb57 Mon Sep 17 00:00:00 2001 From: Ella Date: Fri, 6 Oct 2023 20:58:51 +0300 Subject: [PATCH] Fix deleting paragraph after block --- packages/block-editor/src/store/actions.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/packages/block-editor/src/store/actions.js b/packages/block-editor/src/store/actions.js index 72cfaeabd66c7d..fa4d651fe79b27 100644 --- a/packages/block-editor/src/store/actions.js +++ b/packages/block-editor/src/store/actions.js @@ -1012,7 +1012,20 @@ export const mergeBlocks = const blockA = select.getBlock( clientIdA ); if ( isUnmodifiedDefaultBlock( blockA ) ) { - dispatch.removeBlock( clientIdA, false ); + dispatch.removeBlock( + clientIdA, + select.isBlockSelected( clientIdA ) + ); + return; + } + + const blockB = select.getBlock( clientIdB ); + + if ( isUnmodifiedDefaultBlock( blockB ) ) { + dispatch.removeBlock( + clientIdB, + select.isBlockSelected( clientIdB ) + ); return; } @@ -1028,8 +1041,6 @@ export const mergeBlocks = return; } - const blockB = select.getBlock( clientIdB ); - if ( ! blockAType.merge ) { // If there's no merge function defined, attempt merging inner // blocks.