From 35c052350dacaab1bbba7c730124945b8b9cce85 Mon Sep 17 00:00:00 2001 From: iou1name Date: Sun, 17 Jun 2018 18:09:11 -0400 Subject: [PATCH] shift+enter doesnt submit chat message --- templates/quest.html | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/templates/quest.html b/templates/quest.html index 6f673d7..4d24f4e 100644 --- a/templates/quest.html +++ b/templates/quest.html @@ -29,9 +29,10 @@ }); mtarea = document.getElementById('messageTextarea'); mtarea.addEventListener('keypress', function(event) { - if (event.key == 'Enter') { - text = mtarea.value; + if (event.key == 'Enter' && !event.shiftKey) { + text = mtarea.value.trim(); mtarea.value = ''; + if (text == '') { return; } socket.emit('message', {message: text, name: 'Anonymous', room: '{{ room_id }}'}); } });