Browse Source

134432 do not reseive editor and tble from editor

soumaeda 2 năm trước cách đây
mục cha
commit
a889d5e794

+ 1 - 1
apps/app/src/stores/modal.tsx

@@ -516,7 +516,7 @@ type HandsontableModalStatus = {
 
 type HandsontableModalStatusUtils = {
   open(
-    table: MarkdownTable | null,
+    table: MarkdownTable,
     editor?: any,
     autoFormatMarkdownTable?: boolean,
     onSave?: HandsonTableModalSaveHandler

+ 3 - 13
packages/editor/src/components/CodeMirrorEditor/Toolbar/TableButton.tsx

@@ -1,22 +1,12 @@
 import { useCallback } from 'react';
 
-import { useCodeMirrorEditorIsolated } from '../../../stores';
 import { useHandsontableModal } from '../../../stores/use-hands-on-table';
 
-type Props = {
-  editorKey: string,
-}
-
-export const TableButton = (props: Props): JSX.Element => {
-  const { editorKey } = props;
-
+export const TableButton = (): JSX.Element => {
   const { open: openTableModal } = useHandsontableModal();
-  const { data: codeMirrorEditor } = useCodeMirrorEditorIsolated(editorKey);
-
   const openTableModalHandler = useCallback(() => {
-    const editor = codeMirrorEditor?.view;
-    openTableModal(editor);
-  }, [codeMirrorEditor]);
+    openTableModal();
+  }, []);
 
   return (
     <button type="button" className="btn btn-toolbar-button" onClick={openTableModalHandler}>

+ 1 - 1
packages/editor/src/components/CodeMirrorEditor/Toolbar/Toolbar.tsx

@@ -30,7 +30,7 @@ export const Toolbar = memo((props: Props): JSX.Element => {
       <EmojiButton
         editorKey={editorKey}
       />
-      <TableButton editorKey={editorKey} />
+      <TableButton />
       <DiagramButton />
       <TemplateButton />
     </div>