mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 14:20:15 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@53208 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -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,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user