-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restores the Fill/Slot logic for the BlockSettingsButton
- Loading branch information
Gerardo
committed
Jul 13, 2023
1 parent
18ef27f
commit 4ed6b7a
Showing
4 changed files
with
42 additions
and
26 deletions.
There are no files selected for viewing
41 changes: 28 additions & 13 deletions
41
packages/block-editor/src/components/block-settings/button.native.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,35 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { ToolbarGroup, ToolbarButton } from '@wordpress/components'; | ||
import { createSlotFill, ToolbarButton } from '@wordpress/components'; | ||
import { __ } from '@wordpress/i18n'; | ||
import { withDispatch } from '@wordpress/data'; | ||
import { cog } from '@wordpress/icons'; | ||
|
||
const SettingsButton = ( { onOpenBlockSettings } ) => { | ||
return ( | ||
<ToolbarGroup> | ||
<ToolbarButton | ||
title={ __( 'Open Settings' ) } | ||
icon={ cog } | ||
onClick={ onOpenBlockSettings } | ||
/> | ||
</ToolbarGroup> | ||
); | ||
}; | ||
const { Fill, Slot } = createSlotFill( 'SettingsToolbarButton' ); | ||
|
||
export default SettingsButton; | ||
const SettingsButton = ( { openGeneralSidebar } ) => ( | ||
<ToolbarButton | ||
title={ __( 'Open Settings' ) } | ||
icon={ cog } | ||
onClick={ openGeneralSidebar } | ||
/> | ||
); | ||
|
||
const SettingsButtonFill = ( props ) => ( | ||
<Fill> | ||
<SettingsButton { ...props } /> | ||
</Fill> | ||
); | ||
|
||
const SettingsToolbarButton = withDispatch( ( dispatch ) => { | ||
const { openGeneralSidebar } = dispatch( 'core/edit-post' ); | ||
|
||
return { | ||
openGeneralSidebar: () => openGeneralSidebar( 'edit-post/block' ), | ||
}; | ||
} )( SettingsButtonFill ); | ||
|
||
SettingsToolbarButton.Slot = Slot; | ||
|
||
export default SettingsToolbarButton; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters