Make WordPress Core

Changeset 52753


Ignore:
Timestamp:
02/17/2022 02:17:18 PM (3 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.
Merges [52752] to the 5.9 branch.
Fixes #55188.

Location:
branches/5.9
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/5.9

  • branches/5.9/src/wp-admin/edit-form-blocks.php

    r52594 r52753  
    192192    'bodyPlaceholder'                      => $body_placeholder,
    193193    'autosaveInterval'                     => AUTOSAVE_INTERVAL,
    194     'styles'                               => get_block_editor_theme_styles(),
    195194    'richEditingEnabled'                   => user_can_richedit(),
    196195    'postLock'                             => $lock_details,
  • branches/5.9/src/wp-includes/block-editor.php

    r52745 r52753  
    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.