jam411 3 лет назад
Родитель
Сommit
ffc07d47c7
1 измененных файлов с 11 добавлено и 4 удалено
  1. 11 4
      packages/app/src/components/PageEditor/CodeMirrorEditor.jsx

+ 11 - 4
packages/app/src/components/PageEditor/CodeMirrorEditor.jsx

@@ -1156,11 +1156,18 @@ const CodeMirrorEditorFc = React.forwardRef((props, ref) => {
     openDrawioModal(drawioMxFile);
   }, [openDrawioModal]);
 
-  const openTableModalHandler = (table, editor, autoFormatMarkdownTable) => {
+  const openTableModalHandler = useCallback((table, editor, autoFormatMarkdownTable) => {
     openHandsontableModal(table, editor, autoFormatMarkdownTable);
-  };
-
-  return <CodeMirrorEditor ref={ref} onClickDrawioBtn={openDrawioModalHandler} onClickTableBtn={openTableModalHandler} {...props} />;
+  }, [openHandsontableModal]);
+
+  return (
+    <CodeMirrorEditor
+      ref={ref}
+      onClickDrawioBtn={openDrawioModalHandler}
+      onClickTableBtn={openTableModalHandler}
+      {...props}
+    />
+  );
 });
 
 CodeMirrorEditorFc.displayName = 'CodeMirrorEditorFc';