From 7311e69b595651825905ca4306f1abf3b97d3d73 Mon Sep 17 00:00:00 2001 From: oandregal Date: Wed, 24 May 2023 09:24:23 +0000 Subject: [PATCH] Loading assets for the editor: Revert [55695]. The changeset [55695] introduced a regression in the order of styles for the editor, causing the styles registered for the block (both editor and front) to be loaded after any other styles enqueued using the `enqueue_block_editor_assets` hook. Since the original behavior was introduced in WordPress 5.0 changing it breaks the expectations of the ecosystem. Props ellatrix. Fixes #58208. Built from https://develop.svn.wordpress.org/trunk@55852 git-svn-id: http://core.svn.wordpress.org/trunk@55364 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/default-filters.php | 14 ++++++++++++++ wp-includes/version.php | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/wp-includes/default-filters.php b/wp-includes/default-filters.php index 82b579913a..063199269c 100644 --- a/wp-includes/default-filters.php +++ b/wp-includes/default-filters.php @@ -571,6 +571,20 @@ add_action( 'admin_enqueue_scripts', 'wp_localize_jquery_ui_datepicker', 1000 ); add_action( 'admin_enqueue_scripts', 'wp_common_block_scripts_and_styles' ); add_action( 'enqueue_block_assets', 'wp_enqueue_registered_block_scripts_and_styles' ); add_action( 'enqueue_block_assets', 'enqueue_block_styles_assets', 30 ); +/* + * `wp_enqueue_registered_block_scripts_and_styles` is bound to both + * `enqueue_block_editor_assets` and `enqueue_block_assets` hooks + * since the introduction of the block editor in WordPress 5.0. + * + * The way this works is that the block assets are loaded before any other assets. + * For example, this is the order of styles for the editor: + * + * - front styles registered for blocks, via `styles` handle (block.json) + * - editor styles registered for blocks, via `editorStyles` handle (block.json) + * - editor styles enqueued via `enqueue_block_editor_assets` hook + * - front styles enqueued via `enqueue_block_assets` hook + */ +add_action( 'enqueue_block_editor_assets', 'wp_enqueue_registered_block_scripts_and_styles' ); add_action( 'enqueue_block_editor_assets', 'enqueue_editor_block_styles_assets' ); add_action( 'enqueue_block_editor_assets', 'wp_enqueue_editor_block_directory_assets' ); add_action( 'enqueue_block_editor_assets', 'wp_enqueue_editor_format_library_assets' ); diff --git a/wp-includes/version.php b/wp-includes/version.php index 14e0ad7b47..85543dcc37 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.3-alpha-55851'; +$wp_version = '6.3-alpha-55852'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.