Skip to content

Commit

Permalink
/demos/dashboard/ fixed "Send-chat-messages on ENTER key pressed"
Browse files Browse the repository at this point in the history
  • Loading branch information
muaz-khan committed Nov 4, 2018
1 parent f9e01ca commit 2d9e469
Showing 1 changed file with 20 additions and 18 deletions.
38 changes: 20 additions & 18 deletions demos/dashboard/canvas-designer.html
Original file line number Diff line number Diff line change
Expand Up @@ -429,26 +429,21 @@
});
}

var code = e.keyCode || e.which;
if (code == 13) {
$('#btn-chat-message').click();
}
else {
clearTimeout(keyPressTimer);
numberOfKeys++;

if(numberOfKeys % 3 === 0) {
connection.send({
typing: true
});
}

keyPressTimer = setTimeout(function() {
connection.send({
typing: false
});
}, 1200);
clearTimeout(keyPressTimer);
numberOfKeys++;

if (numberOfKeys % 3 === 0) {
connection.send({
typing: true
});
}

keyPressTimer = setTimeout(function() {
connection.send({
typing: false
});
}, 1200);
},
blur: function() {
// $('#btn-chat-message').click();
Expand All @@ -459,6 +454,13 @@
}
});

window.onkeyup = function(e) {
var code = e.keyCode || e.which;
if (code == 13) {
$('#btn-chat-message').click();
}
};

document.getElementById('btn-chat-message').onclick = function() {
var chatMessage = $('.emojionearea-editor').html();
$('.emojionearea-editor').html('');
Expand Down

0 comments on commit 2d9e469

Please sign in to comment.