summaryrefslogtreecommitdiffstats
path: root/apps/comments/js
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2017-12-08 15:31:10 +0100
committerGitHub <noreply@github.com>2017-12-08 15:31:10 +0100
commit5724e75827beb7635d98ee8c315a206ccc7bc07e (patch)
tree196d0acdf1a2afad30d1a36ebfedcb60e2cb7ef8 /apps/comments/js
parentbb8acc5824f6a026ec47e738f7ce48a67bae59ad (diff)
parent9b1f3b969e8c273d86901432421189295383d81f (diff)
downloadnextcloud-server-5724e75827beb7635d98ee8c315a206ccc7bc07e.tar.gz
nextcloud-server-5724e75827beb7635d98ee8c315a206ccc7bc07e.zip
Merge pull request #7252 from nextcloud/send-comment-on-enter
Submit comments with Enter and use Shift+Enter for new lines
Diffstat (limited to 'apps/comments/js')
-rw-r--r--apps/comments/js/commentstabview.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/apps/comments/js/commentstabview.js b/apps/comments/js/commentstabview.js
index 0c43e156985..9b75cb4671e 100644
--- a/apps/comments/js/commentstabview.js
+++ b/apps/comments/js/commentstabview.js
@@ -530,9 +530,13 @@
$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 the
+ // autocomplete popover is being shown Enter does not submit the
+ // form either; it will be handled by At.js which will add the
+ // currently selected item to the message.
+ if (ev.keyCode === 13 && !ev.shiftKey && !$field.atwho('isSelecting')) {
$submitButton.click();
+ ev.preventDefault();
}
},