-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Extensibility: Add possibility to disable document settings panels registered by plugins #16900
Conversation
…gistered by plugins
8d2bbe3
to
7d2ef43
Compare
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 works well in my tests 👍
I noticed that if the plugin is not currently showing the panel no option to hide it appears. I imagine some plugins may only show the panel in rare circumstances, so for the user to disable the panel, it first needs to create a case where it appears. Would it make sense to allow plugins to explicitly add an option to disable their panel even if it is not being shown right now?
Another related question: If there is a plugin panel that is currently being drawn but not shows because the user disabled it, would it make sense to show a small UI feedback in the document settings indicating hidden panels exist?
Can you clarify what needs to happen to have that? Do you mean having something like the following?: { showMyPanel && <PluginDocumentSettingPanel /> } This would prevent the option to be visible in the modal, yes. Any ideas about how we could approach it, I can't think of any solution which works out of the box. Otherwise, this option will always be present in the modal as it's not guarded internally by any check.
@mtias, @mapk or @jasmussen any thoughts about that? I guess we might cover it with the new tips if that makes sense. I'm not convinced we need it though. |
Agreed. |
When hiding blocks in the Block Manager, we didn't plan how to communicate it outward, and it's definitely bit me in the butt a few times. It was a necessary exploration though. With this example, I agree that we don't need to notify the user of which panels are turned off... right now. It's something to watch as we introduce this though. |
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.
Can you clarify what needs to happen to have that? Do you mean having something like the following?:
{ showMyPanel && }
This would prevent the option to be visible in the modal, yes. Any ideas about how we could approach it, I can't think of any solution which works out of the box. Otherwise, this option will always be present in the modal as it's not guarded internally by any check.
One option would be to expose the fill that allows disabling a specific panel so if a plugin things it is a better UI to always have the option to disable the panel available the plugin could do it.
But on second thought, this just makes our API bigger while trying to solve a problem that we don't if it exists.
I think this PR is ready 👍
In 99% of cases, we should offer a way to disable/enable the panel which nicely aligns with all panels included in core. So we can live with it :) |
Should we add some docs for this? 😇 |
What kind of docs would you like to see? This is all internal to the |
Ah, apologies. I misread and thought |
Description
Follow up for #13361. It addresses my own comment #13361 (review):
This PR introduces internal SlotFill pair to offer a way for users to disable/enable registered Document settings panels by plugins.
How has this been tested?
Register a custom document setting panel in the sidebar with the following snippet:
In my tests, I registered multiple panels to ensure that it's possible to enable/disable them and everything is rendered in the same order in both the sidebar for Document setting and in the Options modal.
Screenshots
Checklist: