Yuki Takei 3 лет назад
Родитель
Сommit
3eb24ea17a
1 измененных файлов с 12 добавлено и 2 удалено
  1. 12 2
      packages/app/src/components/Page.tsx

+ 12 - 2
packages/app/src/components/Page.tsx

@@ -77,6 +77,11 @@ export const Page = (props) => {
       return;
     }
 
+    // disable if share link
+    if (shareLinkId != null) {
+      return;
+    }
+
     const currentMarkdown = currentPage.revision.body;
     const optionsToSave: OptionsToSave = {
       isSlackEnabled: false,
@@ -107,10 +112,15 @@ export const Page = (props) => {
       logger.error('failed to save', error);
       toastError(error);
     }
-  }, [currentPage, mutateCurrentPage, mutateEditingMarkdown, saveOrUpdate, t, tagsInfo]);
+  }, [currentPage, mutateCurrentPage, mutateEditingMarkdown, saveOrUpdate, shareLinkId, t, tagsInfo]);
 
   // set handler to open DrawioModal
   useEffect(() => {
+    // disable if share link
+    if (shareLinkId != null) {
+      return;
+    }
+
     const handler = (data: DrawioEditByViewerProps) => {
       openDrawioModal(data.drawioMxFile, drawioMxFile => saveByDrawioModal(drawioMxFile, data.bol, data.eol));
     };
@@ -119,7 +129,7 @@ export const Page = (props) => {
     return function cleanup() {
       globalEmitter.removeListener('launchDrawioModal', handler);
     };
-  }, [openDrawioModal, saveByDrawioModal]);
+  }, [openDrawioModal, saveByDrawioModal, shareLinkId]);
 
   if (currentPage == null || isGuestUser == null || rendererOptions == null) {
     const entries = Object.entries({