-
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
Provide a way to remove/modify text alignment for core blocks #24616
Comments
Maybe we could tie this in with the current theme support for wide and full alignment? Cc @mtias @jasmussen |
Whether it's through the wide and full alignment support, or whether it's tied into the global styles feature registration, the use case seems fair enough. But given that it's conceptually not just about alignments, but presumably the argument could also be made for any other stylistic option, I wonder if there's a way to indeed bake the control right into the global styles work. @nosolosw any thoughts? |
Agreed it should probably be handled or explored through the theme.json which provides a more ergonomic way of dealing with specific block attributes rather than ad hoc theme supports. |
In the use case that I have, I need to remove text alignment for paragraph blocks for a certain post type only, and not globally. Would that be possible with theme.json? |
theme.json can be filterable so it can be tweaked in a given editing context. cc @nosolosw for clarification |
I've also added this issue to the backlog section at #20331 so it's easier to find when it comes to deciding the next steps for block supports and what options should be available through |
Bumping this as I'm running into a point where I need to disable text alignment on core blocks (all, with exceptions)... the theme.json approach honestly sounds like the dream in this scenario. I've not been able to find a way to accomplish this so far. Is there a temporary workaround or way to disable this via JS for each (or all)? I followed the link provided in this thread, but it appears the links referenced in it are 404ing, so I might be missing some context there. Appreciate any insight you have regarding this. Thank you! |
AFAIK the only way at the moment is CSS .components-toolbar-group button[aria-label='Align'] {
display: none;
} Not that nice, but works. |
Is your feature request related to a problem? Please describe.
As someone who uses WordPress to provide websites for clients, I need to be able to restrict the type of content a user can add via Gutenberg. This could be due to design reasons, enforcing a style guide for editors, or simply because the theme does not support alignment.
This is directly related to the rationale behind #15160 .
Describe the solution you'd like
Either include alignment in the upcoming
experiemental-theme.json
, or provide a robust (and documented) way to modify the alignment control on all core blocks - without having to deregister a core block, and register a customised version as a replacement.It should allow a developer to specify which alignments are supported, or completely disable alignment.
the
blocks.registerBlockType
feels like a good candidate as it already can be used to disable alignment for some core blocks.Describe alternatives you've considered
I tried the following:
But this only removes alignment controls on blocks like
core/embed
, it does not remove text alignment oncore/heading
orcore/paragraph
.The text was updated successfully, but these errors were encountered: