Skip to content

Commit

Permalink
ListViewBlock: no longer needs to know anything about content locking
Browse files Browse the repository at this point in the history
  • Loading branch information
oandregal committed Aug 16, 2022
1 parent 817bf6e commit 333bd54
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 18 deletions.
21 changes: 4 additions & 17 deletions packages/block-editor/src/components/list-view/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -40,7 +40,6 @@ import useBlockDisplayInformation from '../use-block-display-information';
import { useBlockLock } from '../block-lock';

function ListViewBlock( {
renderOnlyContentBlocks,
block,
isDragged,
isSelected,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -182,10 +173,6 @@ function ListViewBlock( {
[ clientId, expand, collapse, isExpanded ]
);

if ( ! shouldRender ) {
return null;
}

let colSpan;
if ( hasRenderedMovers ) {
colSpan = 2;
Expand Down
1 change: 0 additions & 1 deletion packages/block-editor/src/components/list-view/branch.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ function ListViewBranch( props ) {
<AsyncModeProvider key={ clientId } value={ ! isSelected }>
{ showBlock && (
<ListViewBlock
renderOnlyContentBlocks={ isContentLocked }
block={ block }
selectBlock={ selectBlock }
isSelected={ isSelected }
Expand Down

0 comments on commit 333bd54

Please sign in to comment.