From 007dec9ec63775ec0eddc6bd1646313284499d39 Mon Sep 17 00:00:00 2001 From: jorgefilipecosta Date: Thu, 17 Feb 2022 14:14:01 +0000 Subject: [PATCH] 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 --- wp-admin/edit-form-blocks.php | 1 - wp-includes/block-editor.php | 13 ++++++++----- wp-includes/version.php | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/wp-admin/edit-form-blocks.php b/wp-admin/edit-form-blocks.php index 5e7b39d619..0268bc8ae8 100644 --- a/wp-admin/edit-form-blocks.php +++ b/wp-admin/edit-form-blocks.php @@ -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( diff --git a/wp-includes/block-editor.php b/wp-includes/block-editor.php index 953349d8a8..8f3070af96 100644 --- a/wp-includes/block-editor.php +++ b/wp-includes/block-editor.php @@ -307,7 +307,8 @@ function get_block_editor_settings( array $custom_settings, $block_editor_contex $custom_settings ); - $presets = array( + $global_styles = array(); + $presets = array( array( 'css' => 'variables', '__unstableType' => 'presets', @@ -320,8 +321,8 @@ function get_block_editor_settings( array $custom_settings, $block_editor_contex foreach ( $presets as $preset_style ) { $actual_css = wp_get_global_stylesheet( array( $preset_style['css'] ) ); if ( '' !== $actual_css ) { - $preset_style['css'] = $actual_css; - $editor_settings['styles'][] = $preset_style; + $preset_style['css'] = $actual_css; + $global_styles[] = $preset_style; } } @@ -332,11 +333,13 @@ 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; + $block_classes['css'] = $actual_css; + $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'] ) ) { diff --git a/wp-includes/version.php b/wp-includes/version.php index 3da121199a..fd42e25902 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -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.