Explorar o código

134432 add null guard

soumaeda %!s(int64=2) %!d(string=hai) anos
pai
achega
2c14e7ca40

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

@@ -26,7 +26,7 @@ type Props = {
   onChange?: (value: string) => void,
   onUpload?: (files: File[]) => void,
   indentSize?: number,
-  openTabelModal: () => void,
+  openTabelModal?: () => void,
 }
 
 export const CodeMirrorEditor = (props: Props): JSX.Element => {

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

@@ -1,10 +1,13 @@
 type TableButtonProps = {
-  openTabelModal: () => void;
+  openTabelModal?: () => void;
 }
 
 export const TableButton = (props: TableButtonProps): JSX.Element => {
   const { openTabelModal } = props;
   const openTabelModalHandler = () => {
+    if (openTabelModal == null) {
+      return;
+    }
     openTabelModal();
   };
   return (

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

@@ -16,7 +16,7 @@ type Props = {
   editorKey: string,
   onFileOpen: () => void,
   acceptedFileType: AcceptedUploadFileType,
-  openTabelModal: () => void,
+  openTabelModal?: () => void,
 }
 
 export const Toolbar = memo((props: Props): JSX.Element => {