-
-
Notifications
You must be signed in to change notification settings - Fork 107
Update enqueue.php - fix for loading styles in classic editor #975
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
|
It seems that this needs more attention. #976 does not enqueue editor-style if Block editor is in use, so I closed it and let's go further here. Have following improved idea which enqueues editor-styles only if Block editor is in use. It works at first glance fine with Block, Classic and in general if TinyMCE is active: /**
* Register editor styles only if the block editor is active.
*/
function bootscore_add_editor_styles() {
add_action('current_screen', function($screen) {
if (function_exists('use_block_editor_for_post_type') && use_block_editor_for_post_type($screen->post_type)) {
add_theme_support('editor-styles');
add_editor_style('assets/css/main.css');
}
});
}
add_action('after_setup_theme', 'bootscore_add_editor_styles');Let me know what you think! |
|
great! That works! |
|
Unfortunately, I discovered one more issue. If editor-style is enqueued like in my comment above, styles are not added to the pattern library Backend > Appearance > Patterns > Bootscore. Means we have to refactor the entire scripts: Lines 54 to 81 in d833883
|
|
@typomaniac77 Let's try another approach.
Go to: bootscore/inc/tinymce-editor.php Line 22 in d833883
and add $content_style = 'body.mce-content-body { margin: 9px 10px; font-family: inherit; height: auto;}';This works fine in my case for block and classic editor. I tried to do this changes by myself in your branch but I have no access to it. @typomaniac77 @faridulhassan This have to be deeply tested in both, block and classic editor on your side as well. If you agree with this changes, we can fix this bug quickly. |
|
@crftwrk Your following approach worked fine for me. It fixes the auto height issue and doesn't load main.css in dashboard page.
|
Great, are you able to create quickly a new pull request? Then we can merge this directly and release a new patch soon.
Yes, that's how WordPress handles it and it's intended. You can check this by installing a default WP theme https://wordpress.org/themes/twentytwentyone/ and check the Classic Editor (Styles) in the backend. But we can wrap the editor-styles enqueue in a filter in a second pull request to disable editor-styles with a single line in child's functions.php. For example like this: /**
* Disable editor-style
*/
add_filter('bootscore/load/editor_styles', '__return_false');Do you agree? |
|
@faridulhassan The more I think about it, I believe this is a bug (or it is intended to move users to the GB editor) came with WordPress 6.7.2. It does not happen on earlier WP versions and default themes editor-style is enqueued to classic editor as well. There is no way to disable editor-styles in classic editor, we can only stop the growing by adding the height CSS to TinyMCE. Edit: This will be fixed in WP 6.8 |

Closes #974