Merge pull request #683 from h3poteto/fix/duplicated-emojis

fix: Remove duplicated emojis when suggest
This commit is contained in:
AkiraFukushima 2018-10-30 00:54:49 +09:00 committed by GitHub
commit 8b914d3598
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -184,12 +184,13 @@ export default {
// Find custom emojis
const filteredCustomEmoji = this.customEmojis.filter(emoji => emoji.name.includes(word))
const filtered = filteredNativeEmoji.concat(filteredCustomEmoji)
console.log(filtered)
if (filtered.length > 0) {
this.openSuggest = true
this.startIndex = start
this.matchWord = word
this.filteredSuggestion = filtered
this.filteredSuggestion = filtered.filter((e, i, array) => {
return (array.findIndex(ar => e.code === ar.code) === i)
})
} else {
this.openSuggest = false
}