-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Close button: extensibility in post editor #22323
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -155,3 +155,4 @@ export { default as PluginPostStatusInfo } from './components/sidebar/plugin-pos | |
export { default as PluginPrePublishPanel } from './components/sidebar/plugin-pre-publish-panel'; | ||
export { default as PluginSidebar } from './components/sidebar/plugin-sidebar'; | ||
export { default as PluginSidebarMoreMenuItem } from './components/header/plugin-sidebar-more-menu-item'; | ||
export { default as __experimentalFullscreenModeClose } from './components/header/fullscreen-mode-close'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can this component be shared between There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We considered that in #20989 (comment) but decided not to do it for now. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,25 +6,20 @@ import { | |
createSlotFill, | ||
} from '@wordpress/components'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import FullscreenModeClose from '../fullscreen-mode-close'; | ||
|
||
const name = '__experimentalSiteEditorMainDashboardButton'; | ||
const name = '__experimentalMainDashboardButton'; | ||
|
||
const { Fill, Slot } = createSlotFill( name ); | ||
|
||
const MainDashboardButton = Fill; | ||
MainDashboardButton.Slot = Slot; | ||
MainDashboardButton.slotName = name; | ||
|
||
export const CloseButton = () => { | ||
export const CloseButtonSlot = ( { children } ) => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not make this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now that you mentioned it - no, we probably don't. :) I refactored this in 7d1b948. I had to separate out the assignment though because the linter was complaining otherwise:
Likely because it wasn't detected as valid component name for some reason. 🤔 |
||
const slot = useSlot( MainDashboardButton.slotName ); | ||
const hasFills = Boolean( slot.fills && slot.fills.length ); | ||
|
||
if ( ! hasFills ) { | ||
return <FullscreenModeClose />; | ||
return children; | ||
} | ||
|
||
return <MainDashboardButton.Slot bubblesVirtually />; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's great that there are docs here for this, just had a request for this!
Looks like the file just needs to be added to the toc.json file for it to show up in the block editor handbook.
I've made a PR to publish them - #27317 - if you get a chance to review, @vindl.
edit: don't worry about the review, decided to admin merge it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was afk for a couple of days so just got to this now. Thanks for the update @talldan!