Skip to content

Commit

Permalink
Show block toolbar for multi-block selections
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronrobertshaw authored and draganescu committed Mar 7, 2023
1 parent 24ec978 commit 3941d32
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions packages/edit-post/src/components/header/index.js
Original file line number Diff line number Diff line change
@@ -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 && <HeaderToolbar /> }
{ ! selectedBlockClientId && hasFixedToolbar && (
<HeaderToolbar />
) }
{ ! hasSelectedBlocks && hasFixedToolbar && <HeaderToolbar /> }
{ hasFixedToolbar && (
<div
style={

0 comments on commit 3941d32

Please sign in to comment.