From 676690097f0e781dfca2704b1ee88e5a7dfeb91c Mon Sep 17 00:00:00 2001
From: Dessalines <tyhou13@gmx.com>
Date: Sun, 12 Apr 2020 14:55:52 -0400
Subject: Use twemoji style for emoji picker.

---
 ui/src/components/comment-form.tsx | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

(limited to 'ui/src/components/comment-form.tsx')

diff --git a/ui/src/components/comment-form.tsx b/ui/src/components/comment-form.tsx
index 6898ebc7..5239eb2c 100644
--- a/ui/src/components/comment-form.tsx
+++ b/ui/src/components/comment-form.tsx
@@ -230,11 +230,14 @@ export class CommentForm extends Component<CommentFormProps, CommentFormState> {
   }
 
   setupEmojiPicker() {
-    emojiPicker.on('emoji', emoji => {
+    emojiPicker.on('emoji', twemojiHtmlStr => {
       if (this.state.commentForm.content == null) {
         this.state.commentForm.content = '';
       }
-      let shortName = `:${emojiShortName[emoji]}:`;
+      var el = document.createElement('div');
+      el.innerHTML = twemojiHtmlStr;
+      let nativeUnicode = (el.childNodes[0] as HTMLElement).getAttribute('alt');
+      let shortName = `:${emojiShortName[nativeUnicode]}:`;
       this.state.commentForm.content += shortName;
       this.setState(this.state);
     });
-- 
cgit v1.2.3

