diff --git a/src/static/js/ace.js b/src/static/js/ace.js
index 4a6c4060a..2255a7a9a 100644
--- a/src/static/js/ace.js
+++ b/src/static/js/ace.js
@@ -36,12 +36,8 @@ const scriptTag =
(source) => ``;
const Ace2Editor = function () {
- const ace2 = Ace2Editor;
-
- let info = {
- editor: this,
- id: (ace2.registry.nextId++),
- };
+ let info = {editor: this};
+ window.ace2EditorInfo = info; // Make it accessible to iframes.
let loaded = false;
let actionsPendingInit = [];
@@ -57,8 +53,6 @@ const Ace2Editor = function () {
actionsPendingInit = [];
};
- ace2.registry[info.id] = info;
-
// The following functions (prefixed by 'ace_') are exposed by editor, but
// execution is delayed until init is complete
const aceFunctionsPendingInit = [
@@ -152,7 +146,7 @@ const Ace2Editor = function () {
this.destroy = pendingInit(() => {
info.ace_dispose();
info.frame.parentNode.removeChild(info.frame);
- delete ace2.registry[info.id];
+ delete window.ace2EditorInfo;
info = null; // prevent IE 6 closure memory leaks
});
@@ -209,7 +203,10 @@ const Ace2Editor = function () {
window.$ = window.jQuery = require('ep_etherpad-lite/static/js/rjquery').jQuery;
- window.plugins.ensure(() => { window.Ace2Inner.init(parent.editorInfo, parent.readyFunc); });
+ window.plugins.ensure(() => {
+ const editorInfo = parent.parent.ace2EditorInfo;
+ window.Ace2Inner.init(editorInfo, editorInfo.onEditorReady);
+ });
})();`));
iframeHTML.push('');
@@ -221,12 +218,7 @@ const Ace2Editor = function () {
iframeHTML.push('