Site logo

[Support request] Disable inline heading styles in block editor

Home Forums Support [Support request] Disable inline heading styles in block editor

Home Forums Support Disable inline heading styles in block editor

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #2551958
    James

    Hi there,

    I am using GeneratePress for a new site, where I am using the block editor but with essentially custom ACF blocks exclusively to offer editing flexibility while maintaining a high level of control.

    So, for example, I have my own heading block where I can take text and other custom settings related to that heading. This works fine on the front end, but I am noticing on the backend that the default generatepress typography styles, specifically the .editor-styles-wrapper h1, that gets injected inline before the block editor override my intended styling. If I go into the inspector and disable these styles, my heading look as I want it in the block editor.

    I don’t want to disable all of GeneratePress’ block editor styles, but so far I would like to disable the typography styling.

    Is that possible?

    #2552497
    David
    Staff
    Customer Support

    Hi there,

    we write all theme styles to the editor and excluding one style is not an option.
    I assume that your ACF has specific styles on the front end ?
    If so how are those styles added ?

    #2552583
    James

    Thanks, David

    I made some progress since posting the question. Switched from using enqueue_block_editor_assets to add my css file to the backend, to instead using add_editor_style with a high numeric priority so they come last. While I’ll still need to overrides to get things right, it’s already much better.

    Is using add_editor_style() the best option in your opinion?

    #2552716
    David
    Staff
    Customer Support

    Yep thats what we use in the theme:

    https://github.com/tomusborne/generatepress/blob/e83706a6a641200de7ff6b20d40daabf84884742/functions.php#L75

    and we provide our own filter generate_editor_styles if you want to piggy back on that.

    To cover all based there is also block_editor_settings_all which has a lot of options:

    https://developer.wordpress.org/reference/hooks/block_editor_settings_all/

    an example of it can be found in this forum eg. adding Customizer > Additional CSS to the editor:

    
    add_filter( 'block_editor_settings_all', function( $editor_settings ) {
        $css = wp_get_custom_css_post()->post_content;
        $editor_settings['styles'][] = array( 'css' => $css );
    
        return $editor_settings;
    } );

    Choices 🙂

    #2552723
    James

    Thanks, yeah I came across that example in other posts as well

    #2552932
    David
    Staff
    Customer Support

    You’re welcome

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.