Make WordPress Core


Ignore:
Timestamp:
02/17/2022 02:12:59 PM (2 years ago)
Author:
jorgefilipecosta
Message:

Global Styles: Load the global styles before the theme styles in the editor.

This commit makes the site editor follow what we do in the front-end, where theme styles are loaded after global styles by default.

Props oandregal, ntsekouras.
Fixes #55188.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/block-editor.php

    r52733 r52752  
    308308    );
    309309
    310     $presets = array(
     310    $global_styles = array();
     311    $presets       = array(
    311312        array(
    312313            'css'            => 'variables',
     
    321322        $actual_css = wp_get_global_stylesheet( array( $preset_style['css'] ) );
    322323        if ( '' !== $actual_css ) {
    323             $preset_style['css']         = $actual_css;
    324             $editor_settings['styles'][] = $preset_style;
     324            $preset_style['css'] = $actual_css;
     325            $global_styles[]    = $preset_style;
    325326        }
    326327    }
     
    333334        $actual_css    = wp_get_global_stylesheet( array( $block_classes['css'] ) );
    334335        if ( '' !== $actual_css ) {
    335             $block_classes['css']        = $actual_css;
    336             $editor_settings['styles'][] = $block_classes;
     336            $block_classes['css'] = $actual_css;
     337            $global_styles[]      = $block_classes;
    337338        }
    338339    }
     340
     341    $editor_settings['styles'] = array_merge( $global_styles, get_block_editor_theme_styles() );
    339342
    340343    $editor_settings['__experimentalFeatures'] = wp_get_global_settings();
Note: See TracChangeset for help on using the changeset viewer.