-
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
Issue registering a PluginDocumentSettingPanel plugin #22049
Comments
Or maybe all this is just a matter of stating in the documentation on how to use the dispatch |
I can confirm this as well in latest WordPress. In the console, I had to pass |
Isn't the issue caused by the lack of
Isn't it mandatory? If it is, we can use const NodeDocumentSettings = () => {
return (
<PluginDocumentSettingPanel
- className="node-document-settings"
+ name="node-document-settings"
title="Node"
opened={true}
>
<div>Node settings</div>
</PluginDocumentSettingPanel>
);
};
registerPlugin('node-document-settings', {
render: NodeDocumentSettings,
}); |
This is part of the issue, yes. If The other part is that the way the panelName is registered. It is created a combination of In your example above the panelName would be |
I've been thinking about this more and I think that we should keep the panel naming convention as it is now. This will effectively namespace any custom panels with the name of the plugin and avoid potential naming conflicts. As such, I think the solution should be to add a warning if the name prop is missing as @gziolo suggested and to add some documentation around calling theme custom panels. I'll update my PR accordingly. |
PR Updated. |
I was having trouble to set the settings panel to opened when registering a plugin. Here's the example code:
As you see on the code, I tried to use the
opened
prop but to no avail.So I tried to dispatch
toggleEditorPanelOpened('node-document-settings')
but that also didn't work.I found out that the plugin is registered at local storage like this:
node-document-settings/undefined
So using
toggleEditorPanelOpened('node-document-settings/undefined')
worked.Checked the code at https://github.com/WordPress/gutenberg/blob/v8.0.0/packages/edit-post/src/components/sidebar/plugin-document-setting-panel/index.js#L109
and it seems the component sets the plugin name joining the context name and props name.
I don't think it makes sense to "join" both plugin context name and prop name at the PluginDocumentSettingPanel component. Maybe it was supposed to have
panelName: context.name,
?This is happening using Drupal Gutenberg with Gutenberg v8.0.0 but I believe it can be reproduced on WordPress.
The text was updated successfully, but these errors were encountered: