From 36779e186cd28f875597c9d76df4c35a97e4615c Mon Sep 17 00:00:00 2001 From: George Hotelling Date: Thu, 10 Nov 2022 10:26:17 -0700 Subject: [PATCH] Hide edit button from non-automenus --- .../src/components/off-canvas-editor/block-edit-button.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 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 d6af3f949ca955..1ba8e0b6178957 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 @@ -191,7 +191,6 @@ const BlockEditButton = ( { label, clientId } ) => { const { toggleBlockHighlight } = useDispatch( blockEditorStore ); const [ convertModalOpen, setConvertModalOpen ] = useState( false ); const { totalPages } = usePageData(); - const allowConvertToLinks = totalPages <= MAX_PAGE_COUNT; const block = useSelect( ( select ) => { @@ -202,11 +201,12 @@ const BlockEditButton = ( { label, clientId } ) => { const onClick = () => { toggleBlockHighlight( clientId, true ); - if ( 'core/page-list' === block.name ) { - setConvertModalOpen( ! convertModalOpen ); - } + setConvertModalOpen( ! convertModalOpen ); }; + const allowConvertToLinks = + 'core/page-list' === block.name && totalPages <= MAX_PAGE_COUNT; + return ( <> { convertModalOpen && (