From 333bd549477aae1035fd13c985445c2bb0e44af8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9?= <583546+oandregal@users.noreply.github.com> Date: Tue, 16 Aug 2022 12:30:41 +0200 Subject: [PATCH] ListViewBlock: no longer needs to know anything about content locking --- .../src/components/list-view/block.js | 21 ++++--------------- .../src/components/list-view/branch.js | 1 - 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/packages/block-editor/src/components/list-view/block.js b/packages/block-editor/src/components/list-view/block.js index 1a6a3d4f37ec1..f8645a1071ff1 100644 --- a/packages/block-editor/src/components/list-view/block.js +++ b/packages/block-editor/src/components/list-view/block.js @@ -6,7 +6,7 @@ import classnames from 'classnames'; /** * WordPress dependencies */ -import { hasBlockSupport, store as blocksStore } from '@wordpress/blocks'; +import { hasBlockSupport } from '@wordpress/blocks'; import { __experimentalTreeGridCell as TreeGridCell, __experimentalTreeGridItem as TreeGridItem, @@ -40,7 +40,6 @@ import useBlockDisplayInformation from '../use-block-display-information'; import { useBlockLock } from '../block-lock'; function ListViewBlock( { - renderOnlyContentBlocks, block, isDragged, isSelected, @@ -68,17 +67,9 @@ function ListViewBlock( { const { toggleBlockHighlight } = useDispatch( blockEditorStore ); const blockInformation = useBlockDisplayInformation( clientId ); - const { blockName, shouldRender } = useSelect( - ( select ) => { - const name = select( blockEditorStore ).getBlockName( clientId ); - return { - blockName: name, - shouldRender: - ! renderOnlyContentBlocks || - select( blocksStore ).__unstableIsContentBlock( name ), - }; - }, - [ clientId, renderOnlyContentBlocks ] + const blockName = useSelect( + ( select ) => select( blockEditorStore ).getBlockName( clientId ), + [ clientId ] ); // When a block hides its toolbar it also hides the block settings menu, @@ -182,10 +173,6 @@ function ListViewBlock( { [ clientId, expand, collapse, isExpanded ] ); - if ( ! shouldRender ) { - return null; - } - let colSpan; if ( hasRenderedMovers ) { colSpan = 2; diff --git a/packages/block-editor/src/components/list-view/branch.js b/packages/block-editor/src/components/list-view/branch.js index e4a9c05f160dd..b28b4dacc2edb 100644 --- a/packages/block-editor/src/components/list-view/branch.js +++ b/packages/block-editor/src/components/list-view/branch.js @@ -178,7 +178,6 @@ function ListViewBranch( props ) { { showBlock && (