Document emoji picker (#4338)
Co-authored-by: Tom Moor <tom.moor@gmail.com>
This commit is contained in:
14
shared/editor/lib/emoji.ts
Normal file
14
shared/editor/lib/emoji.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import data, { type EmojiMartData } from "@emoji-mart/data";
|
||||
import snakeCase from "lodash/snakeCase";
|
||||
|
||||
/**
|
||||
* A map of emoji shortcode to emoji character. The shortcode is snake cased
|
||||
* for backwards compatibility with those already encoded into documents.
|
||||
*/
|
||||
export const nameToEmoji = Object.values((data as EmojiMartData).emojis).reduce(
|
||||
(acc, emoji) => {
|
||||
acc[snakeCase(emoji.id)] = emoji.skins[0].native;
|
||||
return acc;
|
||||
},
|
||||
{}
|
||||
);
|
||||
Reference in New Issue
Block a user