Repository navigation
Close button: extensibility in post editor - #22323
Conversation
|
Size Change: +235 B (0%) Total Size: 832 kB
ℹ️ View Unchanged
|
| MainDashboardButton.slotName = name; | ||
|
|
||
| export const CloseButton = () => { | ||
| export const CloseButtonSlot = ( { children } ) => { |
There was a problem hiding this comment.
Why not make this MainDashboardButton.Slot? Is there any place where we would just use the bare MainDashboardButton.Slot?
There was a problem hiding this comment.
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:
React Hook "useSlot" is called in function "MainDashboardButton.Slot" that is neither a React function component nor a custom React Hook function
Likely because it wasn't detected as valid component name for some reason. 🤔
| 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.
Can this component be shared between edit-site and edit-post?
There was a problem hiding this comment.
We considered that in #20989 (comment) but decided not to do it for now.
| ```js | ||
| import { registerPlugin } from '@wordpress/plugins'; | ||
| import { __experimentalMainDashboardButton } from '@wordpress/edit-site'; | ||
| import { |
There was a problem hiding this comment.
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.
I was afk for a couple of days so just got to this now. Thanks for the update @talldan!
Description
This is a follow up PR to #22001 and #22179. It's addressing the first part of #20929 issue.
The close button slot introduced for site editor in #22001 is expanded to cover the post editor too. The button can now be replaced in a similar fashion for all editor instances.
MainDashboardButtonhas been moved to interface package so that the same slot can be reused inedit-postandedit-site.How has this been tested?
If you want to replace the whole component:
If you just want to customize the icon:
In both cases open check the post editor and site editor and make sure that the custom components are shown there.
Screenshots
Types of changes
Breaking change (fix or feature that would cause existing functionality to not work as expected)
Checklist: