mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2025-10-16 12:05:38 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@51387 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
6bd5962c7d
commit
5d9c398669
@ -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'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user