diff --git a/packages/block-editor/src/components/block-tools/zoom-out-mode-inserters.js b/packages/block-editor/src/components/block-tools/zoom-out-mode-inserters.js index 5741e67f7ec80..816a4ffc74e26 100644 --- a/packages/block-editor/src/components/block-tools/zoom-out-mode-inserters.js +++ b/packages/block-editor/src/components/block-tools/zoom-out-mode-inserters.js @@ -20,6 +20,7 @@ function Inserter( { blockOrder, __unstableContentRef, index, + setActiveInserter, } ) { const { setInserterIsOpened, insertionIndex } = useSelect( ( select ) => { @@ -57,6 +58,7 @@ function Inserter( { tab: 'patterns', category: 'all', } ); + setActiveInserter( index ); } } label={ label } /> @@ -66,6 +68,7 @@ function Inserter( { function ZoomOutModeInserters( { __unstableContentRef } ) { const [ isReady, setIsReady ] = useState( false ); + const [ activeInserter, setActiveInserter ] = useState( null ); const { blockOrder, sectionRootClientId } = useSelect( ( select ) => { const { sectionRootClientId: root } = unlock( select( blockEditorStore ).getSettings() @@ -91,6 +94,9 @@ function ZoomOutModeInserters( { __unstableContentRef } ) { } return blockOrder.map( ( clientId, index ) => { + if ( activeInserter === index ) { + return null; + } if ( index === blockOrder.length - 1 ) { return null; } @@ -102,6 +108,7 @@ function ZoomOutModeInserters( { __unstableContentRef } ) { index={ index } blockOrder={ blockOrder } __unstableContentRef={ __unstableContentRef } + setActiveInserter={ setActiveInserter } /> ); } );