adds functionality to submit comments with cmd+Enter
This commit is contained in:
parent
7ac1cb68f6
commit
bc0d136511
|
@ -172,7 +172,7 @@
|
||||||
this.$el.find('.avatar').avatar(OC.getCurrentUser().uid, 28);
|
this.$el.find('.avatar').avatar(OC.getCurrentUser().uid, 28);
|
||||||
}
|
}
|
||||||
this.delegateEvents();
|
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) {
|
_formatItem: function(commentModel) {
|
||||||
|
@ -273,7 +273,7 @@
|
||||||
// spawn form
|
// spawn form
|
||||||
$comment.after($formRow);
|
$comment.after($formRow);
|
||||||
$formRow.data('commentEl', $comment);
|
$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
|
// copy avatar element from original to avoid flickering
|
||||||
$formRow.find('.avatar').replaceWith($comment.find('.avatar').clone());
|
$formRow.find('.avatar').replaceWith($comment.find('.avatar').clone());
|
||||||
|
@ -302,8 +302,8 @@
|
||||||
$field.toggleClass('error', limitExceeded);
|
$field.toggleClass('error', limitExceeded);
|
||||||
$submitButton.prop('disabled', limitExceeded);
|
$submitButton.prop('disabled', limitExceeded);
|
||||||
|
|
||||||
//submits form on ctrlEnter
|
//submits form on ctrl+Enter or cmd+Enter
|
||||||
if (ev.keyCode === 13 && ev.ctrlKey) {
|
if (ev.keyCode === 13 && (ev.ctrlKey || ev.metaKey)) {
|
||||||
$submitButton.click();
|
$submitButton.click();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue