Make WordPress Core


Ignore:
Timestamp:
03/14/2023 03:58:34 PM (13 months ago)
Author:
SergeyBiryukov
Message:

Editor: Correctly load RTL stylesheets for non-core blocks.

If SCRIPT_DEBUG is disabled, register_block_style_handle() loads core blocks' styles with the .min suffix, while non-core ones never use the minified files, but the suffix was still mistakenly included in the -rtl file lookup.

This commit updates the logic to match the style path set earlier in the function, ensuring that RTL stylesheets are loaded properly for both core and non-core blocks, with or without SCRIPT_DEBUG.

Follow-up to [49982], [50836], [54330], [55486].

Props david.binda.
Fixes #57903.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/blocks.php

    r55447 r55544  
    261261        wp_style_add_data( $style_handle, 'path', $style_path_norm );
    262262
    263         $rtl_file = str_replace( "{$suffix}.css", "-rtl{$suffix}.css", $style_path_norm );
     263        if ( $is_core_block ) {
     264            $rtl_file = str_replace( "{$suffix}.css", "-rtl{$suffix}.css", $style_path_norm );
     265        } else {
     266            $rtl_file = str_replace( ".css", "-rtl.css", $style_path_norm );
     267        }
    264268
    265269        if ( is_rtl() && file_exists( $rtl_file ) ) {
Note: See TracChangeset for help on using the changeset viewer.