mirror of
https://github.com/irislib/iris-messenger.git
synced 2024-10-18 06:03:22 +00:00
save message drafts for chats
This commit is contained in:
parent
dd9b3b24bd
commit
22bbe3d042
@ -794,11 +794,17 @@ function showChat(pub) {
|
||||
if (!iris.util.isMobile) {
|
||||
$("#new-msg").focus();
|
||||
}
|
||||
$('#new-msg').off().on('input', _.throttle(() => {
|
||||
var setTypingThrottled = _.throttle(() => {
|
||||
chats[pub].setTyping($('#new-msg').val().length > 0);
|
||||
}, 1000));
|
||||
}, 1000);
|
||||
$('#new-msg').val(chats[pub].msgDraft);
|
||||
$('#new-msg').off().on('input', () => {
|
||||
setTypingThrottled();
|
||||
chats[pub].msgDraft = $('#new-msg').val();
|
||||
});
|
||||
$(".message-form form").off().on('submit', event => {
|
||||
event.preventDefault();
|
||||
chats[pub].msgDraft = null;
|
||||
var text = $('#new-msg').val();
|
||||
if (!text.length) { return; }
|
||||
chats[pub].setTyping(false);
|
||||
|
Loading…
Reference in New Issue
Block a user