Skip to content

Commit

Permalink
Editor: Separate content styles for iframe in __wp_get_iframed_editor…
Browse files Browse the repository at this point in the history
…_assets() and wp_default_styles().

This changeset:
* Removes the `'wp-block-editor'` and `'wp-block-library'` from the iframe's stylesheet collection (i.e. `_wp_get_iframed_editor_assets()`).
* Adds the new `'wp-block-editor-content'` for the separate stylesheet to the list of editor (`'wp-edit-blocks'`) dependencies.

Why?

These PHP changes are part of the initiative to:

* Separate the content styles contained in the block editor package into a separate stylesheet.
* Avoid loading all block editor styles into the iframe.

References:
* [WordPress/gutenberg#44298 Gutenberg PR 44298].

Follow-up to [53160], [50761].

Props ellatrix, youknowriad.
Fixes #57550.
Built from https://develop.svn.wordpress.org/trunk@55179


git-svn-id: http://core.svn.wordpress.org/trunk@54712 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
hellofromtonya committed Feb 1, 2023
1 parent 7334d79 commit b0521ea
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 0 additions & 2 deletions wp-includes/block-editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,6 @@ function _wp_get_iframed_editor_assets() {

$script_handles = array();
$style_handles = array(
'wp-block-editor',
'wp-block-library',
'wp-edit-blocks',
);

Expand Down
7 changes: 7 additions & 0 deletions wp-includes/script-loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -1609,6 +1609,12 @@ function wp_default_styles( $styles ) {
array()
);

$styles->add(
'wp-block-editor-content',
"/wp-includes/css/dist/block-editor/content$suffix.css",
array()
);

$wp_edit_blocks_dependencies = array(
'wp-components',
'wp-editor',
Expand All @@ -1617,6 +1623,7 @@ function wp_default_styles( $styles ) {
'wp-reset-editor-styles',
'wp-block-library',
'wp-reusable-blocks',
'wp-block-editor-content',
);

// Only load the default layout and margin styles for themes without theme.json file.
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/version.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.2-alpha-55178';
$wp_version = '6.2-alpha-55179';

/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
Expand Down

0 comments on commit b0521ea

Please sign in to comment.