From 3eb4d2c341b712268bd321173909e0a7b19a88c9 Mon Sep 17 00:00:00 2001 From: Justin Reynolds Date: Fri, 28 Jun 2019 12:52:09 -0500 Subject: Prettier & eslint project style update --- client/components/activities/comments.js | 76 +++++++++++++++++--------------- 1 file changed, 41 insertions(+), 35 deletions(-) (limited to 'client/components/activities/comments.js') 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', - } + }, ); -- cgit v1.2.3-1-g7c22