From 3697386083b3739bb5ad482a36c648b9a67bf7ff Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Thu, 1 Apr 2021 11:46:09 +0000 Subject: [PATCH] Editor: Consolidate enqueueing block editor assets in `wp-includes/default-filters.php`. Follow-up to [44157], [46111], [48537], [50620]. See #52920. Built from https://develop.svn.wordpress.org/trunk@50629 git-svn-id: http://core.svn.wordpress.org/trunk@50241 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/default-filters.php | 10 +++++----- wp-includes/script-loader.php | 20 ++++++++++---------- wp-includes/version.php | 2 +- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/wp-includes/default-filters.php b/wp-includes/default-filters.php index 29a77af00d..9df2bad2c3 100644 --- a/wp-includes/default-filters.php +++ b/wp-includes/default-filters.php @@ -534,19 +534,19 @@ add_action( 'wp_default_scripts', 'wp_default_scripts' ); add_action( 'wp_default_scripts', 'wp_default_packages' ); add_action( 'wp_enqueue_scripts', 'wp_localize_jquery_ui_datepicker', 1000 ); -add_action( 'admin_enqueue_scripts', 'wp_localize_jquery_ui_datepicker', 1000 ); add_action( 'wp_enqueue_scripts', 'wp_common_block_scripts_and_styles' ); +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_editor_assets', 'wp_enqueue_editor_format_library_assets' ); +add_action( 'enqueue_block_assets', 'enqueue_block_styles_assets', 30 ); 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' ); add_action( 'admin_print_scripts-index.php', 'wp_localize_community_events' ); add_filter( 'wp_print_scripts', 'wp_just_in_time_script_localization' ); add_filter( 'print_scripts_array', 'wp_prototype_before_jquery' ); add_filter( 'customize_controls_print_styles', 'wp_resource_hints', 1 ); -add_action( 'enqueue_block_assets', 'enqueue_block_styles_assets', 30 ); -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( 'wp_default_styles', 'wp_default_styles' ); add_filter( 'style_loader_src', 'wp_style_loader_src', 10, 2 ); diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php index 62bbda090c..2d18f87415 100644 --- a/wp-includes/script-loader.php +++ b/wp-includes/script-loader.php @@ -2323,16 +2323,6 @@ function enqueue_editor_block_styles_assets() { wp_enqueue_script( 'wp-block-styles' ); } -/** - * Enqueues the assets required for the format library within the block editor. - * - * @since 5.8.0 - */ -function wp_enqueue_editor_format_library_assets() { - wp_enqueue_script( 'wp-format-library' ); - wp_enqueue_style( 'wp-format-library' ); -} - /** * Enqueues the assets required for the block directory within the block editor. * @@ -2343,6 +2333,16 @@ function wp_enqueue_editor_block_directory_assets() { wp_enqueue_style( 'wp-block-directory' ); } +/** + * Enqueues the assets required for the format library within the block editor. + * + * @since 5.8.0 + */ +function wp_enqueue_editor_format_library_assets() { + wp_enqueue_script( 'wp-format-library' ); + wp_enqueue_style( 'wp-format-library' ); +} + /** * Sanitizes an attributes array into an attributes string to be placed inside a `