WP 5 how to add_editor_style for both tinyMCE and Gutenberg


Before Gutenberg blocks we used to add editor styles by using

add_editor_style( array( 'path/to/editor-style.css', 'whatever.css' ) );

Now we have Gutenberg editor whose stylesheet is also loaded by using the same function.

What if we want to keep stylesheet for both of them? I ask because there are plugins which allow users to disable Gutenberg. Obviously it’s not possible to do something like:

 add_editor_style( array( 'editor-style-mce.css', 'editor-style-gutenberg.css' ) );

To make things more complicated for developers, there’s an option to use classic editor as a Gutenberg block.
It looks like we have to check for Gutenberg availability on after_setup_theme action and load proper editor stylesheet respectively but we can’t do much when classic editor is used as Gutenberg block.

Is there anyone capable to provide any kind of solution?

, , dameer dj 4 years 2020-02-17T08:38:25-05:00 0 Answers 78 views 0

Leave an answer