Sidebar Tabs: Use editor settings to override display#46321
Conversation
|
Size Change: +110 B (0%) Total Size: 1.33 MB
ℹ️ View Unchanged
|
talldan
left a comment
There was a problem hiding this comment.
Pretty happy with this approach.
I personally don't think removing tabs from the link block is the long term solution to the nav block's List View interface, but it does solve the immediate problem and provides some time for more exploration into the right solution.
Nice work!
| if ( tabSettings[ blockName ] !== undefined ) { | ||
| return tabSettings[ blockName ]; | ||
| } | ||
|
|
||
| if ( tabSettings.default !== undefined ) { | ||
| return tabSettings.default; | ||
| } |
There was a problem hiding this comment.
So at the moment you can set default: false and something like 'core/paragraph': true to enable tabs only on one block. Or default: true and 'core/paragraph': false to disable only one block.
That's pretty flexible, and honors the individual tab setting, which is nice.
The other option might be having 'default' as a separate setting entirely instead of a property, but I don't really have a strong preference either way. I wonder if anyone has ever made a block with the name 'default', as that may cause an issue. It would be going against the block naming guidelines, which recommend namespaced block names (my-plugin/default), so probably not something to worry about.
There was a problem hiding this comment.
Thanks. I'll be happy to trial the alternative if others have stronger opinions or different thoughts.
getdave
left a comment
There was a problem hiding this comment.
Thank you so much for working on this.
Some things I spotted. Will test manually shortly...
packages/block-editor/src/components/inspector-controls-tabs/use-inspector-controls-tabs.js
Show resolved
Hide resolved
getdave
left a comment
There was a problem hiding this comment.
Screen.Capture.on.2022-12-06.at.11-17-23.mp4
I tested in both Site and Post editors and this worked as expected for the Nav block experiment 👏
|
Lets address the feedback in a followup... |
|
A PR addressing the majority of feedback is up in #46346 |
* Sidebar Tabs: Use editor settings to override display * Roll check of tab display into use tabs hook * Disable display of tabs for Nav Submenu block
Related:
What?
Why?
We need a means of providing plugins and third party blocks with the ability to disable the display of block inspector tabs.
How?
__experimentalBlockInspectorTabsblock_editor_settings_allfilter to the Navigation Link block to disable tabs for itAlternative Approaches
Testing Instructions
Testing Instructions for Keyboard
Screenshots or screencast
Screen.Recording.2022-12-06.at.2.09.04.pm.mp4