Просмотр исходного кода

pass emojiPickerHelper instance as props

kaori 4 лет назад
Родитель
Сommit
307bb9a277

+ 1 - 0
packages/app/src/components/PageEditor/CodeMirrorEditor.jsx

@@ -698,6 +698,7 @@ export default class CodeMirrorEditor extends AbstractEditor {
               onClose={() => this.setState({ isEmojiPickerShown: false })}
               emojiSearchText={emojiSearchText}
               editor={this.getCodeMirror()}
+              emojiPickerHelper={this.emojiPickerHelper}
             />
           </div>
         </div>

+ 4 - 2
packages/app/src/components/PageEditor/EmojiPicker.tsx

@@ -6,11 +6,14 @@ type Props = {
   onClose: () => void,
   emojiSearchText: string,
   editor: any
+  emojiPickerHelper: EmojiPickerHelper
 }
 
 const EmojiPicker: FC<Props> = (props: Props) => {
 
-  const { onClose, emojiSearchText, editor } = props;
+  const {
+    onClose, emojiSearchText, emojiPickerHelper,
+  } = props;
 
   const emojiPickerContainer = useRef<HTMLDivElement>(null);
 
@@ -40,7 +43,6 @@ const EmojiPicker: FC<Props> = (props: Props) => {
 
   }, [emojiPickerContainer, onClose, emojiSearchText]);
 
-  const emojiPickerHelper = new EmojiPickerHelper(editor);
 
   const selectEmoji = (emoji) => {
     if (emojiSearchText !== null) {