Editor: Merge conflicting wp.editor objects into single, non-conflicting object

The `wp-editor` script (`@wordpress/editor` npm package) is exposed as
`window.wp.editor` in WP Admin.  This causes problems, though, as many older
scripts expect to see the older `editor` script available at `window.wp.editor`.

The solution is to export all the members of the older `window.wp.editor` module
in the newer module to maintain backwards compatibility.

See #53437.
Props zieladam, spacedmonkey, TimothyBlynJacobs, andraganescu.

Built from https://develop.svn.wordpress.org/trunk@51387


git-svn-id: http://core.svn.wordpress.org/trunk@50998 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
noisysocks 2021-07-09 01:10:57 +00:00
parent d05e5232b7
commit c57e6f00fe
2 changed files with 11 additions and 1 deletions

View File

@ -381,6 +381,16 @@ function wp_default_packages_inline_scripts( $scripts ) {
'window.wp.oldEditor = window.wp.editor;',
'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
$scripts->add_inline_script(
'wp-editor',
'Object.assign( window.wp.editor, window.wp.oldEditor );',
'after'
);
}
/**

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.9-alpha-51383';
$wp_version = '5.9-alpha-51387';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.