Skip to content
Merged
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
Prev Previous commit
Next Next commit
Default to an empty object on export from oldEditor
  • Loading branch information
adamziel committed Jul 8, 2021
commit 8d4a984cac919c5241136b941b11a436284ec9f0
9 changes: 2 additions & 7 deletions packages/editor/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,8 @@ export * from './utils';
// Problem: there is quite some code expecting another, legacy object available under window.wp.editor
// Solution: export all the members of legacy window.wp.editor from this new module to maintain backward compatibility
// For more context, see https://github.com/WordPress/gutenberg/issues/33203
export const {
autop,
removep,
initialize,
remove,
getContent,
} = window?.wp?.oldEditor;
export const { autop, removep, initialize, remove, getContent } =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't even know this is valid JS 🤯

window?.wp?.oldEditor || {};

/*
* Backward compatibility
Expand Down