Submit comments with Enter and use Shift+Enter for new lines

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This commit is contained in:
Daniel Calviño Sánchez 2017-11-20 22:14:25 +01:00
parent 968da5ef23
commit 60a73bab1c
1 changed files with 3 additions and 2 deletions

View File

@ -517,9 +517,10 @@
$field.toggleClass('error', limitExceeded);
$submitButton.prop('disabled', limitExceeded);
//submits form on ctrl+Enter or cmd+Enter
if (ev.keyCode === 13 && (ev.ctrlKey || ev.metaKey)) {
// Submits form with Enter, but Shift+Enter is a new line
if (ev.keyCode === 13 && !ev.shiftKey) {
$submitButton.click();
ev.preventDefault();
}
},