Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add selected tools slot to widget header
  • Loading branch information
jeryj committed Nov 7, 2023
commit 8b0cd57b7c6bfe421b7e6a3bcfb4a134b06082aa
20 changes: 19 additions & 1 deletion packages/edit-widgets/src/components/header/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
/**
* WordPress dependencies
*/
import { useSelect } from '@wordpress/data';
import { __ } from '@wordpress/i18n';
import { VisuallyHidden } from '@wordpress/components';
import { Slot, VisuallyHidden } from '@wordpress/components';
import { PinnedItems } from '@wordpress/interface';
import { useViewportMatch } from '@wordpress/compose';
import { store as preferencesStore } from '@wordpress/preferences';

/**
* Internal dependencies
Expand All @@ -15,6 +17,15 @@ import MoreMenu from '../more-menu';

function Header( { setListViewToggleElement } ) {
const isMediumViewport = useViewportMatch( 'medium' );
const { hasFixedToolbar } = useSelect(
( select ) => ( {
hasFixedToolbar: !! select( preferencesStore ).get(
'core/edit-widgets',
'fixedToolbar'
),
} ),
[]
);

return (
<>
Expand All @@ -36,6 +47,13 @@ function Header( { setListViewToggleElement } ) {
<DocumentTools
setListViewToggleElement={ setListViewToggleElement }
/>
{ hasFixedToolbar && (
<Slot
className="selected-block-tools-wrapper"
name="__experimentalSelectedBlockTools"
bubblesVirtually
/>
) }
</div>
<div className="edit-widgets-header__actions">
<SaveButton />
Expand Down