diff --git a/packages/block-editor/src/hooks/block-hooks.js b/packages/block-editor/src/hooks/block-hooks.js index f9d7026e48545f..1e0b8e894d2067 100644 --- a/packages/block-editor/src/hooks/block-hooks.js +++ b/packages/block-editor/src/hooks/block-hooks.js @@ -55,8 +55,7 @@ function BlockHooksControlPure( { name, clientId } ) { const _hookedBlockClientIds = hookedBlocksForCurrentBlock.reduce( ( clientIds, block ) => { // If the block doesn't exist anywhere in the block tree, - // we know that we have to display the toggle for it, and set - // it to disabled. + // we know that we have to set the toggle to disabled. if ( getGlobalBlockCount( block.name ) === 0 ) { return clientIds; } @@ -96,13 +95,8 @@ function BlockHooksControlPure( { name, clientId } ) { } // If no hooked block was found in any of its designated locations, - // but it exists elsewhere in the block tree, we consider it manually inserted. - // In this case, we take note and will remove the corresponding toggle from the - // block inspector panel. - return { - ...clientIds, - [ block.name ]: false, - }; + // we set the toggle to disabled. + return clientIds; }, {} ); @@ -118,13 +112,7 @@ function BlockHooksControlPure( { name, clientId } ) { const { insertBlock, removeBlock } = useDispatch( blockEditorStore ); - // Remove toggle if block isn't present in the designated location but elsewhere in the block tree. - const hookedBlocksForCurrentBlockIfNotPresentElsewhere = - hookedBlocksForCurrentBlock?.filter( - ( block ) => hookedBlockClientIds?.[ block.name ] !== false - ); - - if ( ! hookedBlocksForCurrentBlockIfNotPresentElsewhere.length ) { + if ( ! hookedBlocksForCurrentBlock.length ) { return null; }