From c38aeacdbcb1f7a95a35f880bc5ff5501d6b64da Mon Sep 17 00:00:00 2001 From: MaggieCabrera Date: Tue, 29 Nov 2022 16:01:21 +0100 Subject: [PATCH 1/2] hide edit buttons for page list items --- .../src/components/off-canvas-editor/block.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/packages/block-editor/src/components/off-canvas-editor/block.js b/packages/block-editor/src/components/off-canvas-editor/block.js index a0bf8529a4d01..1860cf62c4e47 100644 --- a/packages/block-editor/src/components/off-canvas-editor/block.js +++ b/packages/block-editor/src/components/off-canvas-editor/block.js @@ -145,6 +145,7 @@ function ListViewBlock( { const { isTreeGridMounted, expand, collapse } = useListViewContext(); + const isEditable = block.name !== 'core/page-list-item'; const hasSiblings = siblingBlockCount > 0; const hasRenderedMovers = showBlockMovers && hasSiblings; const moverCellClassName = classnames( @@ -331,10 +332,14 @@ function ListViewBlock( { } > { () => ( - + <> + { isEditable && ( + + ) } + ) } Date: Wed, 30 Nov 2022 17:03:30 +0100 Subject: [PATCH 2/2] update BlockEditButton to accept props from TreeGridCell --- .../off-canvas-editor/block-edit-button.js | 14 +++++++++----- .../src/components/off-canvas-editor/block.js | 19 +++++++++---------- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/packages/block-editor/src/components/off-canvas-editor/block-edit-button.js b/packages/block-editor/src/components/off-canvas-editor/block-edit-button.js index 15ae423ad5ddb..6281134e8c95e 100644 --- a/packages/block-editor/src/components/off-canvas-editor/block-edit-button.js +++ b/packages/block-editor/src/components/off-canvas-editor/block-edit-button.js @@ -4,20 +4,24 @@ import { edit } from '@wordpress/icons'; import { Button } from '@wordpress/components'; import { useDispatch } from '@wordpress/data'; +import { forwardRef } from '@wordpress/element'; /** * Internal dependencies */ import { store as blockEditorStore } from '../../store'; -const BlockEditButton = ( { label, clientId } ) => { +export default forwardRef( function BlockEditButton( + { clientId, ...props }, + ref +) { const { selectBlock } = useDispatch( blockEditorStore ); const onClick = () => { selectBlock( clientId ); }; - return