jam411 пре 3 година
родитељ
комит
9e3ec756f6

+ 2 - 11
packages/app/src/components/Page.module.scss

@@ -1,15 +1,6 @@
 // mobile
 // mobile
 .page-mobile :global {
 .page-mobile :global {
-  .wiki .revision-head {
-    .revision-head-link,
-    .revision-head-edit-button {
-      opacity: 0.3;
-    }
-  }
-
-  .editable-with-handsontable {
-    .handsontable-modal-trigger {
-      opacity: 0.3;
-    }
+  .editable-with-handsontable .handsontable-modal-trigger {
+    opacity: 0.3;
   }
   }
 }
 }

+ 1 - 0
packages/app/src/components/Page.tsx

@@ -77,6 +77,7 @@ export const Page = (props) => {
   }, [mutateCurrentPageTocNode, tocRef.current]); // include tocRef.current to call mutateCurrentPageTocNode when tocRef.current changes
   }, [mutateCurrentPageTocNode, tocRef.current]); // include tocRef.current to call mutateCurrentPageTocNode when tocRef.current changes
 
 
 
 
+  // TODO: refactor commonize saveByDrawioModal and saveByHandsontableModal
   const saveByDrawioModal = useCallback(async(drawioMxFile: string, bol: number, eol: number) => {
   const saveByDrawioModal = useCallback(async(drawioMxFile: string, bol: number, eol: number) => {
     if (currentPage == null || tagsInfo == null) {
     if (currentPage == null || tagsInfo == null) {
       return;
       return;

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

@@ -159,6 +159,7 @@ class CodeMirrorEditor extends AbstractEditor {
 
 
     this.foldDrawioSection = this.foldDrawioSection.bind(this);
     this.foldDrawioSection = this.foldDrawioSection.bind(this);
     this.clickDrawioIconHandler = this.clickDrawioIconHandler.bind(this);
     this.clickDrawioIconHandler = this.clickDrawioIconHandler.bind(this);
+    this.clickTableIconHandler = this.clickTableIconHandler.bind(this);
 
 
   }
   }
 
 

+ 4 - 4
packages/app/src/components/PageEditor/HandsontableModal.tsx

@@ -37,7 +37,7 @@ export const HandsontableModal = (): JSX.Element => {
   const table = handsontableModalData?.table;
   const table = handsontableModalData?.table;
   const autoFormatMarkdownTable = handsontableModalData?.autoFormatMarkdownTable ?? false;
   const autoFormatMarkdownTable = handsontableModalData?.autoFormatMarkdownTable ?? false;
   const editor = handsontableModalData?.editor;
   const editor = handsontableModalData?.editor;
-  const onSaveDirectlyFromPage = handsontableModalData?.onSave;
+  const onSave = handsontableModalData?.onSave;
 
 
   const defaultMarkdownTable = () => {
   const defaultMarkdownTable = () => {
     return new MarkdownTable(
     return new MarkdownTable(
@@ -132,9 +132,9 @@ export const HandsontableModal = (): JSX.Element => {
       markdownTableOption.latest,
       markdownTableOption.latest,
     ).normalizeCells();
     ).normalizeCells();
 
 
-    // onSaveDirectlyFromPage is passed only when editing table directly from the page.
-    if (onSaveDirectlyFromPage != null) {
-      onSaveDirectlyFromPage(newMarkdownTable);
+    // onSave is passed only when editing table directly from the page.
+    if (onSave != null) {
+      onSave(newMarkdownTable);
       cancel();
       cancel();
       return;
       return;
     }
     }

+ 4 - 2
packages/app/src/components/ReactMarkdownComponents/TableWithEditButton.tsx

@@ -15,11 +15,13 @@ declare global {
 
 
 type TableWithEditButtonProps = {
 type TableWithEditButtonProps = {
   children: React.ReactNode,
   children: React.ReactNode,
+  className: string
   node: Element,
   node: Element,
 }
 }
 
 
 export const TableWithEditButton = React.memo((props: TableWithEditButtonProps): JSX.Element => {
 export const TableWithEditButton = React.memo((props: TableWithEditButtonProps): JSX.Element => {
-  const { node, children } = props;
+
+  const { children, className, node } = props;
 
 
   const { data: isGuestUser } = useIsGuestUser();
   const { data: isGuestUser } = useIsGuestUser();
   const { data: isSharedUser } = useIsSharedUser();
   const { data: isSharedUser } = useIsSharedUser();
@@ -41,7 +43,7 @@ export const TableWithEditButton = React.memo((props: TableWithEditButtonProps):
           <i className="icon-note"></i>
           <i className="icon-note"></i>
         </button>
         </button>
       )}
       )}
-      <table className="table table-bordered">
+      <table className={`${className}`}>
         {children}
         {children}
       </table>
       </table>
     </div>
     </div>

+ 9 - 0
packages/app/src/styles/organisms/_wiki.scss

@@ -235,6 +235,15 @@
   }
   }
 }
 }
 
 
+// mobile
+.page-mobile .wiki .revision-head {
+
+  .revision-head-link,
+  .revision-head-edit-button {
+    opacity: 0.3;
+  }
+}
+
 @include bs.media-breakpoint-down(sm) {
 @include bs.media-breakpoint-down(sm) {
   .main .wiki {
   .main .wiki {
     img {
     img {