diff options
Diffstat (limited to 'client/components')
-rw-r--r-- | client/components/lists/listBody.js | 4 | ||||
-rwxr-xr-x[-rw-r--r--] | client/components/main/editor.js | 26 | ||||
-rw-r--r-- | client/components/sidebar/sidebarFilters.js | 4 |
3 files changed, 19 insertions, 15 deletions
diff --git a/client/components/lists/listBody.js b/client/components/lists/listBody.js index 907c2157..34c2dcd6 100644 --- a/client/components/lists/listBody.js +++ b/client/components/lists/listBody.js @@ -208,11 +208,12 @@ BlazeComponent.extendComponent({ label.color.indexOf(term) > -1) { return label; } + return null; })); }, template(label) { return Blaze.toHTMLWithData(Template.autocompleteLabelLine, { - hasNoName: !Boolean(label.name), + hasNoName: !label.name, colorName: label.color, labelName: label.name || label.color, }); @@ -233,6 +234,7 @@ BlazeComponent.extendComponent({ evt.stopPropagation(); return commands.KEY_ENTER; } + return null; }, }); }, diff --git a/client/components/main/editor.js b/client/components/main/editor.js index a30a5e1d..da66bb74 100644..100755 --- a/client/components/main/editor.js +++ b/client/components/main/editor.js @@ -4,7 +4,7 @@ Template.editor.onRendered(() => { autosize($textarea); $textarea.escapeableTextComplete([ - // Emojies + // Emoji { match: /\B:([\-+\w]*)$/, search(term, callback) { @@ -45,7 +45,7 @@ Template.editor.onRendered(() => { }); // XXX I believe we should compute a HTML rendered field on the server that -// would handle markdown, emojies and user mentions. We can simply have two +// would handle markdown, emoji and user mentions. We can simply have two // fields, one source, and one compiled version (in HTML) and send only the // compiled version to most users -- who don't need to edit. // In the meantime, all the transformation are done on the client using the @@ -61,18 +61,20 @@ Blaze.Template.registerHelper('mentions', new Template('mentions', function() { const mentionRegex = /\B@(\w*)/gi; let content = Blaze.toHTML(view.templateContentBlock); - let currentMention, knowedUser, linkClass, linkValue, link; - while (Boolean(currentMention = mentionRegex.exec(content))) { - - knowedUser = _.findWhere(knowedUsers, { username: currentMention[1] }); - if (!knowedUser) + let currentMention; + while ((currentMention = mentionRegex.exec(content)) !== null) { + const [fullMention, username] = currentMention; + const knowedUser = _.findWhere(knowedUsers, { username }); + if (!knowedUser) { continue; + } - linkValue = [' ', at, knowedUser.username]; - linkClass = 'atMention js-open-member'; - if (knowedUser.userId === Meteor.userId()) + const linkValue = [' ', at, knowedUser.username]; + let linkClass = 'atMention js-open-member'; + if (knowedUser.userId === Meteor.userId()) { linkClass += ' me'; - link = HTML.A({ + } + const link = HTML.A({ 'class': linkClass, // XXX Hack. Since we stringify this render function result below with // `Blaze.toHTML` we can't rely on blaze data contexts to pass the @@ -81,7 +83,7 @@ Blaze.Template.registerHelper('mentions', new Template('mentions', function() { 'data-userId': knowedUser.userId, }, linkValue); - content = content.replace(currentMention[0], Blaze.toHTML(link)); + content = content.replace(fullMention, Blaze.toHTML(link)); } return HTML.Raw(content); diff --git a/client/components/sidebar/sidebarFilters.js b/client/components/sidebar/sidebarFilters.js index 0a57f02c..f02d3a4a 100644 --- a/client/components/sidebar/sidebarFilters.js +++ b/client/components/sidebar/sidebarFilters.js @@ -68,7 +68,7 @@ BlazeComponent.extendComponent({ const popup = Popup.open('disambiguateMultiLabel'); // XXX We need to have a better integration between the popup and the // UI components systems. - return popup.call(this.currentData(), evt); + popup.call(this.currentData(), evt); } }, 'click .js-toggle-member-multiselection'(evt) { @@ -82,7 +82,7 @@ BlazeComponent.extendComponent({ const popup = Popup.open('disambiguateMultiMember'); // XXX We need to have a better integration between the popup and the // UI components systems. - return popup.call(this.currentData(), evt); + popup.call(this.currentData(), evt); } }, 'click .js-move-selection': Popup.open('moveSelection'), |