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
Add EditorStyles CSS to the widgets editor #25699
Conversation
|
Size Change: +19 B (0%) Total Size: 1.17 MB
ℹ️ View Unchanged
|
|
This is something we wanted to avoid because the editor styles are optimized for the post editor and site editor but potentially the widget area is different. For instance a sidebar might use a different background and font for than the regular post content. |
|
A better approach here might be to load the default editor styles. |
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.
This looks and works all right in my testing and review.
Considering we will use the "fake post" technique for new editors ahead we may want to update the docs and specify the post for the block_editor_settings filter can be null.
lib/widgets-page.php
Outdated
| @@ -77,7 +77,7 @@ function gutenberg_widgets_init( $hook ) { | |||
| gutenberg_get_legacy_widget_settings() | |||
| ); | |||
|
|
|||
| $settings = gutenberg_experimental_global_styles_settings( $settings ); | |||
| $settings = apply_filters( 'block_editor_settings', $settings, null ); | |||
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.
I don't think we should do that tbh, this will bring a ton of settings and features from the post editor that we're uncertain whether we want or not; Maybe it's good but I'd rather do it setting per setting.
As mentionned, the styles is a good one where I think they are different. The widgets should just use the default editor styles.
|
@youknowriad all good notes - thank you for this extra context. I added a comment so that it's explained right in the code. I wasn't sure what you meant exactly by "default editor styles" so I used |
|
By default editor styles, I mean the ones that are provided by the plugin itself. This file basically |
|
@youknowriad I may be missing something, but gutenberg/lib/client-assets.php Lines 570 to 620 in 06d1740
It sets |
|
Oh! you're right :) ignore me :P |
* Add EditorStyles CSS to the widgets editor * Use gutenberg_extend_block_editor_styles instead of all block_editor_settings
* Add EditorStyles CSS to the widgets editor * Use gutenberg_extend_block_editor_styles instead of all block_editor_settings
Description
Solves #17391 by using the same
<EditorStyles />as in the post editor.How has this been tested?
Screenshots
Types of changes
Bug fix (non-breaking change which fixes an issue)
Checklist: