From 0e671a2eca9c78dfdb45b2149ce9e3fb5bf3ae4a Mon Sep 17 00:00:00 2001 From: Dave Smith Date: Thu, 12 Sep 2024 10:18:02 +0100 Subject: [PATCH] Show top level sections in List View in Zoom Out mode (#65202) * Show top level sections in List View * Recompute enabled clientIds when editorMode changes * Revert initial changes * Avoid special conditional for Zoom Out mode --- .../block-editor/src/components/list-view/index.js | 11 +++-------- packages/block-editor/src/store/private-selectors.js | 1 + 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/packages/block-editor/src/components/list-view/index.js b/packages/block-editor/src/components/list-view/index.js index 1493fa655a5aac..87599ea870913b 100644 --- a/packages/block-editor/src/components/list-view/index.js +++ b/packages/block-editor/src/components/list-view/index.js @@ -119,20 +119,16 @@ function ListViewComponent( const blockIndexes = useListViewBlockIndexes( clientIdsTree ); const { getBlock } = useSelect( blockEditorStore ); - const { visibleBlockCount, shouldShowInnerBlocks } = useSelect( + const { visibleBlockCount } = useSelect( ( select ) => { - const { - getGlobalBlockCount, - getClientIdsOfDescendants, - __unstableGetEditorMode, - } = select( blockEditorStore ); + const { getGlobalBlockCount, getClientIdsOfDescendants } = + select( blockEditorStore ); const draggedBlockCount = draggedClientIds?.length > 0 ? getClientIdsOfDescendants( draggedClientIds ).length + 1 : 0; return { visibleBlockCount: getGlobalBlockCount() - draggedBlockCount, - shouldShowInnerBlocks: __unstableGetEditorMode() !== 'zoom-out', }; }, [ draggedClientIds ] @@ -397,7 +393,6 @@ function ListViewComponent( fixedListWindow={ fixedListWindow } selectedClientIds={ selectedClientIds } isExpanded={ isExpanded } - shouldShowInnerBlocks={ shouldShowInnerBlocks } showAppender={ showAppender } /> diff --git a/packages/block-editor/src/store/private-selectors.js b/packages/block-editor/src/store/private-selectors.js index b72ebd18183377..d76f90bc94ffe1 100644 --- a/packages/block-editor/src/store/private-selectors.js +++ b/packages/block-editor/src/store/private-selectors.js @@ -114,6 +114,7 @@ export const getEnabledClientIdsTree = createSelector( state.blockEditingModes, state.settings.templateLock, state.blockListSettings, + state.editorMode, ] );