You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-07 10:46:24 +03:00
@@ -86,6 +86,8 @@ export function isSingleEmoji(str) {
|
|||||||
* @return {String} The shortcode (such as :thumbup:)
|
* @return {String} The shortcode (such as :thumbup:)
|
||||||
*/
|
*/
|
||||||
export function unicodeToShortcode(char) {
|
export function unicodeToShortcode(char) {
|
||||||
|
// Check against both the char and the char with an empty variation selector appended because that's how
|
||||||
|
// emoji-base stores its base emojis which have variations. https://github.com/vector-im/riot-web/issues/9785
|
||||||
const emptyVariation = char + VARIATION_SELECTOR;
|
const emptyVariation = char + VARIATION_SELECTOR;
|
||||||
const data = EMOJIBASE.find(e => e.unicode === char || e.unicode === emptyVariation);
|
const data = EMOJIBASE.find(e => e.unicode === char || e.unicode === emptyVariation);
|
||||||
return (data && data.shortcodes ? `:${data.shortcodes[0]}:` : '');
|
return (data && data.shortcodes ? `:${data.shortcodes[0]}:` : '');
|
||||||
|
|||||||
Reference in New Issue
Block a user