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.
Built from https://develop.svn.wordpress.org/trunk@52752


git-svn-id: http://core.svn.wordpress.org/trunk@52341 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
jorgefilipecosta 2022-02-17 14:14:01 +00:00
parent 95bbd4c7d1
commit 007dec9ec6
3 changed files with 9 additions and 7 deletions

View File

@ -191,7 +191,6 @@ $editor_settings = array(
'titlePlaceholder' => apply_filters( 'enter_title_here', __( 'Add title' ), $post ),
'bodyPlaceholder' => $body_placeholder,
'autosaveInterval' => AUTOSAVE_INTERVAL,
'styles' => get_block_editor_theme_styles(),
'richEditingEnabled' => user_can_richedit(),
'postLock' => $lock_details,
'postLockUtils' => array(

View File

@ -307,6 +307,7 @@ function get_block_editor_settings( array $custom_settings, $block_editor_contex
$custom_settings
);
$global_styles = array();
$presets = array(
array(
'css' => 'variables',
@ -321,7 +322,7 @@ function get_block_editor_settings( array $custom_settings, $block_editor_contex
$actual_css = wp_get_global_stylesheet( array( $preset_style['css'] ) );
if ( '' !== $actual_css ) {
$preset_style['css'] = $actual_css;
$editor_settings['styles'][] = $preset_style;
$global_styles[] = $preset_style;
}
}
@ -333,10 +334,12 @@ function get_block_editor_settings( array $custom_settings, $block_editor_contex
$actual_css = wp_get_global_stylesheet( array( $block_classes['css'] ) );
if ( '' !== $actual_css ) {
$block_classes['css'] = $actual_css;
$editor_settings['styles'][] = $block_classes;
$global_styles[] = $block_classes;
}
}
$editor_settings['styles'] = array_merge( $global_styles, get_block_editor_theme_styles() );
$editor_settings['__experimentalFeatures'] = wp_get_global_settings();
// These settings may need to be updated based on data coming from theme.json sources.
if ( isset( $editor_settings['__experimentalFeatures']['color']['palette'] ) ) {

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.0-alpha-52750';
$wp_version = '6.0-alpha-52752';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.