Explorar o código

134432 change table type as optional

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

+ 0 - 3
apps/app/src/components/PageEditor/PageEditor.tsx

@@ -189,9 +189,6 @@ export const PageEditor = React.memo((props: Props): JSX.Element => {
   const openTableModalHandler = useCallback(() => {
     const editor = codeMirrorEditor?.view;
     const markdownTable = mtu.getMarkdownTable(editor);
-    if (markdownTable == null) {
-      return;
-    }
     openHandsontableModal(markdownTable, editor);
   }, [codeMirrorEditor]);
 

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

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

+ 0 - 3
packages/editor/src/components/CodeMirrorEditor/CodeMirrorEditor.tsx

@@ -143,9 +143,6 @@ export const CodeMirrorEditor = (props: Props): JSX.Element => {
     return '';
   }, [isUploading, acceptedFileType, isDragAccept, isDragReject]);
 
-  if (onClickTableBtn == null) {
-    return <></>;
-  }
 
   return (
     <div className={`${style['codemirror-editor']} flex-expand-vert`}>

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

@@ -15,7 +15,7 @@ type Props = {
   editorKey: string | GlobalCodeMirrorEditorKey,
   onFileOpen: () => void,
   acceptedFileType: AcceptedUploadFileType,
-  onClickTableBtn: () => void,
+  onClickTableBtn?: () => void,
 }
 
 export const Toolbar = memo((props: Props): JSX.Element => {
@@ -31,7 +31,7 @@ export const Toolbar = memo((props: Props): JSX.Element => {
       <EmojiButton
         editorKey={editorKey}
       />
-      <TableButton onClickTableBtn={onClickTableBtn} />
+      { onClickTableBtn && <TableButton onClickTableBtn={onClickTableBtn} /> }
       <DiagramButton />
       <TemplateButton />
     </div>