Skip to content

Commit

Permalink
The CSS Custom Properties for the presets need to be in editor settin…
Browse files Browse the repository at this point in the history
…gs (#37296)

The reason is that there's a couple of places in which we render
styles coming from the block editor settings in a iframe
(media query previews, block patterns).
  • Loading branch information
oandregal authored Dec 12, 2021
1 parent 2e04e26 commit 23543d1
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions lib/global-styles.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,19 +72,27 @@ function_exists( 'gutenberg_is_edit_site_page' ) &&

$new_global_styles = array();

$style_css = wp_get_global_stylesheet( array( 'presets' ) );
if ( '' !== $style_css ) {
$css_variables = wp_get_global_stylesheet( array( 'variables' ) );
if ( '' !== $css_variables ) {
$new_global_styles[] = array(
'css' => $style_css,
'css' => $css_variables,
'__unstableType' => 'presets',
);
}

$css_presets = wp_get_global_stylesheet( array( 'presets' ) );
if ( '' !== $css_presets ) {
$new_global_styles[] = array(
'css' => $css_presets,
'__unstableType' => 'presets',
);
}

if ( WP_Theme_JSON_Resolver_Gutenberg::theme_has_support() ) {
$style_css = wp_get_global_stylesheet( array( 'styles' ) );
if ( '' !== $style_css ) {
$css_blocks = wp_get_global_stylesheet( array( 'styles' ) );
if ( '' !== $css_blocks ) {
$new_global_styles[] = array(
'css' => $style_css,
'css' => $css_blocks,
'__unstableType' => 'theme',
);
}
Expand Down

0 comments on commit 23543d1

Please sign in to comment.