-
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
Block Editor: Provide a way to customize panels in Inspector Controls #33891
Comments
Interesting idea. This would presumably have to be handled by a JS filter because the Inspector Controls are build from React components (without any PHP involvement). So we can't use PHP filters, but we could potentially use a JS filter on the list of Inspector Controls. From what little I know of the core build process however at this moment no such filtering exists and the build process would be a direct conversion from React defined components to the final output. This may change in the future because I believe it's also the reason we don't have an easy way to reorder the panels or inject new panels before defaults. Worth mentioning that I do believe there is an HOC (Higher Order Component) approach that let's you tap into the entire editor build and through that it may be possible to filter out the panels. Some tutorials exist on using that approach for similar changes to the inspector. |
Yes, of course, which is why I mentioned editor.BlockEdit but i'm not sure how to do it
Share these tutorials with us, please. Many users are looking for a solution to this (including me):
Note: theme.json made it possible to remove some panels, but not all, e.g. panels cannot be removed from an image block, etc. Potential related issues I've found: |
This is so needed. It would also be nice to conditionally remove panels. For example, only certain block styles could get certain panels. |
Hi there! It is possible to remove block controls via theme.json, as shown in this comment. Sadly it's not possible to make the removal conditional on block styles (OP from the linked issue was also after that functionality). |
Not the prettiest quickfix idea, but at least we could hide unwanted panels from core blocks? What if there was a data-attribute in the sidebar containing the information what block is being edited, for example: So we could then visually hide specific components using CSS:
|
Hi, I have found this as I was looking for a solution as well. @ekesto suggestion makes sense. Allowing to target control panels via CSS individually either via a class assigned or a data- attribute would also be useful to customize the style to control panels (for example to highlight some that we want the website editors to pay attention to). |
This is one of the items that we plan to tackle as part of the Block Library project from Phase 3: Collaboration roadmap. In particular, this functionality was covered by @mtias in the following section:
There is also a complementary issue #47641 for Block Toolbar. |
What problem does this address?
(I am not sure if this is due to incomplete documentation or it is simply impossible to do. Therefore, I assume it as ticket here)
I don't know how to remove unwanted panels inside InspectorControls from core blocks.
Unfortunately, there is no such example in the documentation, so I'm not sure how to do it
I know about
editor.BlockEdit
filter but from what i see it's helping only if i want to make new wrapped componentWhat is your proposed solution?
If it is possible to remove unwanted panels inside InspectorControls from core blocks, it would be great to see such an example in the documentation or any example method here
The text was updated successfully, but these errors were encountered: