diff --git a/lib/global-styles.php b/lib/global-styles.php index e33f79bb758b8a..63617bd1ca433b 100644 --- a/lib/global-styles.php +++ b/lib/global-styles.php @@ -131,10 +131,14 @@ function_exists( 'gutenberg_is_edit_site_page' ) && } if ( 'other' === $context ) { - $block_styles = array( 'css' => gutenberg_experimental_global_styles_get_stylesheet( $consolidated, 'block_styles' ) ); + $block_styles = array( + 'css' => gutenberg_experimental_global_styles_get_stylesheet( $consolidated, 'block_styles' ), + 'toSkip' => true, + ); $css_variables = array( 'css' => gutenberg_experimental_global_styles_get_stylesheet( $consolidated, 'css_variables' ), '__experimentalNoWrapper' => true, + 'toSkip' => true, ); // Make sure the styles array exists. diff --git a/packages/edit-post/src/editor.js b/packages/edit-post/src/editor.js index c35519b7617312..00b5f5008a1d6d 100644 --- a/packages/edit-post/src/editor.js +++ b/packages/edit-post/src/editor.js @@ -161,7 +161,10 @@ function Editor( { ] ); const styles = useMemo( () => { - return hasThemeStyles && settings.styles?.length + // settings.styles can have styles that core adds. + // We don't want these to count as "theme styles". + const filteredStyles = settings.styles?.length ? settings.styles.filter( style => ! style.toSkip ) : []; + return hasThemeStyles && filteredStyles.length ? settings.styles : settings.defaultEditorStyles; }, [ settings, hasThemeStyles ] );