mirror of https://github.com/fantasticit/think.git
client: fix server render editor
This commit is contained in:
parent
85db72e0fe
commit
fb0e416065
|
@ -14,6 +14,7 @@ import { useDocumentDetail } from 'data/document';
|
||||||
import { useUser } from 'data/user';
|
import { useUser } from 'data/user';
|
||||||
import { triggerJoinUser } from 'event';
|
import { triggerJoinUser } from 'event';
|
||||||
import { useDocumentStyle } from 'hooks/use-document-style';
|
import { useDocumentStyle } from 'hooks/use-document-style';
|
||||||
|
import { useMount } from 'hooks/use-mount';
|
||||||
import { IsOnMobile } from 'hooks/use-on-mobile';
|
import { IsOnMobile } from 'hooks/use-on-mobile';
|
||||||
import { useWindowSize } from 'hooks/use-window-size';
|
import { useWindowSize } from 'hooks/use-window-size';
|
||||||
import Router from 'next/router';
|
import Router from 'next/router';
|
||||||
|
@ -46,6 +47,7 @@ interface IProps {
|
||||||
|
|
||||||
export const DocumentReader: React.FC<IProps> = ({ documentId }) => {
|
export const DocumentReader: React.FC<IProps> = ({ documentId }) => {
|
||||||
const { isMobile } = IsOnMobile.useHook();
|
const { isMobile } = IsOnMobile.useHook();
|
||||||
|
const mounted = useMount();
|
||||||
const [container, setContainer] = useState<HTMLDivElement>();
|
const [container, setContainer] = useState<HTMLDivElement>();
|
||||||
const { width: windowWidth } = useWindowSize();
|
const { width: windowWidth } = useWindowSize();
|
||||||
const { width, fontSize } = useDocumentStyle();
|
const { width, fontSize } = useDocumentStyle();
|
||||||
|
@ -152,19 +154,21 @@ export const DocumentReader: React.FC<IProps> = ({ documentId }) => {
|
||||||
normalContent={() => (
|
normalContent={() => (
|
||||||
<>
|
<>
|
||||||
<Seo title={document.title} />
|
<Seo title={document.title} />
|
||||||
<CollaborationEditor
|
{mounted && (
|
||||||
editable={false}
|
<CollaborationEditor
|
||||||
user={user}
|
editable={false}
|
||||||
id={documentId}
|
user={user}
|
||||||
type="document"
|
id={documentId}
|
||||||
renderInEditorPortal={renderAuthor}
|
type="document"
|
||||||
onAwarenessUpdate={triggerJoinUser}
|
renderInEditorPortal={renderAuthor}
|
||||||
renderOnMount={
|
onAwarenessUpdate={triggerJoinUser}
|
||||||
<div className={styles.commentWrap}>
|
renderOnMount={
|
||||||
<CommentEditor documentId={documentId} />
|
<div className={styles.commentWrap}>
|
||||||
</div>
|
<CommentEditor documentId={documentId} />
|
||||||
}
|
</div>
|
||||||
/>
|
}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
{!isMobile && authority && authority.editable && container && (
|
{!isMobile && authority && authority.editable && container && (
|
||||||
<BackTop style={editBtnStyle} onClick={gotoEdit} target={() => container} visibilityHeight={200}>
|
<BackTop style={editBtnStyle} onClick={gotoEdit} target={() => container} visibilityHeight={200}>
|
||||||
<IconEdit />
|
<IconEdit />
|
||||||
|
|
Loading…
Reference in New Issue