Twenty Twenty-One: Only enqueue block editor assets in the admin.

Follow-up to [56300].

Props sabernhardt, flixos90, luisherranz, gautam23, huzaifaalmesbah, mukesh27, r1k0, SergeyBiryukov.
Fixes #60111.
Built from https://develop.svn.wordpress.org/trunk@61471


git-svn-id: http://core.svn.wordpress.org/trunk@60783 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov
2026-01-11 21:49:48 +00:00
parent 964bcaf172
commit 8790001d3a
5 changed files with 39 additions and 35 deletions

View File

@@ -23,7 +23,9 @@ class Twenty_Twenty_One_Custom_Colors {
add_action( 'wp_enqueue_scripts', array( $this, 'custom_color_variables' ) );
// Enqueue color variables for editor.
add_action( 'enqueue_block_assets', array( $this, 'editor_custom_color_variables' ) );
if ( is_admin() ) {
add_action( 'enqueue_block_assets', array( $this, 'editor_custom_color_variables' ) );
}
// Add body-class if needed.
add_filter( 'body_class', array( $this, 'body_class' ) );

View File

@@ -20,7 +20,9 @@ class Twenty_Twenty_One_Dark_Mode {
public function __construct() {
// Enqueue assets for the block-editor.
add_action( 'enqueue_block_assets', array( $this, 'editor_custom_color_variables' ) );
if ( is_admin() ) {
add_action( 'enqueue_block_assets', array( $this, 'editor_custom_color_variables' ) );
}
// Add styles for dark-mode.
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );

View File

@@ -8,8 +8,8 @@
return array(
array(
'handle' => 'wp-preferences',
'path' => 'preferences/style',
'handle' => 'wp-list-reusable-blocks',
'path' => 'list-reusable-blocks/style',
'dependencies' => array('wp-components'),
),
array(
@@ -18,8 +18,13 @@ return array(
'dependencies' => array('wp-components'),
),
array(
'handle' => 'wp-list-reusable-blocks',
'path' => 'list-reusable-blocks/style',
'handle' => 'wp-preferences',
'path' => 'preferences/style',
'dependencies' => array('wp-components'),
),
array(
'handle' => 'wp-commands',
'path' => 'commands/style',
'dependencies' => array('wp-components'),
),
array(
@@ -32,26 +37,21 @@ return array(
'path' => 'patterns/style',
'dependencies' => array('wp-block-editor', 'wp-components'),
),
array(
'handle' => 'wp-commands',
'path' => 'commands/style',
'dependencies' => array('wp-components'),
),
array(
'handle' => 'wp-widgets',
'path' => 'widgets/style',
'dependencies' => array('wp-block-editor', 'wp-components'),
),
array(
'handle' => 'wp-format-library',
'path' => 'format-library/style',
'dependencies' => array('wp-block-editor', 'wp-components'),
),
array(
'handle' => 'wp-components',
'path' => 'components/style',
'dependencies' => array(),
),
array(
'handle' => 'wp-format-library',
'path' => 'format-library/style',
'dependencies' => array('wp-block-editor', 'wp-components'),
),
array(
'handle' => 'wp-block-directory',
'path' => 'block-directory/style',

View File

@@ -7,6 +7,21 @@
*/
return array(
array(
'id' => '@wordpress/latex-to-mathml',
'path' => 'latex-to-mathml/index',
'asset' => 'latex-to-mathml/index.min.asset.php',
),
array(
'id' => '@wordpress/latex-to-mathml/loader',
'path' => 'latex-to-mathml/loader',
'asset' => 'latex-to-mathml/loader.min.asset.php',
),
array(
'id' => '@wordpress/interactivity',
'path' => 'interactivity/index',
'asset' => 'interactivity/index.min.asset.php',
),
array(
'id' => '@wordpress/interactivity-router',
'path' => 'interactivity-router/index',
@@ -17,35 +32,20 @@ return array(
'path' => 'interactivity-router/full-page',
'asset' => 'interactivity-router/full-page.min.asset.php',
),
array(
'id' => '@wordpress/interactivity',
'path' => 'interactivity/index',
'asset' => 'interactivity/index.min.asset.php',
),
array(
'id' => '@wordpress/core-abilities',
'path' => 'core-abilities/index',
'asset' => 'core-abilities/index.min.asset.php',
),
array(
'id' => '@wordpress/a11y',
'path' => 'a11y/index',
'asset' => 'a11y/index.min.asset.php',
),
array(
'id' => '@wordpress/abilities',
'path' => 'abilities/index',
'asset' => 'abilities/index.min.asset.php',
),
array(
'id' => '@wordpress/latex-to-mathml',
'path' => 'latex-to-mathml/index',
'asset' => 'latex-to-mathml/index.min.asset.php',
),
array(
'id' => '@wordpress/latex-to-mathml/loader',
'path' => 'latex-to-mathml/loader',
'asset' => 'latex-to-mathml/loader.min.asset.php',
'id' => '@wordpress/a11y',
'path' => 'a11y/index',
'asset' => 'a11y/index.min.asset.php',
),
array(
'id' => '@wordpress/route',

View File

@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '7.0-alpha-61470';
$wp_version = '7.0-alpha-61471';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.