Skip to content
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

update styles controller to fetch gutenberg bundled theme.json #46810

Merged
merged 1 commit into from
Dec 29, 2022

Conversation

madhusudhand
Copy link
Member

What?

Side Editor doesn't load changes from Gutenberg bundled theme.json after this change

This change adds back the method get_theme_item to Gutenberg_REST_Global_Styles_Controller_6_2 so that the local version of the theme.json is fetched when plugin is activated.

Testing Instructions

  1. Do changes to bundled theme.json such as updating color palette
  2. Open site editor
  3. It should have the updated color palette values from bundled theme.json

@madhusudhand madhusudhand force-pushed the fix-global-styles-rest-endpoint branch from 1661c0d to ef303f5 Compare December 28, 2022 13:17
@noahtallen
Copy link
Member

noahtallen commented Dec 28, 2022

Is this important for inclusion in 14.8.x? E.g. does this fix a severe incompatibility issue? (14.8.x includes the removal of the 6.0 compat code, which has been causing a lot of problems for the release.)

@oandregal oandregal merged commit a130890 into trunk Dec 29, 2022
@oandregal oandregal deleted the fix-global-styles-rest-endpoint branch December 29, 2022 10:28
@github-actions github-actions bot added this to the Gutenberg 14.9 milestone Dec 29, 2022
@oandregal
Copy link
Member

This fix only affects the site editor, as it's the only place where the REST controller is used, as far as I know.

There are a couple of things I can think of:

  • Without this fix, the controller will pull data from the theme.json bundled by core and not Gutenberg, meaning that changes to the Gutenberg's theme.json are ignored.

  • It'll also sanitize the data against the schemas defined by core (see VALID_STYLES and VALID_SETTINGS) instead of the schemas defined by Gutenberg: as a consequence, properties defined in Gutenberg but not in the WordPress runtime will be ignored.

For example, comparing Gutenberg with latest WordPress trunk (the same will happen to other props in older WordPress versions), dimensions.minHeight is not show under "Global Styles sidebar > blocks > group > layout" without this fix:

Without the fix With this PR (expected behavior)
Captura de ecrã de 2022-12-29 11-51-45 image

This is definitely not a fatal, so I'm not sure we need a new 14.8.X patch release given how close 14.9. Though it's still an important fix.

@noahtallen
Copy link
Member

Ok, good to know. I'll cut a patch release then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants