shift+enter doesnt submit chat message
This commit is contained in:
parent
d4b6c14e23
commit
35c052350d
|
@ -29,9 +29,10 @@
|
||||||
});
|
});
|
||||||
mtarea = document.getElementById('messageTextarea');
|
mtarea = document.getElementById('messageTextarea');
|
||||||
mtarea.addEventListener('keypress', function(event) {
|
mtarea.addEventListener('keypress', function(event) {
|
||||||
if (event.key == 'Enter') {
|
if (event.key == 'Enter' && !event.shiftKey) {
|
||||||
text = mtarea.value;
|
text = mtarea.value.trim();
|
||||||
mtarea.value = '';
|
mtarea.value = '';
|
||||||
|
if (text == '') { return; }
|
||||||
socket.emit('message', {message: text, name: 'Anonymous', room: '{{ room_id }}'});
|
socket.emit('message', {message: text, name: 'Anonymous', room: '{{ room_id }}'});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user