Block Editor: Load the classic layout stylesheet conditionallty.

Historically, the block editor has been opinionated about the size of the canvas and the alignments.
Themes with theme.json will have to define a "layout" in their settings and the classic stylesheet won't be loaded anymore for this.

Props nosolosw.
See #53175.


git-svn-id: https://develop.svn.wordpress.org/trunk@50992 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Riad Benguella
2021-05-25 07:39:30 +00:00
parent b31d07e05e
commit 5f1cf9db57

View File

@@ -1510,12 +1510,13 @@ function wp_default_styles( $styles ) {
'wp-reset-editor-styles',
'wp-block-library',
'wp-reusable-blocks',
// This dependency shouldn't be added for themes with theme.json support
// It's here for backward compatibility only.
// A check should be added here when theme.json is backported to Core.
'wp-editor-classic-layout-styles',
);
// Only load the default layout and margin styles for themes without theme.json file.
if ( ! WP_Theme_JSON_Resolver::theme_has_support() ) {
$wp_edit_blocks_dependencies[] = 'wp-editor-classic-layout-styles';
}
global $editor_styles;
if ( ! is_array( $editor_styles ) || count( $editor_styles ) === 0 ) {
// Include opinionated block styles if no $editor_styles are declared, so the editor never appears broken.