mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 14:20:15 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@55544 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -260,7 +260,11 @@ function register_block_style_handle( $metadata, $field_name, $index = 0 ) {
|
||||
if ( $has_style_file ) {
|
||||
wp_style_add_data( $style_handle, 'path', $style_path_norm );
|
||||
|
||||
$rtl_file = str_replace( "{$suffix}.css", "-rtl{$suffix}.css", $style_path_norm );
|
||||
if ( $is_core_block ) {
|
||||
$rtl_file = str_replace( "{$suffix}.css", "-rtl{$suffix}.css", $style_path_norm );
|
||||
} else {
|
||||
$rtl_file = str_replace( ".css", "-rtl.css", $style_path_norm );
|
||||
}
|
||||
|
||||
if ( is_rtl() && file_exists( $rtl_file ) ) {
|
||||
wp_style_add_data( $style_handle, 'rtl', 'replace' );
|
||||
|
||||
Reference in New Issue
Block a user