WP Block Styles: Only load in the editor if a theme opts in#29252
Merged
WP Block Styles: Only load in the editor if a theme opts in#29252
Conversation
… doesn't add any editor styles
Closed
|
Size Change: +4 B (0%) Total Size: 1.38 MB
ℹ️ View Unchanged
|
Contributor
|
@aristath Ari and @carolinan Carolina I am thinking this is something you might want to look closer at. |
jasmussen
reviewed
Feb 23, 2021
lib/client-assets.php
Outdated
|
|
||
| global $editor_styles; | ||
| if ( ! is_array( $editor_styles ) || count( $editor_styles ) === 0 ) { | ||
| // Always include visual styles is no $editor_styles are declared, so the editor never appears broken. |
Contributor
Honestly, this seems like a good heuristic to me, and provides a good balance of the editor experience sans editor styles, and theme developer expectations. I think this could use a code review, but otherwise, 👍 👍 from me! |
jffng
reviewed
Feb 23, 2021
Co-authored-by: Jeff Ong <jeff.ong@automattic.com>
Contributor
|
I agree that this would be an improvement. |
youknowriad
approved these changes
Mar 5, 2021
Contributor
|
This makes sense to me. I thought this was how it worked already. |
14 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.
Description
The current behaviour is to always load opinionated block styles regardless of whether the theme uses them. This is a safe fall back for cases where a theme doesn't have any editor styles - so that the blocks in the editor don't look totally broken. However it has the drawback of overriding editor styles provided by the theme, meaning that theme editor styles end up becoming larger and more complex than necessary, to override these rules.
This PR changes that behaviour so that:
How has this been tested?
With Independent Publisher 2, Karuna Libre 2
Types of changes
Bug fix
Checklist: