summaryrefslogtreecommitdiffstats
path: root/client/components/activities/comments.js
diff options
context:
space:
mode:
authorJustin Reynolds <justinr1234@gmail.com>2019-06-28 12:52:09 -0500
committerJustin Reynolds <justinr1234@gmail.com>2019-06-28 12:56:51 -0500
commit3eb4d2c341b712268bd321173909e0a7b19a88c9 (patch)
tree25a8fcb088f3984e72a5bd3ded9e6a45376e0693 /client/components/activities/comments.js
parenta0a482aa8efb3255a523de4524c8e09453d5571f (diff)
downloadwekan-3eb4d2c341b712268bd321173909e0a7b19a88c9.tar.gz
wekan-3eb4d2c341b712268bd321173909e0a7b19a88c9.tar.bz2
wekan-3eb4d2c341b712268bd321173909e0a7b19a88c9.zip
Prettier & eslint project style update
Diffstat (limited to 'client/components/activities/comments.js')
-rw-r--r--client/components/activities/comments.js76
1 files changed, 41 insertions, 35 deletions
diff --git a/client/components/activities/comments.js b/client/components/activities/comments.js
index 34b6402c..3fc5770c 100644
--- a/client/components/activities/comments.js
+++ b/client/components/activities/comments.js
@@ -14,39 +14,41 @@ BlazeComponent.extendComponent({
},
events() {
- return [{
- 'click .js-new-comment:not(.focus)'() {
- commentFormIsOpen.set(true);
+ return [
+ {
+ 'click .js-new-comment:not(.focus)'() {
+ commentFormIsOpen.set(true);
+ },
+ 'submit .js-new-comment-form'(evt) {
+ const input = this.getInput();
+ const text = input.val().trim();
+ const card = this.currentData();
+ let boardId = card.boardId;
+ let cardId = card._id;
+ if (card.isLinkedCard()) {
+ boardId = Cards.findOne(card.linkedId).boardId;
+ cardId = card.linkedId;
+ }
+ if (text) {
+ CardComments.insert({
+ text,
+ boardId,
+ cardId,
+ });
+ resetCommentInput(input);
+ Tracker.flush();
+ autosize.update(input);
+ }
+ evt.preventDefault();
+ },
+ // Pressing Ctrl+Enter should submit the form
+ 'keydown form textarea'(evt) {
+ if (evt.keyCode === 13 && (evt.metaKey || evt.ctrlKey)) {
+ this.find('button[type=submit]').click();
+ }
+ },
},
- 'submit .js-new-comment-form'(evt) {
- const input = this.getInput();
- const text = input.val().trim();
- const card = this.currentData();
- let boardId = card.boardId;
- let cardId = card._id;
- if (card.isLinkedCard()) {
- boardId = Cards.findOne(card.linkedId).boardId;
- cardId = card.linkedId;
- }
- if (text) {
- CardComments.insert({
- text,
- boardId,
- cardId,
- });
- resetCommentInput(input);
- Tracker.flush();
- autosize.update(input);
- }
- evt.preventDefault();
- },
- // Pressing Ctrl+Enter should submit the form
- 'keydown form textarea'(evt) {
- if (evt.keyCode === 13 && (evt.metaKey || evt.ctrlKey)) {
- this.find('button[type=submit]').click();
- }
- },
- }];
+ ];
},
}).register('commentForm');
@@ -69,7 +71,8 @@ Tracker.autorun(() => {
});
});
-EscapeActions.register('inlinedForm',
+EscapeActions.register(
+ 'inlinedForm',
() => {
const draftKey = {
fieldName: 'cardComment',
@@ -84,7 +87,10 @@ EscapeActions.register('inlinedForm',
}
resetCommentInput(commentInput);
},
- () => { return commentFormIsOpen.get(); }, {
+ () => {
+ return commentFormIsOpen.get();
+ },
+ {
noClickEscapeOn: '.js-new-comment',
- }
+ },
);