-
Richard H
I’ve submitted a bug report/support request at the Bricks forum: https://forum.bricksbuilder.io/t/bricks-editor-styles-disappear-after-generateblocks-plugin-activation/22250
-
Thanks!
-
Richard H
Hi,
Bricks replied to my support request: https://forum.bricksbuilder.io/t/no-bug-gutenberg-editor-styles-disappear-after-generateblocks-plugin-activation/22250
According to them “the problem likely arises from the generateblocks_do_block_css_reset function included in GenerateBlocks”.
So I’ve tried it with a theme (Hello Elementor and Kadence) other than the WP default themes and indeed I encounter the same problem.
-
David
We know that function is interfering with the way the editor styles are loaded
But i can’t replicate this in other themes – was it the free version of Kadence ?For now if you want you can use this PHP Snippet to disable the function:
remove_filter( 'block_editor_settings_all', 'generateblocks_do_block_css_reset', 15 );
And we will do some more investigations.
-
Richard H
Yes, the free versions of Kadence and Hello Elementor.
-
David
OK, so we ran several test, one of which recreates the same issue without GenerateBlocks being installed.
See here:This is a clean bricks install on the latest version.
There is no GenerateBlocks installed.
We use the Code Snippets plugin to add a custom function, that usesblock_editor_settings_all
to load some editor CSS
Just to re-iterateblock_editor_settings_all
is a core WP function. Built for loading styles in the editor.When we activate the PHP Snippet you can see the editor styles break.
So there is definitely an issue that exists without GB in the equation.
-
Richard H
So the common denominator in all circumstances is that WP function. Do you suspect it’s a bug in WP itself?
By the way, I added the PHP Snippet to disable the function. And although the editor stylings reappear, so do the GB blocks margins (as could be expected). It’s workable for now, but not quite ideal.
Thanks for your help so far.
-
David
We believe the issue is more likely related to how the theme is loading ( or not loading ) the editor styles and how the use of that filter affects that behaviour.
As what seems to be happening is WP is loading its fallback CSS later when the filter is active.
This wouldn’t happen if the theme was providing proper editor styles.To be honest i am not familiar with Bricks , so im not sure what i expect to see in the block editor.
For example if i ( could ) set some typography styles in bricks eg. Poppins 18px on Body, would (should) i see those styles in the block editor? -
Richard H
This wouldn’t happen if the theme was providing proper editor styles.
Do you want me to relay a follow up question to my Bricks support post and if so what should I ask?
For example if i ( could ) set some typography styles in bricks eg. Poppins 18px on Body, would (should) i see those styles in the block editor?
In Bricks you can set global CSS styles like typography in a theme (sort of a sub theme within Bricks itself). These styles are not rendered in the WP post/block editor, only on the frontend.
-
David
Ah , in that case if its not actually using theme styles in the editor then that option should be disabled.
What happens if you go to: Block Editor -> Top Bar 3 dot menu -> Preferences -> Appearance and uncheck theUse theme styles
Let us know what that does, and then we can talk next steps
-
Richard H
By unchecking
Use theme styles
the correct default stylings return. So that’s good news. The GB margins are still missing though (even with your ‘disable filter’ php snippet disabled). -
David
Where can i see the missing margins ?
I am not sure the login on your site is still active. -
Richard H
My bad, the margins I mentioned seem to be a default margin in an already existing GB container block. Where the left and right margins are 23px and greyed out. Not entirely sure where that default value comes from, don’t have time atm to track it down either. But I’m sure it checks out. When I add a new GB container there’s no default margin. So no issue!
Do you happen to know a way to disable the theme styles in one go, for everyone with admin rights (editors, writers)?
-
David
Do you know what may be the easiest solution.
1. leave the editor styles activated
2. add this PHP Snippet to the site:add_filter( 'block_editor_settings_all', 'custom_editor_styles', 15 ); // Function to apply CSS reset function custom_editor_styles( $editor_settings ) { $css = ' body { background: #f0f0f1; color: #3c434a; font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif; font-size: 13px; line-height: 1.4em; min-width: 600px; }'; // Add CSS to editor settings $editor_settings['styles'][] = array( 'css' => $css, ); return $editor_settings; }
This will then use the correct filter to load the Bricks theme styles.
- You must be logged in to reply to this topic.