mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-20 15:36:16 -04:00
chat: Promisify addMessage()
This commit is contained in:
parent
3f7f629eeb
commit
caac4bf711
1 changed files with 39 additions and 41 deletions
|
@ -105,7 +105,7 @@ exports.chat = (() => {
|
||||||
this._pad.collabClient.sendMessage({type: 'CHAT_MESSAGE', text});
|
this._pad.collabClient.sendMessage({type: 'CHAT_MESSAGE', text});
|
||||||
$('#chatinput').val('');
|
$('#chatinput').val('');
|
||||||
},
|
},
|
||||||
addMessage(msg, increment, isHistoryAdd) {
|
async addMessage(msg, increment, isHistoryAdd) {
|
||||||
// correct the time
|
// correct the time
|
||||||
msg.time += this._pad.clientTimeOffset;
|
msg.time += this._pad.clientTimeOffset;
|
||||||
|
|
||||||
|
@ -161,8 +161,7 @@ exports.chat = (() => {
|
||||||
ctx.sticky = true;
|
ctx.sticky = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call chat message hook
|
await hooks.aCallAll('chatNewMessage', ctx);
|
||||||
hooks.aCallAll('chatNewMessage', ctx, () => {
|
|
||||||
const cls = authorClass(ctx.author);
|
const cls = authorClass(ctx.author);
|
||||||
const chatMsg = $('<p>')
|
const chatMsg = $('<p>')
|
||||||
.attr('data-authorId', ctx.author)
|
.attr('data-authorId', ctx.author)
|
||||||
|
@ -203,7 +202,6 @@ exports.chat = (() => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!isHistoryAdd) this.scrollDown();
|
if (!isHistoryAdd) this.scrollDown();
|
||||||
});
|
|
||||||
},
|
},
|
||||||
init(pad) {
|
init(pad) {
|
||||||
this._pad = pad;
|
this._pad = pad;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue