From 028fba9c17c77926913dedcb322f05d434c50943 Mon Sep 17 00:00:00 2001 From: Ari Stathopoulos Date: Mon, 18 Jan 2021 11:34:34 +0200 Subject: [PATCH] Change the way RTL styles get enqueued --- lib/blocks.php | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/lib/blocks.php b/lib/blocks.php index f4f5a6536cee2a..4012e9784ca165 100644 --- a/lib/blocks.php +++ b/lib/blocks.php @@ -164,29 +164,27 @@ function gutenberg_register_core_block_styles( $block_name ) { $block_name = str_replace( 'core/', '', $block_name ); - $style_path = is_rtl() - ? "build/block-library/blocks/$block_name/style-rtl.css" - : "build/block-library/blocks/$block_name/style.css"; - $editor_style_path = is_rtl() - ? "build/block-library/blocks/$block_name/style-editor-rtl.css" - : "build/block-library/blocks/$block_name/style-editor.css"; + $style_path = "build/block-library/blocks/$block_name/style.css"; + $editor_style_path = "build/block-library/blocks/$block_name/style-editor.css"; if ( file_exists( gutenberg_dir_path() . $style_path ) ) { wp_register_style( - 'wp-block-' . $block_name, + "wp-block-{$block_name}", gutenberg_url( $style_path ), array(), filemtime( gutenberg_dir_path() . $style_path ) ); + wp_style_add_data( "wp-block-{$block_name}", 'rtl', 'replace' ); } if ( file_exists( gutenberg_dir_path() . $editor_style_path ) ) { wp_register_style( - 'wp-block-' . $block_name . '-editor', + "wp-block-{$block_name}-editor", gutenberg_url( $editor_style_path ), array(), filemtime( gutenberg_dir_path() . $editor_style_path ) ); + wp_style_add_data( "wp-block-{$block_name}-editor", 'rtl', 'replace' ); } }