Skip to content

Commit

Permalink
Editor: Update enqueued styles in the editor.
Browse files Browse the repository at this point in the history
Updates the enqueued styles in various editors to remove target styles more precisely to where they are needed.

Removes the following stylesheets as dependencies of `wp-edit-blocks`:

* `wp-editor`
* `wp-reusable-blocks`
* `wp-patterns`

The `wp-editor` stylesheet is targeted to the items requiring the CSS:

* `edit-widgets`
* `customize-widgets`
* `edit-site`

Props ellatrix, youknowriad.
Fixes #62266, #62274.


git-svn-id: https://develop.svn.wordpress.org/trunk@59793 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
peterwilsoncc committed Feb 9, 2025
1 parent 3205934 commit 67bc44b
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/wp-includes/script-loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -1680,18 +1680,16 @@ function wp_default_styles( $styles ) {
array( 'wp-components' )
);

// Only add CONTENT styles here that should be enqueued in the iframe!
$wp_edit_blocks_dependencies = array(
'wp-components',
'wp-editor',
/*
* This needs to be added before the block library styles,
* The block library styles override the "reset" styles.
*/
'wp-reset-editor-styles',
'wp-block-library',
'wp-reusable-blocks',
'wp-block-editor-content',
'wp-patterns',
);

// Only load the default layout and margin styles for themes without theme.json file.
Expand Down Expand Up @@ -1750,24 +1748,25 @@ function wp_default_styles( $styles ) {
'edit-widgets' => array(
'wp-widgets',
'wp-block-editor',
'wp-editor',
'wp-edit-blocks',
'wp-block-library',
'wp-reusable-blocks',
'wp-patterns',
'wp-preferences',
),
'customize-widgets' => array(
'wp-widgets',
'wp-block-editor',
'wp-editor',
'wp-edit-blocks',
'wp-block-library',
'wp-reusable-blocks',
'wp-patterns',
'wp-preferences',
),
'edit-site' => array(
'wp-components',
'wp-block-editor',
'wp-editor',
'wp-edit-blocks',
'wp-commands',
'wp-preferences',
Expand Down

0 comments on commit 67bc44b

Please sign in to comment.