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
This commit is contained in:
Sergey Biryukov 2021-07-09 10:50:56 +00:00
parent 8222719bc9
commit eb9d31bb11
3 changed files with 19 additions and 13 deletions

View File

@ -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() ) {

View File

@ -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.

View File

@ -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'
);