Update theme.json schema to allow for per-block management of settings.#36746
Conversation
|
If this approach seems sound, it may make sense to merge this and then create a tracking ticket for the other blocks. I have spent a fair amount of time looking into the per-block support and can handle the creation of that ticket. It would also be a great place for new contributors to get some props. |
ajlende
left a comment
There was a problem hiding this comment.
Sorry it took me so long to get around to reviewing this, but I like the idea! Let's get the merge conflicts resolved and do like you said with creating a tracking issue to update the rest of the blocks.
ea30a45 to
f45716a
Compare
|
@ajlende I have addressed the merge conflicts but am blocked by some e2e tests. The navigation block e2e failures are unrelated to the changes here. Based on @youknowriad 's comment here I have also created a PR to skip the test with #37729 |
|
Looks like the docgen for the theme.json broke because of the structure change. Care if I push a few commits to this branch to fix it? Otherwise, the change would be in https://github.com/WordPress/gutenberg/blob/trunk/bin/api-docs/gen-theme-reference.js. |
Not at all! I just merged #37729 as well so be sure to pull latest |
Cool, will do! |
f45716a to
396d9cf
Compare
|
Alright, I pushed a quick fix that will generate the same docs as before. As a follow-up when all the blocks are updated we can update the docgen to show the settings per-block. |
Description
This PR is an attempt at addressing #36630. It separates out each of the setting objects ( border, color, spacing etc ) into individual definitions and then combines them on a per-block basis using
allOf. This allows the schema to use any or all of them to create a schema that is both valid and also reflects what the block actually supports.I have includes a single updated block in this PR so we can discuss if this is the correct approach. The
core/buttonblock only implements the controls for theborder.radiusoption so I have updated its entry to reflect such.How has this been tested?
Tested locally by pointing the
$schemaentry to the theme.json schema definition in this PRTypes of changes
Schema updates that should have no breaking affect on blocks.
Checklist:
*.native.jsfiles for terms that need renaming or removal).