mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-21 07:56:16 -04:00
Ace2Inner: Promisify init()
This commit is contained in:
parent
742a7cd430
commit
81e36cf3c7
2 changed files with 28 additions and 32 deletions
|
@ -307,8 +307,7 @@ const Ace2Editor = function () {
|
||||||
await new Promise((resolve, reject) => innerWindow.plugins.ensure(
|
await new Promise((resolve, reject) => innerWindow.plugins.ensure(
|
||||||
(err) => err != null ? reject(err) : resolve()));
|
(err) => err != null ? reject(err) : resolve()));
|
||||||
debugLog('Ace2Editor.init() waiting for Ace2Inner.init()');
|
debugLog('Ace2Editor.init() waiting for Ace2Inner.init()');
|
||||||
await new Promise((resolve, reject) => innerWindow.Ace2Inner.init(
|
await innerWindow.Ace2Inner.init(info);
|
||||||
info, (err) => err != null ? reject(err) : resolve()));
|
|
||||||
debugLog('Ace2Editor.init() Ace2Inner.init() returned');
|
debugLog('Ace2Editor.init() Ace2Inner.init() returned');
|
||||||
loaded = true;
|
loaded = true;
|
||||||
doActionsPendingInit();
|
doActionsPendingInit();
|
||||||
|
|
|
@ -3895,8 +3895,8 @@ function Ace2Inner(editorInfo) {
|
||||||
editorInfo.ace_performDocumentApplyAttributesToRange =
|
editorInfo.ace_performDocumentApplyAttributesToRange =
|
||||||
(...args) => documentAttributeManager.setAttributesOnRange(...args);
|
(...args) => documentAttributeManager.setAttributesOnRange(...args);
|
||||||
|
|
||||||
this.init = (cb) => {
|
this.init = async () => {
|
||||||
$(document).ready(() => {
|
await $.ready;
|
||||||
doc = document; // defined as a var in scope outside
|
doc = document; // defined as a var in scope outside
|
||||||
inCallStack('setup', () => {
|
inCallStack('setup', () => {
|
||||||
const body = doc.getElementById('innerdocbody');
|
const body = doc.getElementById('innerdocbody');
|
||||||
|
@ -3926,13 +3926,10 @@ function Ace2Inner(editorInfo) {
|
||||||
rep,
|
rep,
|
||||||
documentAttributeManager,
|
documentAttributeManager,
|
||||||
});
|
});
|
||||||
|
|
||||||
scheduler.setTimeout(cb, 0);
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.init = (editorInfo, cb) => {
|
exports.init = async (editorInfo) => {
|
||||||
const editor = new Ace2Inner(editorInfo);
|
const editor = new Ace2Inner(editorInfo);
|
||||||
editor.init(cb);
|
await editor.init();
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue