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:
parent
d05e5232b7
commit
c57e6f00fe
|
@ -381,6 +381,16 @@ function wp_default_packages_inline_scripts( $scripts ) {
|
||||||
'window.wp.oldEditor = window.wp.editor;',
|
'window.wp.oldEditor = window.wp.editor;',
|
||||||
'after'
|
'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'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @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.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue