From 0559e9437585afcb07d6ab1f6962fc9b296903f7 Mon Sep 17 00:00:00 2001 From: jorgefilipecosta Date: Mon, 18 Apr 2022 17:12:07 +0000 Subject: [PATCH] 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 --- wp-includes/block-editor.php | 5 +++++ wp-includes/version.php | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/wp-includes/block-editor.php b/wp-includes/block-editor.php index c9945eace9..48bf0dad38 100644 --- a/wp-includes/block-editor.php +++ b/wp-includes/block-editor.php @@ -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, ); } } diff --git a/wp-includes/version.php b/wp-includes/version.php index e99fa61032..dd0987dfa4 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -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.