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
This commit is contained in:
Robert Anderson
2021-01-29 04:57:49 +00:00
parent 8aabbb6286
commit 507c998eac

View File

@@ -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(),