mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-21 07:56:16 -04:00
pad_editor: Promisify init()
This commit is contained in:
parent
81e36cf3c7
commit
e2bfe2fd10
2 changed files with 11 additions and 21 deletions
|
@ -501,7 +501,7 @@ const pad = {
|
||||||
// order of inits is important here:
|
// order of inits is important here:
|
||||||
padimpexp.init(this);
|
padimpexp.init(this);
|
||||||
padsavedrevs.init(this);
|
padsavedrevs.init(this);
|
||||||
padeditor.init(postAceInit, pad.padOptions.view || {}, this);
|
padeditor.init(pad.padOptions.view || {}, this).then(postAceInit);
|
||||||
paduserlist.init(pad.myUserInfo, this);
|
paduserlist.init(pad.myUserInfo, this);
|
||||||
padconnectionstatus.init();
|
padconnectionstatus.init();
|
||||||
padmodals.init(this);
|
padmodals.init(this);
|
||||||
|
|
|
@ -34,30 +34,20 @@ const padeditor = (() => {
|
||||||
ace: null,
|
ace: null,
|
||||||
// this is accessed directly from other files
|
// this is accessed directly from other files
|
||||||
viewZoom: 100,
|
viewZoom: 100,
|
||||||
init: (readyFunc, initialViewOptions, _pad) => {
|
init: async (initialViewOptions, _pad) => {
|
||||||
Ace2Editor = require('./ace').Ace2Editor;
|
Ace2Editor = require('./ace').Ace2Editor;
|
||||||
pad = _pad;
|
pad = _pad;
|
||||||
settings = pad.settings;
|
settings = pad.settings;
|
||||||
|
self.ace = new Ace2Editor();
|
||||||
const aceReady = () => {
|
await self.ace.init('editorcontainer', '');
|
||||||
$('#editorloadingbox').hide();
|
$('#editorloadingbox').hide();
|
||||||
if (readyFunc) {
|
|
||||||
readyFunc();
|
|
||||||
|
|
||||||
// Listen for clicks on sidediv items
|
// Listen for clicks on sidediv items
|
||||||
const $outerdoc = $('iframe[name="ace_outer"]').contents().find('#outerdocbody');
|
const $outerdoc = $('iframe[name="ace_outer"]').contents().find('#outerdocbody');
|
||||||
$outerdoc.find('#sidedivinner').on('click', 'div', function () {
|
$outerdoc.find('#sidedivinner').on('click', 'div', function () {
|
||||||
const targetLineNumber = $(this).index() + 1;
|
const targetLineNumber = $(this).index() + 1;
|
||||||
window.location.hash = `L${targetLineNumber}`;
|
window.location.hash = `L${targetLineNumber}`;
|
||||||
});
|
});
|
||||||
|
|
||||||
exports.focusOnLine(self.ace);
|
exports.focusOnLine(self.ace);
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
self.ace = new Ace2Editor();
|
|
||||||
self.ace.init('editorcontainer', '').then(
|
|
||||||
() => aceReady(), (err) => { throw err || new Error(err); });
|
|
||||||
self.ace.setProperty('wraps', true);
|
self.ace.setProperty('wraps', true);
|
||||||
if (pad.getIsDebugEnabled()) {
|
if (pad.getIsDebugEnabled()) {
|
||||||
self.ace.setProperty('dmesg', pad.dmesg);
|
self.ace.setProperty('dmesg', pad.dmesg);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue