|
|
|
|
@ -39,7 +39,6 @@ function getEmojisByCategory(category) { |
|
|
|
|
//set correctPackage here to allow for recent emojis to work properly
|
|
|
|
|
if (isSetNotNull(() => RocketChat.emoji.list[`:${ emoji }:`].emojiPackage)) { |
|
|
|
|
const correctPackage = RocketChat.emoji.list[`:${ emoji }:`].emojiPackage; |
|
|
|
|
|
|
|
|
|
const image = RocketChat.emoji.packages[correctPackage].render(`:${ emoji }${ tone }:`); |
|
|
|
|
|
|
|
|
|
html += `<li class="emoji-${ emoji }" data-emoji="${ emoji }" title="${ emoji }">${ image }</li>`; |
|
|
|
|
@ -126,10 +125,13 @@ Template.emojiPicker.helpers({ |
|
|
|
|
emojiList(category) { |
|
|
|
|
const t = Template.instance(); |
|
|
|
|
const searchTerm = t.currentSearchTerm.get(); |
|
|
|
|
const activeCategory = t.currentCategory.get(); |
|
|
|
|
//this will cause the reflow when recent list gets updated
|
|
|
|
|
t.recentNeedsUpdate.get(); |
|
|
|
|
|
|
|
|
|
//clear dynamic categories to prevent duplication issues
|
|
|
|
|
if (category === 'recent' || category === 'rocket') { |
|
|
|
|
$(`.${ category }.emoji-list`).empty(); |
|
|
|
|
//we only need to replace the active category, since switching tabs resets the filter
|
|
|
|
|
if (activeCategory !== category) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (searchTerm.length > 0) { |
|
|
|
|
@ -263,7 +265,7 @@ Template.emojiPicker.events({ |
|
|
|
|
Template.emojiPicker.onCreated(function() { |
|
|
|
|
this.tone = RocketChat.EmojiPicker.getTone(); |
|
|
|
|
const recent = RocketChat.EmojiPicker.getRecent(); |
|
|
|
|
|
|
|
|
|
this.recentNeedsUpdate = new ReactiveVar(false); |
|
|
|
|
this.currentCategory = new ReactiveVar(recent.length > 0 ? 'recent' : 'people'); |
|
|
|
|
this.currentSearchTerm = new ReactiveVar(''); |
|
|
|
|
|
|
|
|
|
@ -276,4 +278,10 @@ Template.emojiPicker.onCreated(function() { |
|
|
|
|
$('.current-tone').addClass(`tone-${ newTone }`); |
|
|
|
|
this.tone = newTone; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
this.autorun(() => { |
|
|
|
|
if (this.recentNeedsUpdate.get()) { |
|
|
|
|
this.recentNeedsUpdate.set(false); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
|