From bef301d5f88db0905c5960e5cab653c317d9ccc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9?= <583546+oandregal@users.noreply.github.com> Date: Thu, 7 Oct 2021 11:32:48 +0200 Subject: [PATCH 1/2] Enqueue preset classes for all themes in the editor --- lib/global-styles.php | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/lib/global-styles.php b/lib/global-styles.php index 469f4463eab296..4e7c10ee051bad 100644 --- a/lib/global-styles.php +++ b/lib/global-styles.php @@ -129,21 +129,13 @@ function_exists( 'gutenberg_is_edit_site_page' ) && if ( 'mobile' === $context ) { $settings['__experimentalStyles'] = $consolidated->get_raw_data()['styles']; - } - - if ( 'site-editor' === $context ) { + } elseif ( 'site-editor' === $context ) { $theme = WP_Theme_JSON_Resolver_Gutenberg::get_merged_data( $settings, 'theme' ); $user_cpt_id = WP_Theme_JSON_Resolver_Gutenberg::get_user_custom_post_type_id(); $settings['__experimentalGlobalStylesUserEntityId'] = $user_cpt_id; $settings['__experimentalGlobalStylesBaseStyles'] = $theme->get_raw_data(); - } - - if ( - 'site-editor' !== $context && - 'mobile' !== $context && - ( WP_Theme_JSON_Resolver_Gutenberg::theme_has_support() || get_theme_support( 'experimental-link-color' ) ) - ) { + } else { $block_styles = array( 'css' => gutenberg_experimental_global_styles_get_stylesheet( $consolidated, 'block_styles' ) ); $css_variables = array( 'css' => gutenberg_experimental_global_styles_get_stylesheet( $consolidated, 'css_variables' ), From e265764edea0d31151a831d2c2907edbff8d9400 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9?= <583546+oandregal@users.noreply.github.com> Date: Thu, 7 Oct 2021 18:10:56 +0200 Subject: [PATCH 2/2] Clean up --- lib/global-styles.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/global-styles.php b/lib/global-styles.php index 4e7c10ee051bad..8354bb2733edb0 100644 --- a/lib/global-styles.php +++ b/lib/global-styles.php @@ -129,13 +129,17 @@ function_exists( 'gutenberg_is_edit_site_page' ) && if ( 'mobile' === $context ) { $settings['__experimentalStyles'] = $consolidated->get_raw_data()['styles']; - } elseif ( 'site-editor' === $context ) { + } + + if ( 'site-editor' === $context ) { $theme = WP_Theme_JSON_Resolver_Gutenberg::get_merged_data( $settings, 'theme' ); $user_cpt_id = WP_Theme_JSON_Resolver_Gutenberg::get_user_custom_post_type_id(); $settings['__experimentalGlobalStylesUserEntityId'] = $user_cpt_id; $settings['__experimentalGlobalStylesBaseStyles'] = $theme->get_raw_data(); - } else { + } + + if ( 'all' === $context ) { $block_styles = array( 'css' => gutenberg_experimental_global_styles_get_stylesheet( $consolidated, 'block_styles' ) ); $css_variables = array( 'css' => gutenberg_experimental_global_styles_get_stylesheet( $consolidated, 'css_variables' ),