Explorar o código

update CommentEditor

jam411 %!s(int64=3) %!d(string=hai) anos
pai
achega
01bf5b41ed
Modificáronse 1 ficheiros con 8 adicións e 3 borrados
  1. 8 3
      packages/app/src/components/PageComment/CommentEditor.tsx

+ 8 - 3
packages/app/src/components/PageComment/CommentEditor.tsx

@@ -9,8 +9,8 @@ import {
 import * as toastr from 'toastr';
 
 import { apiPostForm } from '~/client/util/apiv1-client';
-import { CustomWindow } from '~/interfaces/global';
-import { IInterceptorManager } from '~/interfaces/interceptor-manager';
+// import { CustomWindow } from '~/interfaces/global';
+// import { IInterceptorManager } from '~/interfaces/interceptor-manager';
 import { RendererOptions } from '~/services/renderer/renderer';
 import { useSWRxPageComment } from '~/stores/comment';
 import {
@@ -238,7 +238,12 @@ export const CommentEditor = (props: PropsType): JSX.Element => {
     }
   }, [apiErrorHandler, currentPageId, currentPagePath]);
 
+
   const getCommentHtml = useCallback(() => {
+    if (currentPagePath == null) {
+      return <></>;
+    }
+
     return (
       <CommentPreview
         rendererOptions={rendererOptions}
@@ -246,7 +251,7 @@ export const CommentEditor = (props: PropsType): JSX.Element => {
         currentPagePath={currentPagePath}
       />
     );
-  }, [markdown]);
+  }, [currentPagePath, markdown, rendererOptions]);
 
   const renderBeforeReady = useCallback((): JSX.Element => {
     return (