mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-11-04 22:40:29 +03:00
replaced fusejs in Emojiboard
This commit is contained in:
parent
c06a92e0ae
commit
633d59c13b
3 changed files with 30 additions and 39 deletions
|
|
@ -1,6 +1,5 @@
|
|||
import emojisData from 'emojibase-data/en/compact.json';
|
||||
import shortcodes from 'emojibase-data/en/shortcodes/joypixels.json';
|
||||
import Fuse from 'fuse.js';
|
||||
|
||||
const emojiGroups = [{
|
||||
name: 'Smileys & people',
|
||||
|
|
@ -62,18 +61,7 @@ emojisData.forEach((emoji) => {
|
|||
addToGroup(em);
|
||||
emojis.push(em);
|
||||
});
|
||||
function searchEmoji(term) {
|
||||
const options = {
|
||||
includeScore: true,
|
||||
keys: ['shortcodes', 'annotation', 'tags'],
|
||||
threshold: '0.3',
|
||||
};
|
||||
const fuse = new Fuse(emojis, options);
|
||||
|
||||
let result = fuse.search(term);
|
||||
if (result.length > 20) result = result.slice(0, 20);
|
||||
return result;
|
||||
}
|
||||
export {
|
||||
emojis, emojiGroups, searchEmoji,
|
||||
emojis, emojiGroups,
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue