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:
parent
95bbd4c7d1
commit
007dec9ec6
|
@ -191,7 +191,6 @@ $editor_settings = array(
|
||||||
'titlePlaceholder' => apply_filters( 'enter_title_here', __( 'Add title' ), $post ),
|
'titlePlaceholder' => apply_filters( 'enter_title_here', __( 'Add title' ), $post ),
|
||||||
'bodyPlaceholder' => $body_placeholder,
|
'bodyPlaceholder' => $body_placeholder,
|
||||||
'autosaveInterval' => AUTOSAVE_INTERVAL,
|
'autosaveInterval' => AUTOSAVE_INTERVAL,
|
||||||
'styles' => get_block_editor_theme_styles(),
|
|
||||||
'richEditingEnabled' => user_can_richedit(),
|
'richEditingEnabled' => user_can_richedit(),
|
||||||
'postLock' => $lock_details,
|
'postLock' => $lock_details,
|
||||||
'postLockUtils' => array(
|
'postLockUtils' => array(
|
||||||
|
|
|
@ -307,7 +307,8 @@ function get_block_editor_settings( array $custom_settings, $block_editor_contex
|
||||||
$custom_settings
|
$custom_settings
|
||||||
);
|
);
|
||||||
|
|
||||||
$presets = array(
|
$global_styles = array();
|
||||||
|
$presets = array(
|
||||||
array(
|
array(
|
||||||
'css' => 'variables',
|
'css' => 'variables',
|
||||||
'__unstableType' => 'presets',
|
'__unstableType' => 'presets',
|
||||||
|
@ -320,8 +321,8 @@ function get_block_editor_settings( array $custom_settings, $block_editor_contex
|
||||||
foreach ( $presets as $preset_style ) {
|
foreach ( $presets as $preset_style ) {
|
||||||
$actual_css = wp_get_global_stylesheet( array( $preset_style['css'] ) );
|
$actual_css = wp_get_global_stylesheet( array( $preset_style['css'] ) );
|
||||||
if ( '' !== $actual_css ) {
|
if ( '' !== $actual_css ) {
|
||||||
$preset_style['css'] = $actual_css;
|
$preset_style['css'] = $actual_css;
|
||||||
$editor_settings['styles'][] = $preset_style;
|
$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'] ) );
|
$actual_css = wp_get_global_stylesheet( array( $block_classes['css'] ) );
|
||||||
if ( '' !== $actual_css ) {
|
if ( '' !== $actual_css ) {
|
||||||
$block_classes['css'] = $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();
|
$editor_settings['__experimentalFeatures'] = wp_get_global_settings();
|
||||||
// These settings may need to be updated based on data coming from theme.json sources.
|
// These settings may need to be updated based on data coming from theme.json sources.
|
||||||
if ( isset( $editor_settings['__experimentalFeatures']['color']['palette'] ) ) {
|
if ( isset( $editor_settings['__experimentalFeatures']['color']['palette'] ) ) {
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @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.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue