From eb9d31bb11b9142c9d8b3b717b3b526fa9f53470 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Fri, 9 Jul 2021 10:50:56 +0000 Subject: [PATCH] Docs: Some documentation improvements for `wp_check_widget_editor_deps()`: * Add missing short description for the function. * Correct function names in `_doing_it_wrong()` calls. * Document the usage of `$wp_scripts` and `$wp_styles` globals. * Update syntax for multi-line comment per the documentation standards. Follow-up to [51387], [51388]. See #53437, #53569. Built from https://develop.svn.wordpress.org/trunk@51390 git-svn-id: http://core.svn.wordpress.org/trunk@51001 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/script-loader.php | 12 ++++++------ wp-includes/version.php | 2 +- wp-includes/widgets.php | 18 ++++++++++++------ 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php index b870e87a8f..a1392d469d 100644 --- a/wp-includes/script-loader.php +++ b/wp-includes/script-loader.php @@ -382,10 +382,12 @@ function wp_default_packages_inline_scripts( $scripts ) { 'after' ); - // wp-editor module is exposed as window.wp.editor - // Problem: there is quite some code expecting window.wp.oldEditor object available under window.wp.editor - // Solution: fuse the two objects together to maintain backward compatibility - // For more context, see https://github.com/WordPress/gutenberg/issues/33203 + /* + * wp-editor module is exposed as window.wp.editor. + * Problem: there is quite some code expecting window.wp.oldEditor object available under window.wp.editor. + * Solution: fuse the two objects together to maintain backward compatibility. + * For more context, see https://github.com/WordPress/gutenberg/issues/33203. + */ $scripts->add_inline_script( 'wp-editor', 'Object.assign( window.wp.editor, window.wp.oldEditor );', @@ -2269,8 +2271,6 @@ function wp_common_block_scripts_and_styles() { * Enqueues the global styles defined via theme.json. * * @since 5.8.0 - * - * @return void */ function wp_enqueue_global_styles() { if ( ! WP_Theme_JSON_Resolver::theme_has_support() ) { diff --git a/wp-includes/version.php b/wp-includes/version.php index aac5dddb93..a3e9234101 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.9-alpha-51389'; +$wp_version = '5.9-alpha-51390'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. diff --git a/wp-includes/widgets.php b/wp-includes/widgets.php index a092c00c7d..2d1eb5d8ef 100644 --- a/wp-includes/widgets.php +++ b/wp-includes/widgets.php @@ -2008,34 +2008,40 @@ function wp_render_widget_control( $id ) { } /** + * Displays a _doing_it_wrong() message for conflicting widget editor scripts. + * * The 'wp-editor' script module is exposed as window.wp.editor. This overrides * the legacy TinyMCE editor module which is required by the widgets editor. - * Because of that conflict, these two shouldn't be enqueued together. See - * https://core.trac.wordpress.org/ticket/53569. + * Because of that conflict, these two shouldn't be enqueued together. + * See https://core.trac.wordpress.org/ticket/53569. * * There is also another conflict related to styles where the block widgets - * editor is hidden if a block enqueues 'wp-edit-post' stylesheet. See - * https://core.trac.wordpress.org/ticket/53569. + * editor is hidden if a block enqueues 'wp-edit-post' stylesheet. + * See https://core.trac.wordpress.org/ticket/53569. * * @since 5.8.0 * @access private + * + * @global WP_Scripts $wp_scripts + * @global WP_Styles $wp_styles */ function wp_check_widget_editor_deps() { global $wp_scripts, $wp_styles; + if ( $wp_scripts->query( 'wp-edit-widgets', 'enqueued' ) || $wp_scripts->query( 'wp-customize-widgets', 'enqueued' ) ) { if ( $wp_scripts->query( 'wp-editor', 'enqueued' ) ) { _doing_it_wrong( - 'enqueue_script', + 'wp_enqueue_script()', '"wp-editor" script should not be enqueued together with the new widgets editor (wp-edit-widgets or wp-customize-widgets).', '5.8.0' ); } if ( $wp_styles->query( 'wp-edit-post', 'enqueued' ) ) { _doing_it_wrong( - 'enqueue_style', + 'wp_enqueue_style()', '"wp-edit-post" style should not be enqueued together with the new widgets editor (wp-edit-widgets or wp-customize-widgets).', '5.8.0' );