WNomunomu 2 лет назад
Родитель
Сommit
de7f733cee

+ 2 - 1
packages/editor/package.json

@@ -37,6 +37,7 @@
     "react-toastify": "^9.1.3",
     "reactstrap": "^9.2.0",
     "swr": "^2.2.2",
-    "ts-deepmerge": "^6.2.0"
+    "ts-deepmerge": "^6.2.0",
+    "emoji-mart": "npm:panta82-emoji-mart@^3.0.1"
   }
 }

+ 4 - 4
packages/editor/src/components/CodeMirrorEditor/Toolbar/EmojiButton.tsx

@@ -1,4 +1,4 @@
-import React, { FC, useState, CSSProperties } from 'react';
+import { FC, useState, CSSProperties } from 'react';
 
 import { Picker } from 'emoji-mart';
 import i18n from 'i18next';
@@ -27,7 +27,7 @@ type Translation = {
 
 const getEmojiTranslation = (): Translation => {
 
-  const categories = {};
+  const categories: { [key: string]: string } = {};
   [
     'search',
     'recent',
@@ -45,7 +45,7 @@ const getEmojiTranslation = (): Translation => {
     categories[category] = i18n.t(`emoji.categories.${category}`);
   });
 
-  const skintones = {};
+  const skintones: { [key: string]: string} = {};
   (Array.from(Array(6).keys())).forEach((tone) => {
     skintones[tone + 1] = i18n.t(`emoji.skintones.${tone + 1}`);
   });
@@ -73,7 +73,7 @@ export const EmojiButton: FC<Props> = (props) => {
   const view = codeMirrorEditor?.view;
 
   if (view == null) {
-    return;
+    return '';
   }
 
   const cursorIndex = view?.state.selection.main.head;