From f41cf5e988bd6d752ab02a27a916d3d395d18ca0 Mon Sep 17 00:00:00 2001 From: tellthemachines Date: Thu, 13 Nov 2025 14:36:43 +1100 Subject: [PATCH 01/12] Try enabling paragraphs to be added to contentOnly patterns --- packages/block-editor/src/store/selectors.js | 34 ++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/packages/block-editor/src/store/selectors.js b/packages/block-editor/src/store/selectors.js index 12aedeaae2c845..048a09a824d334 100644 --- a/packages/block-editor/src/store/selectors.js +++ b/packages/block-editor/src/store/selectors.js @@ -1740,7 +1740,20 @@ const canInsertBlockTypeUnmemoized = ( rootClientId ) ) { - return false; + // Allow inserting a Paragraph block anywhere that another Paragraph block already exists + // when in contentOnly mode. + if ( blockName === 'core/paragraph' ) { + const existingBlocks = getBlockOrder( state, rootClientId ); + const hasParagraphBlock = existingBlocks.some( + ( clientId ) => + getBlockName( state, clientId ) === 'core/paragraph' + ); + if ( ! hasParagraphBlock ) { + return false; + } + } else { + return false; + } } const parentName = getBlockName( state, rootClientId ); @@ -1913,7 +1926,24 @@ export function canRemoveBlock( state, clientId ) { rootClientId ) ) { - return false; + // Allow removing a Paragraph block when other Paragraph blocks exist + // in contentOnly mode. + const blockName = getBlockName( state, clientId ); + if ( + rootBlockEditingMode === 'contentOnly' && + blockName === 'core/paragraph' + ) { + const existingBlocks = getBlockOrder( state, rootClientId ); + const paragraphBlocks = existingBlocks.filter( + ( id ) => getBlockName( state, id ) === 'core/paragraph' + ); + // Allow removal if there are other paragraph blocks besides this one + if ( ! ( paragraphBlocks.length > 0 ) ) { + return false; + } + } else { + return false; + } } return rootBlockEditingMode !== 'disabled'; From fbde505ae33cc30dba6e08151bc0e7dcddf5559a Mon Sep 17 00:00:00 2001 From: Daniel Richards Date: Mon, 16 Feb 2026 13:28:12 +0800 Subject: [PATCH 02/12] Add block order to selector memoization --- packages/block-editor/src/store/utils.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/block-editor/src/store/utils.js b/packages/block-editor/src/store/utils.js index 7fe56ddbdb180e..69e6246a98034a 100644 --- a/packages/block-editor/src/store/utils.js +++ b/packages/block-editor/src/store/utils.js @@ -136,6 +136,7 @@ export const getInsertBlockTypeDependants = () => ( state, rootClientId ) => { return [ state.blockListSettings[ rootClientId ], state.blocks.byClientId.get( rootClientId ), + state.blocks.order.get( rootClientId || '' ), state.settings.allowedBlockTypes, state.settings.templateLock, getBlockEditingMode( state, rootClientId ), From 79075fef425816456a74b7f73c8daab7160b2a17 Mon Sep 17 00:00:00 2001 From: Daniel Richards Date: Mon, 16 Feb 2026 13:31:10 +0800 Subject: [PATCH 03/12] Update selectors to allow paragraph removal for disabled parents --- packages/block-editor/src/store/selectors.js | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/packages/block-editor/src/store/selectors.js b/packages/block-editor/src/store/selectors.js index 048a09a824d334..cc2ab79be1251e 100644 --- a/packages/block-editor/src/store/selectors.js +++ b/packages/block-editor/src/store/selectors.js @@ -1704,7 +1704,7 @@ const canInsertBlockTypeUnmemoized = ( } const blockEditingMode = getBlockEditingMode( state, rootClientId ?? '' ); - if ( blockEditingMode === 'disabled' ) { + if ( blockEditingMode === 'disabled' && blockName !== 'core/paragraph' ) { return false; } @@ -1917,9 +1917,12 @@ export function canRemoveBlock( state, clientId ) { const isParentSectionBlock = !! isSectionBlock( state, rootClientId ); const rootBlockEditingMode = getBlockEditingMode( state, rootClientId ); + const blockName = getBlockName( state, clientId ); // Check if the parent container allows insertion/removal in contentOnly mode if ( - ( isParentSectionBlock || rootBlockEditingMode === 'contentOnly' ) && + ( isParentSectionBlock || + rootBlockEditingMode === 'contentOnly' || + blockName === 'core/paragraph' ) && ! isContainerInsertableToInContentOnlyMode( state, getBlockName( state, clientId ), @@ -1928,18 +1931,14 @@ export function canRemoveBlock( state, clientId ) { ) { // Allow removing a Paragraph block when other Paragraph blocks exist // in contentOnly mode. - const blockName = getBlockName( state, clientId ); - if ( - rootBlockEditingMode === 'contentOnly' && - blockName === 'core/paragraph' - ) { + if ( blockName === 'core/paragraph' ) { const existingBlocks = getBlockOrder( state, rootClientId ); const paragraphBlocks = existingBlocks.filter( ( id ) => getBlockName( state, id ) === 'core/paragraph' ); // Allow removal if there are other paragraph blocks besides this one - if ( ! ( paragraphBlocks.length > 0 ) ) { - return false; + if ( paragraphBlocks.length > 0 ) { + return true; } } else { return false; From 650c9705ba21ce4c998498c144459c4861f3fd8d Mon Sep 17 00:00:00 2001 From: Daniel Richards Date: Mon, 16 Feb 2026 13:50:18 +0800 Subject: [PATCH 04/12] Fix inserting paragraphs after headings --- .../block-editor/src/components/writing-flow/use-input.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/block-editor/src/components/writing-flow/use-input.js b/packages/block-editor/src/components/writing-flow/use-input.js index 0f10cc9c2d1c75..14e812b3d865ed 100644 --- a/packages/block-editor/src/components/writing-flow/use-input.js +++ b/packages/block-editor/src/components/writing-flow/use-input.js @@ -110,6 +110,10 @@ export default function useInput() { // Ensure template is not locked. if ( + canInsertBlockType( + getDefaultBlockName(), + getBlockRootClientId( clientId ) + ) || canInsertBlockType( blockName, getBlockRootClientId( clientId ) From e7ea92477b1ef1e62816926e18bf5931baab7bfc Mon Sep 17 00:00:00 2001 From: Daniel Richards Date: Mon, 16 Feb 2026 13:52:48 +0800 Subject: [PATCH 05/12] Disallow removing the last paragraph --- packages/block-editor/src/store/selectors.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/block-editor/src/store/selectors.js b/packages/block-editor/src/store/selectors.js index cc2ab79be1251e..d9ed5d2ba175df 100644 --- a/packages/block-editor/src/store/selectors.js +++ b/packages/block-editor/src/store/selectors.js @@ -1937,7 +1937,7 @@ export function canRemoveBlock( state, clientId ) { ( id ) => getBlockName( state, id ) === 'core/paragraph' ); // Allow removal if there are other paragraph blocks besides this one - if ( paragraphBlocks.length > 0 ) { + if ( paragraphBlocks.length > 1 ) { return true; } } else { From c4ca620ca635588739f912528519506c46d61610 Mon Sep 17 00:00:00 2001 From: Daniel Richards Date: Mon, 16 Feb 2026 14:18:07 +0800 Subject: [PATCH 06/12] Fix unit tests --- packages/block-editor/src/store/test/selectors.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/block-editor/src/store/test/selectors.js b/packages/block-editor/src/store/test/selectors.js index 9f45a38bec514d..0a1e04af83d1e7 100644 --- a/packages/block-editor/src/store/test/selectors.js +++ b/packages/block-editor/src/store/test/selectors.js @@ -2676,6 +2676,7 @@ describe( 'selectors', () => { blocks: { byClientId: new Map(), attributes: new Map(), + order: new Map(), }, blockListSettings: {}, settings: {}, @@ -2689,6 +2690,7 @@ describe( 'selectors', () => { blocks: { byClientId: new Map(), attributes: new Map(), + order: new Map(), }, blockListSettings: {}, settings: { From 49f7699a4cc5cb0aa843f3d5b3256a44fbcae79c Mon Sep 17 00:00:00 2001 From: Daniel Richards Date: Mon, 16 Feb 2026 14:38:58 +0800 Subject: [PATCH 07/12] Disallow insertion into synced patterns --- packages/block-editor/src/store/selectors.js | 14 ++++++++++---- packages/block-editor/src/store/utils.js | 7 ++++++- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/packages/block-editor/src/store/selectors.js b/packages/block-editor/src/store/selectors.js index d9ed5d2ba175df..675d7546455a1c 100644 --- a/packages/block-editor/src/store/selectors.js +++ b/packages/block-editor/src/store/selectors.js @@ -1720,10 +1720,8 @@ const canInsertBlockTypeUnmemoized = ( // some cases when the block is a content block. const isContentRoleBlock = isContentBlock( blockName ); const isParentSectionBlock = !! isSectionBlock( state, rootClientId ); - const isBlockWithinSection = !! getParentSectionBlock( - state, - rootClientId - ); + const parentSection = getParentSectionBlock( state, rootClientId ); + const isBlockWithinSection = !! parentSection; if ( ( isParentSectionBlock || isBlockWithinSection ) && ! isContentRoleBlock @@ -1731,6 +1729,14 @@ const canInsertBlockTypeUnmemoized = ( return false; } + // Don't allow insertion into synced patterns. + if ( + parentSection && + getBlockName( state, parentSection ) === 'core/block' + ) { + return false; + } + // In content only mode, check if this container allows insertion. if ( ( isParentSectionBlock || blockEditingMode === 'contentOnly' ) && diff --git a/packages/block-editor/src/store/utils.js b/packages/block-editor/src/store/utils.js index 69e6246a98034a..bc029ae8734865 100644 --- a/packages/block-editor/src/store/utils.js +++ b/packages/block-editor/src/store/utils.js @@ -10,7 +10,11 @@ import { parse as grammarParse } from '@wordpress/block-serialization-default-pa import { selectBlockPatternsKey } from './private-keys'; import { unlock } from '../lock-unlock'; import { STORE_NAME } from './constants'; -import { getSectionRootClientId, isSectionBlock } from './private-selectors'; +import { + getSectionRootClientId, + isSectionBlock, + getParentSectionBlock, +} from './private-selectors'; import { getBlockEditingMode } from './selectors'; import { INSERTER_PATTERN_TYPES } from '../components/inserter/block-patterns-tab/utils'; @@ -142,5 +146,6 @@ export const getInsertBlockTypeDependants = () => ( state, rootClientId ) => { getBlockEditingMode( state, rootClientId ), getSectionRootClientId( state ), isSectionBlock( state, rootClientId ), + getParentSectionBlock( state, rootClientId ), ]; }; From bfd4ccc7d692faef85468be2c3e2e413a7b71cf7 Mon Sep 17 00:00:00 2001 From: Daniel Richards Date: Mon, 16 Feb 2026 14:42:16 +0800 Subject: [PATCH 08/12] Disallow removal from synced patterns --- packages/block-editor/src/store/selectors.js | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/packages/block-editor/src/store/selectors.js b/packages/block-editor/src/store/selectors.js index 675d7546455a1c..840071e0c8e2a6 100644 --- a/packages/block-editor/src/store/selectors.js +++ b/packages/block-editor/src/store/selectors.js @@ -1720,8 +1720,8 @@ const canInsertBlockTypeUnmemoized = ( // some cases when the block is a content block. const isContentRoleBlock = isContentBlock( blockName ); const isParentSectionBlock = !! isSectionBlock( state, rootClientId ); - const parentSection = getParentSectionBlock( state, rootClientId ); - const isBlockWithinSection = !! parentSection; + const parentSectionClientId = getParentSectionBlock( state, rootClientId ); + const isBlockWithinSection = !! parentSectionClientId; if ( ( isParentSectionBlock || isBlockWithinSection ) && ! isContentRoleBlock @@ -1731,8 +1731,8 @@ const canInsertBlockTypeUnmemoized = ( // Don't allow insertion into synced patterns. if ( - parentSection && - getBlockName( state, parentSection ) === 'core/block' + isBlockWithinSection && + getBlockName( state, parentSectionClientId ) === 'core/block' ) { return false; } @@ -1913,7 +1913,8 @@ export function canRemoveBlock( state, clientId ) { // It shouldn't be possible to move in a section block unless in // some cases when the block is a content block. - const isBlockWithinSection = !! getParentSectionBlock( state, clientId ); + const parentSectionClientId = getParentSectionBlock( state, clientId ); + const isBlockWithinSection = !! parentSectionClientId; const isContentRoleBlock = isContentBlock( getBlockName( state, clientId ) ); @@ -1921,6 +1922,14 @@ export function canRemoveBlock( state, clientId ) { return false; } + // Disallow removal from synced patterns. + if ( + isBlockWithinSection && + getBlockName( state, parentSectionClientId ) === 'core/block' + ) { + return false; + } + const isParentSectionBlock = !! isSectionBlock( state, rootClientId ); const rootBlockEditingMode = getBlockEditingMode( state, rootClientId ); const blockName = getBlockName( state, clientId ); From 13503ec8e778175700c02b83501262dc605a3b92 Mon Sep 17 00:00:00 2001 From: Daniel Richards Date: Mon, 16 Feb 2026 15:40:23 +0800 Subject: [PATCH 09/12] Fix synced pattern logic to consider parents and ancestors that might be sections --- packages/block-editor/src/store/selectors.js | 29 ++++++++++---------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/packages/block-editor/src/store/selectors.js b/packages/block-editor/src/store/selectors.js index 840071e0c8e2a6..58285217983ad9 100644 --- a/packages/block-editor/src/store/selectors.js +++ b/packages/block-editor/src/store/selectors.js @@ -1720,19 +1720,18 @@ const canInsertBlockTypeUnmemoized = ( // some cases when the block is a content block. const isContentRoleBlock = isContentBlock( blockName ); const isParentSectionBlock = !! isSectionBlock( state, rootClientId ); - const parentSectionClientId = getParentSectionBlock( state, rootClientId ); - const isBlockWithinSection = !! parentSectionClientId; - if ( - ( isParentSectionBlock || isBlockWithinSection ) && - ! isContentRoleBlock - ) { + const sectionClientId = isParentSectionBlock + ? rootClientId + : getParentSectionBlock( state, rootClientId ); + const isWithinSection = !! sectionClientId; + if ( isWithinSection && ! isContentRoleBlock ) { return false; } // Don't allow insertion into synced patterns. if ( - isBlockWithinSection && - getBlockName( state, parentSectionClientId ) === 'core/block' + isWithinSection && + getBlockName( state, sectionClientId ) === 'core/block' ) { return false; } @@ -1913,24 +1912,26 @@ export function canRemoveBlock( state, clientId ) { // It shouldn't be possible to move in a section block unless in // some cases when the block is a content block. - const parentSectionClientId = getParentSectionBlock( state, clientId ); - const isBlockWithinSection = !! parentSectionClientId; + const isParentSectionBlock = !! isSectionBlock( state, rootClientId ); + const sectionClientId = isParentSectionBlock + ? rootClientId + : getParentSectionBlock( state, rootClientId ); + const isWithinSection = !! sectionClientId; const isContentRoleBlock = isContentBlock( getBlockName( state, clientId ) ); - if ( isBlockWithinSection && ! isContentRoleBlock ) { + if ( isWithinSection && ! isContentRoleBlock ) { return false; } // Disallow removal from synced patterns. if ( - isBlockWithinSection && - getBlockName( state, parentSectionClientId ) === 'core/block' + isWithinSection && + getBlockName( state, sectionClientId ) === 'core/block' ) { return false; } - const isParentSectionBlock = !! isSectionBlock( state, rootClientId ); const rootBlockEditingMode = getBlockEditingMode( state, rootClientId ); const blockName = getBlockName( state, clientId ); // Check if the parent container allows insertion/removal in contentOnly mode From 63317a4fbbfde9677d9e797331b96e92d36e1973 Mon Sep 17 00:00:00 2001 From: Daniel Richards Date: Mon, 16 Feb 2026 15:50:17 +0800 Subject: [PATCH 10/12] Fix unit tests again --- packages/block-editor/src/store/test/selectors.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/block-editor/src/store/test/selectors.js b/packages/block-editor/src/store/test/selectors.js index 0a1e04af83d1e7..f4cfcae728b48a 100644 --- a/packages/block-editor/src/store/test/selectors.js +++ b/packages/block-editor/src/store/test/selectors.js @@ -2677,6 +2677,7 @@ describe( 'selectors', () => { byClientId: new Map(), attributes: new Map(), order: new Map(), + parents: new Map(), }, blockListSettings: {}, settings: {}, @@ -2691,6 +2692,7 @@ describe( 'selectors', () => { byClientId: new Map(), attributes: new Map(), order: new Map(), + parents: new Map(), }, blockListSettings: {}, settings: { @@ -2728,6 +2730,7 @@ describe( 'selectors', () => { byClientId: new Map(), attributes: new Map(), order: new Map(), + parents: new Map(), }, blockListSettings: {}, settings: { From 0566ee517ae6facc1076bdaa1f29e40e5658958f Mon Sep 17 00:00:00 2001 From: Daniel Richards Date: Mon, 16 Feb 2026 16:14:27 +0800 Subject: [PATCH 11/12] Fix e2e tests for templateLock: contentOnly --- .../editor/various/content-only-lock.spec.js | 79 ++++++++++++++++--- 1 file changed, 70 insertions(+), 9 deletions(-) diff --git a/test/e2e/specs/editor/various/content-only-lock.spec.js b/test/e2e/specs/editor/various/content-only-lock.spec.js index 0f8a20822dd0a3..ea34b05e11af47 100644 --- a/test/e2e/specs/editor/various/content-only-lock.spec.js +++ b/test/e2e/specs/editor/various/content-only-lock.spec.js @@ -207,7 +207,7 @@ test.describe( 'Content-only lock', () => { ).not.toBeAttached(); } ); - test( 'content role blocks not within a `content` role container cannot be duplicated, inserted before/after, or moved', async ( { + test( 'non-paragraph content role blocks not within a `content` role container cannot be duplicated, inserted before/after, or moved', async ( { editor, page, pageUtils, @@ -217,9 +217,9 @@ test.describe( 'Content-only lock', () => { await page.getByPlaceholder( 'Start writing with text or HTML' ) .fill( ` -
-

First paragraph

- +
+

Heading

+
    @@ -237,18 +237,18 @@ test.describe( 'Content-only lock', () => { const groupBlock = editor.canvas.getByRole( 'document', { name: 'Block: Group', } ); - const paragraph = editor.canvas + const heading = editor.canvas .getByRole( 'document', { - name: 'Block: Paragraph', + name: 'Block: Heading', includeHidden: true, } ) - .filter( { hasText: 'First paragraph' } ); + .filter( { hasText: 'Heading' } ); // Select the content-locked group block. await editor.selectBlocks( groupBlock ); await test.step( 'Blocks cannot be inserted before/after or duplicated', async () => { // Test paragraph. - await editor.selectBlocks( paragraph ); + await editor.selectBlocks( heading ); await editor.showBlockToolbar(); await expect( @@ -260,7 +260,7 @@ test.describe( 'Content-only lock', () => { await test.step( 'Blocks cannot be moved', async () => { // Test paragraph. - await editor.selectBlocks( paragraph ); + await editor.selectBlocks( heading ); await editor.showBlockToolbar(); await expect( @@ -277,6 +277,67 @@ test.describe( 'Content-only lock', () => { } ); } ); + test( 'paragraph blocks that are within a `content` role container can be duplicated, inserted before/after, or moved', async ( { + editor, + page, + pageUtils, + } ) => { + // Add content only locked block with paragraph and list + await pageUtils.pressKeys( 'secondary+M' ); + + await page.getByPlaceholder( 'Start writing with text or HTML' ) + .fill( ` +
    +

    First paragraph

    + +
    +` ); + + await pageUtils.pressKeys( 'secondary+M' ); + + const paragraph = editor.canvas.getByRole( 'document', { + name: 'Block: Paragraph', + includeHidden: true, + } ); + + await test.step( 'Blocks can be inserted before/after or duplicated', async () => { + // Test first list item. + await editor.selectBlocks( paragraph ); + await editor.showBlockToolbar(); + + const firstOptionsButton = page + .getByRole( 'toolbar', { name: 'Block tools' } ) + .getByRole( 'button', { name: 'Options' } ); + + await expect( firstOptionsButton ).toBeVisible(); + + // Open the options menu. + await firstOptionsButton.click(); + + // Verify Insert Before, Insert After, and Duplicate menu items are present. + await expect( + page + .getByRole( 'menu', { name: 'Options' } ) + .getByRole( 'menuitem', { name: 'Add before' } ) + ).toBeVisible(); + + await expect( + page + .getByRole( 'menu', { name: 'Options' } ) + .getByRole( 'menuitem', { name: 'Add after' } ) + ).toBeVisible(); + + await expect( + page + .getByRole( 'menu', { name: 'Options' } ) + .getByRole( 'menuitem', { name: 'Duplicate' } ) + ).toBeVisible(); + + // Close the menu. + await page.keyboard.press( 'Escape' ); + } ); + } ); + test( 'content role blocks that are within a `content` role container can be duplicated, inserted before/after, or moved', async ( { editor, page, From 77dc2029b6c61d722c4fbd158cbcb2c366a6fc20 Mon Sep 17 00:00:00 2001 From: Daniel Richards Date: Mon, 16 Feb 2026 16:35:11 +0800 Subject: [PATCH 12/12] Avoid hard-coding paragraph block name --- packages/block-editor/src/store/selectors.js | 32 +++++++++++--------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/packages/block-editor/src/store/selectors.js b/packages/block-editor/src/store/selectors.js index 58285217983ad9..6c04f180aae7d6 100644 --- a/packages/block-editor/src/store/selectors.js +++ b/packages/block-editor/src/store/selectors.js @@ -5,6 +5,7 @@ import { getBlockType, getBlockTypes, getBlockVariations, + getDefaultBlockName, hasBlockSupport, getPossibleBlockTransformations, switchToBlockType, @@ -1704,7 +1705,10 @@ const canInsertBlockTypeUnmemoized = ( } const blockEditingMode = getBlockEditingMode( state, rootClientId ?? '' ); - if ( blockEditingMode === 'disabled' && blockName !== 'core/paragraph' ) { + if ( + blockEditingMode === 'disabled' && + blockName !== getDefaultBlockName() + ) { return false; } @@ -1745,15 +1749,15 @@ const canInsertBlockTypeUnmemoized = ( rootClientId ) ) { - // Allow inserting a Paragraph block anywhere that another Paragraph block already exists + // Allow inserting the default block anywhere that another default block already exists // when in contentOnly mode. - if ( blockName === 'core/paragraph' ) { + if ( blockName === getDefaultBlockName() ) { const existingBlocks = getBlockOrder( state, rootClientId ); - const hasParagraphBlock = existingBlocks.some( + const hasDefaultBlock = existingBlocks.some( ( clientId ) => - getBlockName( state, clientId ) === 'core/paragraph' + getBlockName( state, clientId ) === getDefaultBlockName() ); - if ( ! hasParagraphBlock ) { + if ( ! hasDefaultBlock ) { return false; } } else { @@ -1934,26 +1938,26 @@ export function canRemoveBlock( state, clientId ) { const rootBlockEditingMode = getBlockEditingMode( state, rootClientId ); const blockName = getBlockName( state, clientId ); - // Check if the parent container allows insertion/removal in contentOnly mode + // Check if the parent container allows insertion/removal in contentOnly mode. if ( ( isParentSectionBlock || rootBlockEditingMode === 'contentOnly' || - blockName === 'core/paragraph' ) && + blockName === getDefaultBlockName() ) && ! isContainerInsertableToInContentOnlyMode( state, getBlockName( state, clientId ), rootClientId ) ) { - // Allow removing a Paragraph block when other Paragraph blocks exist + // Allow removing the default block when other default blocks exist // in contentOnly mode. - if ( blockName === 'core/paragraph' ) { + if ( blockName === getDefaultBlockName() ) { const existingBlocks = getBlockOrder( state, rootClientId ); - const paragraphBlocks = existingBlocks.filter( - ( id ) => getBlockName( state, id ) === 'core/paragraph' + const defaultBlocks = existingBlocks.filter( + ( id ) => getBlockName( state, id ) === getDefaultBlockName() ); - // Allow removal if there are other paragraph blocks besides this one - if ( paragraphBlocks.length > 1 ) { + // Allow removal if there are other default blocks besides this one + if ( defaultBlocks.length > 1 ) { return true; } } else {