mirror of https://github.com/vector-im/riot-web
Move some code around for clarity
Signed-off-by: Robin Townsend <robin@robin.town>pull/21833/head
parent
bd80201643
commit
cc40dd7998
12
src/emoji.ts
12
src/emoji.ts
|
@ -61,15 +61,15 @@ export const DATA_BY_CATEGORY = {
|
||||||
|
|
||||||
// Store various mappings from unicode/emoticon/shortcode to the Emoji objects
|
// Store various mappings from unicode/emoticon/shortcode to the Emoji objects
|
||||||
export const EMOJI: IEmoji[] = EMOJIBASE.map((emojiData: Omit<IEmoji, "shortcodes">) => {
|
export const EMOJI: IEmoji[] = EMOJIBASE.map((emojiData: Omit<IEmoji, "shortcodes">) => {
|
||||||
const shortcodeData = SHORTCODES[emojiData.hexcode];
|
// If there's ever a gap in shortcode coverage, we fudge it by
|
||||||
|
// filling it in with the emoji's CLDR annotation
|
||||||
|
const shortcodeData = SHORTCODES[emojiData.hexcode] ??
|
||||||
|
[emojiData.annotation.toLowerCase().replace(/ /g, "_")];
|
||||||
|
|
||||||
const emoji: IEmoji = {
|
const emoji: IEmoji = {
|
||||||
...emojiData,
|
...emojiData,
|
||||||
// Homogenize shortcodes by ensuring that everything is an array
|
// Homogenize shortcodes by ensuring that everything is an array
|
||||||
shortcodes: typeof shortcodeData === "string" ?
|
shortcodes: typeof shortcodeData === "string" ? [shortcodeData] : shortcodeData,
|
||||||
[shortcodeData] :
|
|
||||||
// If there's ever a gap in shortcode coverage, we fudge it by
|
|
||||||
// filling it in with the emoji's CLDR annotation
|
|
||||||
(shortcodeData ?? [emojiData.annotation.toLowerCase().replace(/ /g, "_")]),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const categoryId = EMOJIBASE_GROUP_ID_TO_CATEGORY[emoji.group];
|
const categoryId = EMOJIBASE_GROUP_ID_TO_CATEGORY[emoji.group];
|
||||||
|
|
Loading…
Reference in New Issue