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.

Props zieladam, spacedmonkey, TimothyBlynJacobs, andraganescu, noisysocks.
Merges [51387] to the 5.8 branch.
See #53437.
Built from https://develop.svn.wordpress.org/branches/5.8@51392


git-svn-id: http://core.svn.wordpress.org/branches/5.8@51003 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
desrosj 2021-07-09 17:54:57 +00:00
parent dda2b793fe
commit 5962e1f19f
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.8-RC2-51386';
$wp_version = '5.8-RC2-51392';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.