diff options
author | blizzz <blizzz@owncloud.com> | 2016-05-03 22:24:17 +0200 |
---|---|---|
committer | blizzz <blizzz@owncloud.com> | 2016-05-03 22:24:17 +0200 |
commit | 2fd4f1a7756b447cf9062bb794ba98f660106983 (patch) | |
tree | e3ae31b44aea0759a8b2d80cb006f296f869dc0e /apps | |
parent | 4b2544925f7f51d7e5cb1329166451f4fbd9e6bf (diff) | |
parent | 5f2a19e96555e717821dae937beb377408b91527 (diff) | |
download | nextcloud-server-2fd4f1a7756b447cf9062bb794ba98f660106983.tar.gz nextcloud-server-2fd4f1a7756b447cf9062bb794ba98f660106983.zip |
Merge pull request #24396 from owncloud/ctrlEnter-submit-comment
Adds functionality to submit comment on ctrl+Enter
Diffstat (limited to 'apps')
-rw-r--r-- | apps/comments/js/commentstabview.js | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/apps/comments/js/commentstabview.js b/apps/comments/js/commentstabview.js index 415ec2a9be5..9475dc53fc0 100644 --- a/apps/comments/js/commentstabview.js +++ b/apps/comments/js/commentstabview.js @@ -172,7 +172,7 @@ this.$el.find('.avatar').avatar(OC.getCurrentUser().uid, 28); } this.delegateEvents(); - this.$el.find('textarea').on('keyup input change', this._onTypeComment); + this.$el.find('textarea').on('keydown input change', this._onTypeComment); }, _formatItem: function(commentModel) { @@ -273,7 +273,7 @@ // spawn form $comment.after($formRow); $formRow.data('commentEl', $comment); - $formRow.find('textarea').on('keyup input change', this._onTypeComment); + $formRow.find('textarea').on('keydown input change', this._onTypeComment); // copy avatar element from original to avoid flickering $formRow.find('.avatar').replaceWith($comment.find('.avatar').clone()); @@ -301,6 +301,11 @@ var limitExceeded = (len > this._commentMaxLength); $field.toggleClass('error', limitExceeded); $submitButton.prop('disabled', limitExceeded); + + //submits form on ctrl+Enter or cmd+Enter + if (ev.keyCode === 13 && (ev.ctrlKey || ev.metaKey)) { + $submitButton.click(); + } }, _onClickComment: function(ev) { |