diff --git a/packages/edit-post/src/components/header/index.js b/packages/edit-post/src/components/header/index.js index 05bd30ae02c380..4acde8373aa748 100644 --- a/packages/edit-post/src/components/header/index.js +++ b/packages/edit-post/src/components/header/index.js @@ -31,18 +31,21 @@ function Header( { setEntitiesSavedStatesCallback } ) { isSaving, hasFixedToolbar, firstParentClientId, - selectedBlockClientId, + hasSelectedBlocks, showIconLabels, isDistractionFreeMode, } = useSelect( ( select ) => { - const { getSettings, getBlockParents, getSelectedBlockClientId } = + const { getSettings, getBlockParents, getSelectedBlockClientIds } = select( blockEditorStore ); const settings = getSettings(); - const _selectedBlockClientId = getSelectedBlockClientId(); - const parents = getBlockParents( _selectedBlockClientId ); + const _selectedBlockClientIds = getSelectedBlockClientIds(); + const parents = + _selectedBlockClientIds?.length === 1 + ? getBlockParents( _selectedBlockClientIds ) + : []; const _firstParentClientId = parents[ parents.length - 1 ]; return { - selectedBlockClientId: _selectedBlockClientId, + hasSelectedBlocks: !! _selectedBlockClientIds.length, hasActiveMetaboxes: select( editPostStore ).hasMetaBoxes(), isPublishSidebarOpened: select( editPostStore ).isPublishSidebarOpened(), @@ -84,9 +87,7 @@ function Header( { setEntitiesSavedStatesCallback } ) { className="edit-post-header__toolbar" > { ! hasFixedToolbar && } - { ! selectedBlockClientId && hasFixedToolbar && ( - - ) } + { ! hasSelectedBlocks && hasFixedToolbar && } { hasFixedToolbar && (