Skip to content

Commit

Permalink
Fix for themes with no editor styles
Browse files Browse the repository at this point in the history
  • Loading branch information
oandregal committed Oct 18, 2021
1 parent 9953bfc commit b5b101d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 5 additions & 1 deletion lib/global-styles.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 4 additions & 1 deletion packages/edit-post/src/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ] );
Expand Down

0 comments on commit b5b101d

Please sign in to comment.