From c57e6f00fe237039e36448c668d20a161dd96e02 Mon Sep 17 00:00:00 2001 From: noisysocks Date: Fri, 9 Jul 2021 01:10:57 +0000 Subject: [PATCH] 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 --- wp-includes/script-loader.php | 10 ++++++++++ wp-includes/version.php | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php index 640d1c3f77..b870e87a8f 100644 --- a/wp-includes/script-loader.php +++ b/wp-includes/script-loader.php @@ -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' + ); } /** diff --git a/wp-includes/version.php b/wp-includes/version.php index f7361c1993..88132cc2f4 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -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.