Enqueue preset styles for all themes in the editor#35424
Merged
Conversation
ff10d3b to
e265764
Compare
oandregal
commented
Oct 7, 2021
| if ( | ||
| 'site-editor' !== $context && | ||
| 'mobile' !== $context && | ||
| ( WP_Theme_JSON_Resolver_Gutenberg::theme_has_support() || get_theme_support( 'experimental-link-color' ) ) |
Member
Author
There was a problem hiding this comment.
We no longer need to check for theme.json presence of legacy link color support, because we now enqueue the preset styles for all themes.
We can also simplify the double negation by using all instead.
jorgefilipecosta
approved these changes
Oct 7, 2021
Member
jorgefilipecosta
left a comment
There was a problem hiding this comment.
The change makes sense to me 👍
senadir
approved these changes
Oct 7, 2021
Contributor
senadir
left a comment
There was a problem hiding this comment.
Still works after the update!
This was referenced Oct 7, 2021
oandregal
added a commit
that referenced
this pull request
Oct 11, 2021
This was referenced Oct 18, 2021
Member
Author
|
This inadvertently introduced a bug for themes that do not provide any editor styles. See #35730 (comment) and potential fixes #35736 and #35737 |
7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #34334
This fixes a bug by which preset classes were not added to the editor for all themes.
In #34334 I missed enqueueing the preset classes in the editor for all themes. When they were removed from the
base-stylepackage at #34510 they started to be missing in the editor.Why this wasn't noticeable before
In the editor, when the user selects a color from the preset palette, classes are added to it. The block also gets inline styles for legacy reasons. That we inline styles hid the fact that we were not enqueueing preset classes in the editor.
Setup affected by this bug
This only affected blocks that don't use our support hooks (so they don't get inline styles) when the active theme is a classic one (no theme.json or legacy link color support) that also delegated the enqueueing of preset classes to core (either because they don't define any preset or because they do but don't enqueue it themselves). A example of this is the Storefront theme.
This was introduced in Gutenberg 11.5.
How to test
The expected result is that the paragrah still has the colors applied (because the classes are now in scope).
Another check you can do is to verify the core classes are present, such as:
.has-vivid-red-color,.has-luminous-vivid-orange-background-color, etc. See full list of colors. The classes generated are in the form of.has-$slug-color,.has-$slug-background-color.