-
Notifications
You must be signed in to change notification settings - Fork 4.5k
WP Block Styles: Only load in the editor if a theme opts in #29252
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
Conversation
… doesn't add any editor styles
Size Change: +4 B (0%) Total Size: 1.38 MB
ℹ️ View Unchanged
|
@aristath Ari and @carolinan Carolina I am thinking this is something you might want to look closer at. |
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice.
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! |
Co-authored-by: Jeff Ong <jeff.ong@automattic.com>
I agree that this would be an improvement. |
This makes sense to me. I thought this was how it worked already. |
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: