Block editor: Prevent styles from being added in the site editor.

The site editor, unlike other editors, generates the styles coming from global styles (presets, styles) dynamically in the client. This is because the user can modify any value that we need to consolidate (merge core, theme, and user style preferences). We don't want to have the global styles twice, as it introduces subtle bugs.

Props oandregal, youknowriad.
See #55567.
Built from https://develop.svn.wordpress.org/trunk@53208


git-svn-id: http://core.svn.wordpress.org/trunk@52797 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
jorgefilipecosta 2022-04-18 17:12:07 +00:00
parent c4c4edccc0
commit 0559e94375
2 changed files with 6 additions and 1 deletions

View File

@ -383,10 +383,12 @@ function get_block_editor_settings( array $custom_settings, $block_editor_contex
array(
'css' => 'variables',
'__unstableType' => 'presets',
'isGlobalStyles' => true,
),
array(
'css' => 'presets',
'__unstableType' => 'presets',
'isGlobalStyles' => true,
),
);
foreach ( $presets as $preset_style ) {
@ -401,6 +403,7 @@ function get_block_editor_settings( array $custom_settings, $block_editor_contex
$block_classes = array(
'css' => 'styles',
'__unstableType' => 'theme',
'isGlobalStyles' => true,
);
$actual_css = wp_get_global_stylesheet( array( $block_classes['css'] ) );
if ( '' !== $actual_css ) {
@ -628,6 +631,7 @@ function get_block_editor_theme_styles() {
$styles[] = array(
'css' => wp_remote_retrieve_body( $response ),
'__unstableType' => 'theme',
'isGlobalStyles' => false,
);
}
} else {
@ -637,6 +641,7 @@ function get_block_editor_theme_styles() {
'css' => file_get_contents( $file ),
'baseURL' => get_theme_file_uri( $style ),
'__unstableType' => 'theme',
'isGlobalStyles' => false,
);
}
}

View File

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