Skip to content

Commit a8b1210

Browse files
committed
Assign window.wp.oldEditor properties to window.wp.editor
1 parent cd65bc6 commit a8b1210

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/wp-includes/script-loader.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
/** WordPress Styles Class */
3232
require ABSPATH . WPINC . '/class.wp-styles.php';
3333

34-
/** WordPress Styles Functions */
34+
/** WordPress Styles Function */
3535
require ABSPATH . WPINC . '/functions.wp-styles.php';
3636

3737
/**
@@ -396,6 +396,16 @@ function wp_default_packages_inline_scripts( $scripts ) {
396396
'window.wp.oldEditor = window.wp.editor;',
397397
'after'
398398
);
399+
400+
// wp-editor module is exposed as window.wp.editor
401+
// Problem: there is quite some code expecting window.wp.oldEditor object available under window.wp.editor
402+
// Solution: fuse the two objects together to maintain backward compatibility
403+
// For more context, see https://github.com/WordPress/gutenberg/issues/33203
404+
$scripts->add_inline_script(
405+
'wp-editor',
406+
'Object.assign(window.wp.editor, window.wp.oldEditor);',
407+
'after'
408+
);
399409
}
400410

401411
/**

0 commit comments

Comments
 (0)