From 507c998eaccefc817d54d2202035f93794141bac Mon Sep 17 00:00:00 2001 From: Robert Anderson Date: Fri, 29 Jan 2021 04:57:49 +0000 Subject: [PATCH] Block Editor: Add defaultEditorStyles The `defaultEditorStyles` setting was missing from the default block editor settings. This causes the "Use theme styles" setting which was added in WordPress 5.6 to not function properly. Also, the RTL version of editor styles were not being loaded. This change has not yet been ported over from Gutenberg. Fixes #52394. git-svn-id: https://develop.svn.wordpress.org/trunk@50069 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/edit-form-blocks.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/wp-admin/edit-form-blocks.php b/src/wp-admin/edit-form-blocks.php index 03f80700ba..b31ff7eb3b 100644 --- a/src/wp-admin/edit-form-blocks.php +++ b/src/wp-admin/edit-form-blocks.php @@ -185,7 +185,9 @@ if ( ! $max_upload_size ) { $styles = array( array( 'css' => file_get_contents( - ABSPATH . WPINC . '/css/dist/editor/editor-styles.css' + is_rtl() + ? ABSPATH . WPINC . '/css/dist/editor/editor-styles-rtl.css' + : ABSPATH . WPINC . '/css/dist/editor/editor-styles.css' ), ), ); @@ -217,6 +219,17 @@ if ( $editor_styles && current_theme_supports( 'editor-styles' ) ) { } } +// Default editor styles. +$default_editor_styles = array( + array( + 'css' => file_get_contents( + is_rtl() + ? ABSPATH . WPINC . '/css/dist/editor/editor-styles-rtl.css' + : ABSPATH . WPINC . '/css/dist/editor/editor-styles.css' + ), + ), +); + // Image sizes. /** This filter is documented in wp-admin/includes/media.php */ @@ -309,6 +322,7 @@ $editor_settings = array( 'maxUploadFileSize' => $max_upload_size, 'allowedMimeTypes' => get_allowed_mime_types(), 'styles' => $styles, + 'defaultEditorStyles' => $default_editor_styles, 'imageSizes' => $available_image_sizes, 'imageDimensions' => $image_dimensions, 'richEditingEnabled' => user_can_richedit(),