Skip to content

Commit

Permalink
Revert "Zoomed-Out Mode: Don't show blocks in zoomed out view (#59245)"
Browse files Browse the repository at this point in the history
This reverts commit d727cb4.
  • Loading branch information
scruffian committed Mar 11, 2024
1 parent d1bbd9f commit bd78191
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 14 deletions.
14 changes: 4 additions & 10 deletions packages/block-editor/src/components/inserter/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,22 +66,18 @@ function InserterMenu(
insertionIndex: __experimentalInsertionIndex,
shouldFocusBlock,
} );
const { isZoomOutMode, showPatterns } = useSelect(
const { showPatterns } = useSelect(
( select ) => {
const { hasAllowedPatterns, __unstableGetEditorMode } = unlock(
select( blockEditorStore )
);
const { hasAllowedPatterns } = unlock( select( blockEditorStore ) );
return {
isZoomOutMode: __unstableGetEditorMode() === 'zoom-out',
showPatterns: hasAllowedPatterns( destinationRootClientId ),
};
},
[ destinationRootClientId ]
);

const mediaCategories = useMediaCategories( destinationRootClientId );
const showMedia = mediaCategories.length > 0 && ! isZoomOutMode;
const showBlocks = ! isZoomOutMode;
const showMedia = mediaCategories.length > 0;

const onInsert = useCallback(
( blocks, meta, shouldForceFocusBlock ) => {
Expand Down Expand Up @@ -253,21 +249,19 @@ function InserterMenu(
__experimentalInsertionIndex
}
showBlockDirectory
showBlocks={ showBlocks }
shouldFocusBlock={ shouldFocusBlock }
/>
</div>
) }
{ showAsTabs && (
<InserterTabs
showBlocks={ showBlocks }
showPatterns={ showPatterns }
showMedia={ showMedia }
onSelect={ handleSetSelectedTab }
tabsContents={ inserterTabsContents }
/>
) }
{ ! delayedFilterValue && ! showAsTabs && showBlocks && (
{ ! delayedFilterValue && ! showAsTabs && (
<div className="block-editor-inserter__no-tab-container">
{ blocksTab }
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ function InserterSearchResults( {
shouldFocusBlock = true,
prioritizePatterns,
selectBlockOnInsert,
showBlocks = true,
} ) {
const debouncedSpeak = useDebounce( speak, 500 );

Expand Down Expand Up @@ -168,7 +167,7 @@ function InserterSearchResults( {
const hasItems =
filteredBlockTypes.length > 0 || filteredBlockPatterns.length > 0;

const blocksUI = showBlocks && !! filteredBlockTypes.length && (
const blocksUI = !! filteredBlockTypes.length && (
<InserterPanel
title={ <VisuallyHidden>{ __( 'Blocks' ) }</VisuallyHidden> }
>
Expand Down
3 changes: 1 addition & 2 deletions packages/block-editor/src/components/inserter/tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,13 @@ const mediaTab = {
};

function InserterTabs( {
showBlocks = true,
showPatterns = false,
showMedia = false,
onSelect,
tabsContents,
} ) {
const tabs = [
showBlocks && blocksTab,
blocksTab,
showPatterns && patternsTab,
showMedia && mediaTab,
].filter( Boolean );
Expand Down

0 comments on commit bd78191

Please sign in to comment.