mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-04 18:01:42 +01:00
Editor: Correctly load RTL stylesheets in register_block_style_handle()
.
When setting an RTL language under Settings → General, some RTL stylesheets were not loaded, with LTR stylesheets being loaded instead, meaning that some blocks were not displayed correctly. This commit ensures that all appropriate RTL stylesheets are loaded when selecting an RTL language. Additionally, this commit improves performance by only running a `file_exists()` check for an RTL stylesheet if `is_rtl()` returns true, i.e. an RTL locale is selected. Follow-up to [49982], [50836]. Props zoonini, sabernhardt, maahrokh, ankit-k-gupta, aristath, poena, SergeyBiryukov. See #56325. Built from https://develop.svn.wordpress.org/trunk@54330 git-svn-id: http://core.svn.wordpress.org/trunk@53889 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
abf66fa018
commit
12b190eb17
@ -251,14 +251,13 @@ function register_block_style_handle( $metadata, $field_name, $index = 0 ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( $has_style_file ) {
|
if ( $has_style_file ) {
|
||||||
if ( file_exists( str_replace( '.css', '-rtl.css', $style_path_norm ) ) ) {
|
|
||||||
wp_style_add_data( $style_handle, 'rtl', 'replace' );
|
|
||||||
}
|
|
||||||
|
|
||||||
wp_style_add_data( $style_handle, 'path', $style_path_norm );
|
wp_style_add_data( $style_handle, 'path', $style_path_norm );
|
||||||
|
|
||||||
$rtl_file = str_replace( "{$suffix}.css", "-rtl{$suffix}.css", $style_path_norm );
|
$rtl_file = str_replace( "{$suffix}.css", "-rtl{$suffix}.css", $style_path_norm );
|
||||||
|
|
||||||
if ( is_rtl() && file_exists( $rtl_file ) ) {
|
if ( is_rtl() && file_exists( $rtl_file ) ) {
|
||||||
|
wp_style_add_data( $style_handle, 'rtl', 'replace' );
|
||||||
|
wp_style_add_data( $style_handle, 'suffix', $suffix );
|
||||||
wp_style_add_data( $style_handle, 'path', $rtl_file );
|
wp_style_add_data( $style_handle, 'path', $rtl_file );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '6.1-beta1-54329';
|
$wp_version = '6.1-beta1-54330';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
Loading…
Reference in New Issue
Block a user