Skip to content

Commit

Permalink
Merge pull request #3923 from nextcloud/fix/emoticon_search
Browse files Browse the repository at this point in the history
feat(Emoji): Suggest emojis based on text smiles
  • Loading branch information
nickvergessen committed Mar 24, 2023
2 parents 43641e0 + c0c10b9 commit 05badfb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/functions/emoji/emoji.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ import { EmojiIndex, frequently } from 'emoji-mart-vue-fast'
export const emojiSearch = function(query, maxResults = 10) {
const index = new EmojiIndex(data)
if (query) {
return index.search(query, maxResults) || []
let results = index.search(`:${query}`, maxResults)
if (results.length < maxResults) {
results = results.concat(index.search(query, maxResults - results.length))
}
return results
}

return frequently.get(maxResults).map((id) => index.emoji(id)) || []
Expand Down

0 comments on commit 05badfb

Please sign in to comment.