From fb0e4160653e5ba8bf2cbd7653b721e0664fc94e Mon Sep 17 00:00:00 2001 From: fantasticit Date: Thu, 26 May 2022 01:01:27 +0800 Subject: [PATCH] client: fix server render editor --- .../src/components/document/reader/index.tsx | 30 +++++++++++-------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/packages/client/src/components/document/reader/index.tsx b/packages/client/src/components/document/reader/index.tsx index c34ba1dd..3baa305f 100644 --- a/packages/client/src/components/document/reader/index.tsx +++ b/packages/client/src/components/document/reader/index.tsx @@ -14,6 +14,7 @@ import { useDocumentDetail } from 'data/document'; import { useUser } from 'data/user'; import { triggerJoinUser } from 'event'; import { useDocumentStyle } from 'hooks/use-document-style'; +import { useMount } from 'hooks/use-mount'; import { IsOnMobile } from 'hooks/use-on-mobile'; import { useWindowSize } from 'hooks/use-window-size'; import Router from 'next/router'; @@ -46,6 +47,7 @@ interface IProps { export const DocumentReader: React.FC = ({ documentId }) => { const { isMobile } = IsOnMobile.useHook(); + const mounted = useMount(); const [container, setContainer] = useState(); const { width: windowWidth } = useWindowSize(); const { width, fontSize } = useDocumentStyle(); @@ -152,19 +154,21 @@ export const DocumentReader: React.FC = ({ documentId }) => { normalContent={() => ( <> - - - - } - /> + {mounted && ( + + + + } + /> + )} {!isMobile && authority && authority.editable && container && ( container} visibilityHeight={200}>