From d6d040f5da2317af19b3df426556914d1b2a14fe Mon Sep 17 00:00:00 2001 From: Dessalines Date: Sun, 12 Apr 2020 12:47:48 -0400 Subject: Add Emoji squashed commit. --- ui/src/utils.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'ui/src/utils.ts') diff --git a/ui/src/utils.ts b/ui/src/utils.ts index ceb05764..fd23bf9e 100644 --- a/ui/src/utils.ts +++ b/ui/src/utils.ts @@ -43,6 +43,7 @@ import twemoji from 'twemoji'; import emojiShortName from 'emoji-short-name'; import Toastify from 'toastify-js'; import tippy from 'tippy.js'; +import EmojiButton from '@joeattardi/emoji-button'; export const repoUrl = 'https://github.com/LemmyNet/lemmy'; export const helpGuideUrl = '/docs/about_guide.html'; @@ -88,6 +89,14 @@ export const themes = [ 'i386', ]; +export const emojiPicker = new EmojiButton({ + // Use the emojiShortName from native + // style: 'twemoji', + theme: 'dark', + position: 'auto-start', + // TODO i18n +}); + export function randomStr() { return Math.random() .toString(36) @@ -473,8 +482,9 @@ export function setupTribute(): Tribute { { trigger: ':', menuItemTemplate: (item: any) => { - let emoji = `:${item.original.key}:`; - return `${item.original.val} ${emoji}`; + let shortName = `:${item.original.key}:`; + let twemojiIcon = twemoji.parse(item.original.val); + return `${twemojiIcon} ${shortName}`; }, selectTemplate: (item: any) => { return `:${item.original.key}:`; -- cgit v1.2.3