-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Block Editor: Introduce stable BlockSettingsMenuControls slot #20233
Conversation
@youknowriad, with all the planned changes to the block toolbar, is there still need for An alternative approach would be to rename it to |
@gziolo Yes, it's still needed for now, I think we should just mark it as unstable instead of experimental and leave it. |
I'm thinking we may want to use a different name as to better communicate the component's intention. How about |
packages/block-editor/src/components/block-settings-menu-group/index.js
Outdated
Show resolved
Hide resolved
I didn't go with How about |
In I 2a10f6c try I also have another proposal for the name |
</MenuGroup> | ||
<BlockSettingsMenuControls.Slot |
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.
By making the slot a new MenuGroup
we are introducing a visual difference (notice the separator before the reusable blocks item in the menu).
Before | After |
---|---|
I think this is fine, especially because that area is variable (third-parties can hook into and add new contents). Raised in case this needed a design 👍
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.
FWIW, it doesn't change the keyboard interaction.
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.
Yes, this seems fine.
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.
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.
Plugins are added before the core utils (reusable blocks, groups), as it works today.
This is a bit unfortunate. I think before we had a slot in another slot to make it work. Should we bring it back even though you (and me) liked the simplification? :)
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 meant that it works the same as it did! In master
, the plugins are also loaded before reusable and group items. If anything, this PR visually clarifies where plugins are added due to the new separator.
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.
This breaks third-party extensibility.
This is how I've tested:
- Activate a plugin that adds a new item to the block settings (ex: blocksettingsmenu-plugin).
- Load the editor.
- I've got a WSOD kind of error (for some reason, my env is using React production builds so message isn't very useful).
packages/edit-post/src/components/block-settings-menu/plugin-block-settings-menu-item.js
Show resolved
Hide resolved
packages/block-editor/src/components/block-settings-menu-controls/README.md
Show resolved
Hide resolved
I've found why this isn't working for plugins and submitted a change. This is good to land after all those changes are applied. |
Great catch @nosolosw, thanks for proposing the fix 💯 |
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.
Retested this and works as expected. 🚢
It refactors __experimentalBlockSettingsMenuPluginsExtension and promotes it to stable API.
…/index.js Co-Authored-By: Andrés <[email protected]>
ecbc85c
to
749c3ff
Compare
Thanks @nosolosw for all your help! |
Description
Part of #20116.
It refactors
__experimentalBlockSettingsMenuPluginsExtension
and promotes it to stable API underBlockSettingsMenuControls
name. I was able to simplify the implementation a bit by moving all logic related toblock-editor
to theBlockSettingsMenuControls
component that.How has this been tested?
Add a few different blocks and make sure that the block settings menu works as before.
Screenshots
Types of changes
Refactoring.
Checklist: