diff options
| author | Henry Jameson <me@hjkos.com> | 2019-07-28 16:07:01 +0300 |
|---|---|---|
| committer | Henry Jameson <me@hjkos.com> | 2019-07-28 16:07:01 +0300 |
| commit | 03c2f29b0aa31eb502db29e5a809da8bc1c1af28 (patch) | |
| tree | 28d4dd9b6635ab77545cbca5f71d8fdf958d5950 /src/components/emoji-picker/emoji-picker.js | |
| parent | 4c78fdb3934745ccbc87c10daf56552f0bfc0edc (diff) | |
cleanup and appropriation for new emoji-input component API, styles updates
Diffstat (limited to 'src/components/emoji-picker/emoji-picker.js')
| -rw-r--r-- | src/components/emoji-picker/emoji-picker.js | 33 |
1 files changed, 7 insertions, 26 deletions
diff --git a/src/components/emoji-picker/emoji-picker.js b/src/components/emoji-picker/emoji-picker.js index 9d2595aa..92d517b7 100644 --- a/src/components/emoji-picker/emoji-picker.js +++ b/src/components/emoji-picker/emoji-picker.js @@ -1,33 +1,17 @@ const filterByKeyword = (list, keyword = '') => { - return list.filter(x => x.shortcode.indexOf(keyword) !== -1) + return list.filter(x => x.displayText.includes(keyword)) } const EmojiPicker = { - mounted () { - document.body.addEventListener('click', this.outsideClicked) - }, - destroyed () { - document.body.removeEventListener('click', this.outsideClicked) - }, data () { return { - open: false, keyword: '', activeGroup: 'standard' } }, methods: { - togglePanel () { - this.open = !this.open - }, - insideClicked (e) { - e.stopPropagation() - }, - outsideClicked () { - this.open = false - }, onEmoji (emoji) { - const value = emoji.image_url ? `:${emoji.shortcode}:` : emoji.utf + const value = emoji.imageUrl ? `:${emoji.displayText}:` : emoji.replacement this.$emit('emoji', ` ${value} `) this.open = false }, @@ -51,20 +35,17 @@ const EmojiPicker = { const standardEmojis = this.$store.state.instance.emoji || [] const customEmojis = this.$store.state.instance.customEmoji || [] return { - standard: { - text: 'Standard', - icon: 'icon-star', - emojis: filterByKeyword(standardEmojis, this.keyword) - }, custom: { text: 'Custom', icon: 'icon-picture', emojis: filterByKeyword(customEmojis, this.keyword) + }, + standard: { + text: 'Standard', + icon: 'icon-star', + emojis: filterByKeyword(standardEmojis, this.keyword) } } - }, - serverUrl () { - return this.$store.state.instance.server } } } |
