diff --git a/packages/block-editor/src/components/inserter/block-patterns-tab/pattern-category-preview-panel.js b/packages/block-editor/src/components/inserter/block-patterns-tab/pattern-category-preview-panel.js index f91598fb7a61cc..505f8d14863729 100644 --- a/packages/block-editor/src/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +++ b/packages/block-editor/src/components/inserter/block-patterns-tab/pattern-category-preview-panel.js @@ -2,9 +2,8 @@ * Internal dependencies */ import { PatternCategoryPreviews } from './pattern-category-previews'; -import { useZoomOut } from '../../../hooks/use-zoom-out'; -function PatternCategoryPreviewPanelInner( { +export function PatternCategoryPreviewPanel( { rootClientId, onInsert, onHover, @@ -24,17 +23,3 @@ function PatternCategoryPreviewPanelInner( { /> ); } - -function PatternCategoryPreviewPanelWithZoomOut( props ) { - useZoomOut(); - return ; -} - -export function PatternCategoryPreviewPanel( props ) { - // When the pattern panel is showing, we want to use zoom out mode - if ( window.__experimentalEnableZoomedOutPatternsTab ) { - return ; - } - - return ; -} diff --git a/packages/block-editor/src/components/inserter/menu.js b/packages/block-editor/src/components/inserter/menu.js index 6a4ac798b74900..d774daf94ec957 100644 --- a/packages/block-editor/src/components/inserter/menu.js +++ b/packages/block-editor/src/components/inserter/menu.js @@ -32,6 +32,14 @@ import InserterSearchResults from './search-results'; import useInsertionPoint from './hooks/use-insertion-point'; import InserterTabs from './tabs'; import { store as blockEditorStore } from '../../store'; +import { useZoomOut } from '../../hooks/use-zoom-out'; + +const ZoomOutHandler = ( { children, showPatternPanel } ) => { + // When the pattern panel is showing, we want to use zoom out mode + useZoomOut( showPatternPanel ); + + return <>{ children }; +}; const NOOP = () => {}; function InserterMenu( @@ -306,7 +314,7 @@ function InserterMenu( } }, [] ); - return ( + const menuContent = (
); + + return ( + <> + { window.__experimentalEnableZoomedOutPatternsTab ? ( + + { menuContent } + + ) : ( + menuContent + ) } + + ); } export const PrivateInserterMenu = forwardRef( InserterMenu );