Opened 20 months ago
#58542 new feature request
Theme.json / Restricting general settings like font sizes on blocks generates a lot of duplication
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | |
Component: | Themes | Keywords: | |
Focuses: | Cc: |
Description
Hello.
In my theme.json file, let's say I declare 20 font sizes in my settings / typography / fontSizes section. As per the official schema, it is an array of objects with a size, slug, and name property. I've seen a project declaring 20 of those.
Then I would like to restrict core/paragraphs to use only 5 of them, and core/headings to use only three.
With the current theme.json implementation, I need to declare a settings / blocks / "core/paragraph" object, then copy / paste the 5 font sizes objects I allow to my user to use with paragraphs.
The current problems I face are as follows :
- It generates a lot of code duplication
- The two declarations are not linked together, which can be used as an advantage, but also seen as an inconvenient, especially when adjusting main settings, which would then not be updated in blocks.
Proposal :
- Add a new attribute to the blocks settings, like "restrict", "include" or "exclude" which would be an array of slugs coming from the main settings declaration.
- It could work with color palettes, fontSizes, spaces, or any array that supports slugs.
- This way when declaring block specific settings, we could have less duplication, and a synchronization with main settings.
Example:
{ "blocks": { "core/button": { "typography": { "fontSizesInclude": ["sizeSlugA","sizeSlugB"] }, "color": { "paletteExclude": ["colorSlugA","colorSlugB"] } } } }
Thank you for your work and your time reading me.
Best Regards.
Jeremy.
Note: See
TracTickets for help on using
tickets.