-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
backward compatibility for add_editor_style() #7913
Comments
Thanks @joyously. I'm not sure whether we'll be able to immediately act upon this issue, but it's good to have it open for visibility. |
We won't be loading In general, the way of styling the editor is going to be phased out in favor of styling blocks (through mechanisms like block variants). |
Closing this for now. |
I'd like to make sure this is documented appropriately. |
I think it's a mistake to view the theme styles this way. Themes should not be supplying blocks, and so their styles need to be fairly generic. It makes sense for core blocks to have standard classes similar to |
I've documented this in my Gutenberg migration guide https://github.com/danielbachhuber/gutenberg-migration-guide/blob/master/feature-editor-stylesheets.md
For reasons mentioned before, the theme developer would need to first verify their existing editor stylesheet doesn't break Gutenberg. Once they've done so, if they choose to continue to use a global editor stylesheet, they can enqueue it on the function wpdocs_theme_add_editor_styles() {
wp_enqueue_style( 'my-editor-stylesheet', get_stylesheet_directory_uri() . '/editor-style.css' );
}
add_action( 'enqueue_block_editor_assets', 'wpdocs_theme_add_editor_styles' ); |
How is that backward compatible? The new editor should make sure that a theme's styles do not affect the admin page adversely, not the other way around. I'm referring to thousands of existing themes that might be supplying fonts or colors for the editor page. They shouldn't all have to change just because you guys decided to not use an iframe. |
Problem: thousands of existing themes call
add_editor_style()
The current method of supplying styles to the editor is easy and used by thousands of themes. One call to
add_editor_style()
is all that is needed to make the editor look similar to the front end. Styles for fonts, colors, padding, etc. for HTML elements are the basis for what the theme provides, with the user choosing a lot of those in the Customizer.Solution
For backward compatibility, the new editor should continue to load styles using
add_editor_style()
.considerations
Discussions on #4001 indicate that there could be a problem using existing styles because of styles bleeding into the rest of the page, because the old editor loads in an iframe.
Much talk on #5360, but only from the viewpoint of new themes, not old themes.
The consensus in Theme Review is that themes should not create blocks. But they still need to style the page, including in the editor.
@danielbachhuber
The text was updated successfully, but these errors were encountered: