Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try: make logic for conditional editor_styles consistent #45351

Closed
wants to merge 12 commits into from
18 changes: 8 additions & 10 deletions lib/client-assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,14 @@ function gutenberg_register_packages_styles( $styles ) {
global $editor_styles;
if ( current_theme_supports( 'wp-block-styles' ) && ( ! is_array( $editor_styles ) || count( $editor_styles ) === 0 ) ) {
// Include opinionated block styles if the theme supports block styles and no $editor_styles are declared, so the editor never appears broken.
$wp_edit_blocks_dependencies[] = 'wp-block-library-theme';
gutenberg_override_style(
$styles,
'wp-block-library-theme',
gutenberg_url( 'build/block-library/theme.css' ),
$wp_edit_blocks_dependencies,
$version
);
$styles->add_data( 'wp-block-library-theme', 'rtl', 'replace' );
}

gutenberg_override_style(
Expand Down Expand Up @@ -364,15 +371,6 @@ function gutenberg_register_packages_styles( $styles ) {
);
$styles->add_data( 'wp-nux', 'rtl', 'replace' );

gutenberg_override_style(
$styles,
'wp-block-library-theme',
gutenberg_url( 'build/block-library/theme.css' ),
array(),
$version
);
$styles->add_data( 'wp-block-library-theme', 'rtl', 'replace' );

gutenberg_override_style(
$styles,
'wp-list-reusable-blocks',
Expand Down
2 changes: 1 addition & 1 deletion lib/compat/wordpress-6.1/template-parts-screen.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ static function( $classes ) {
wp_enqueue_media();

if (
current_theme_supports( 'wp-block-styles' ) ||
current_theme_supports( 'wp-block-styles' ) &&
mikachan marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be updated in Core in wp-admin/site-editor.php.

( ! is_array( $editor_styles ) || count( $editor_styles ) === 0 )
) {
wp_enqueue_style( 'wp-block-library-theme' );
Expand Down