Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Assign window.wp.oldEditor properties to window.wp.editor
  • Loading branch information
adamziel committed Jul 7, 2021
commit 8b991ea860270e9db61ccac877522e80f284473f
12 changes: 11 additions & 1 deletion src/wp-includes/script-loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
/** WordPress Styles Class */
require ABSPATH . WPINC . '/class.wp-styles.php';

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

/**
Expand Down Expand Up @@ -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'
);
}

/**
Expand Down