Zip shortcodes in with emoji objects

Signed-off-by: Robin Townsend <robin@robin.town>
This commit is contained in:
Robin Townsend
2021-07-16 16:36:03 -04:00
parent 8efb30eb07
commit f88d5dd24e
5 changed files with 37 additions and 50 deletions
+2 -2
View File
@@ -34,7 +34,7 @@ import { IExtendedSanitizeOptions } from './@types/sanitize-html';
import linkifyMatrix from './linkify-matrix';
import SettingsStore from './settings/SettingsStore';
import { tryTransformPermalinkToLocalHref } from "./utils/permalinks/Permalinks";
import { getEmojiFromUnicode, getShortcodes } from "./emoji";
import { getEmojiFromUnicode } from "./emoji";
import ReplyThread from "./components/views/elements/ReplyThread";
import { mediaFromMxc } from "./customisations/Media";
@@ -80,7 +80,7 @@ function mightContainEmoji(str: string): boolean {
* @return {String} The shortcode (such as :thumbup:)
*/
export function unicodeToShortcode(char: string): string {
const shortcodes = getShortcodes(getEmojiFromUnicode(char));
const shortcodes = getEmojiFromUnicode(char).shortcodes;
return shortcodes.length > 0 ? `:${shortcodes[0]}:` : '';
}