use new emoji-mart data to build shortcodeMap

This commit is contained in:
Damien Erambert 2024-12-25 11:54:21 +01:00
parent 3c6bf7d042
commit 230d9a64ee
No known key found for this signature in database

View File

@ -11,6 +11,7 @@
// to ensure that the prevaled file is regenerated by Babel
// version: 2
const emojiMart5Data = require('@emoji-mart/data/sets/15/twitter.json');
const { emojiIndex } = require('emoji-mart');
let data = require('emoji-mart/data/all.json');
const { uncompress: emojiMartUncompress } = require('emoji-mart/dist/utils/data');
@ -32,15 +33,10 @@ const shortcodeMap = {};
const shortCodesToEmojiData = {};
const emojisWithoutShortCodes = [];
Object.keys(emojiIndex.emojis).forEach(key => {
let emoji = emojiIndex.emojis[key];
Object.keys(emojiMart5Data.emojis).forEach(key => {
let emoji = emojiMart5Data.emojis[key];
// Emojis with skin tone modifiers are stored like this
if (Object.hasOwn(emoji, '1')) {
emoji = emoji['1'];
}
shortcodeMap[emoji.native] = emoji.id;
shortcodeMap[emoji.skins[0].native] = emoji.id;
});
const stripModifiers = unicode => {