mirror of https://github.com/fantasticit/think.git
client: clean code
parent
9c1d9bd15d
commit
70d3879a85
|
@ -48,12 +48,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 mounted = useMount();
|
||||||
const [container, setContainer] = useState<HTMLDivElement>();
|
|
||||||
const { width: windowWidth } = useWindowSize();
|
const { width: windowWidth } = useWindowSize();
|
||||||
const { width, fontSize } = useDocumentStyle();
|
|
||||||
const editorWrapClassNames = useMemo(() => {
|
|
||||||
return width === 'standardWidth' ? styles.isStandardWidth : styles.isFullWidth;
|
|
||||||
}, [width]);
|
|
||||||
const { user } = useUser();
|
const { user } = useUser();
|
||||||
const { data: documentAndAuth, loading: docAuthLoading, error: docAuthError } = useDocumentDetail(documentId);
|
const { data: documentAndAuth, loading: docAuthLoading, error: docAuthError } = useDocumentDetail(documentId);
|
||||||
const { document, authority } = documentAndAuth || {};
|
const { document, authority } = documentAndAuth || {};
|
||||||
|
@ -102,8 +97,6 @@ export const DocumentReader: React.FC<IProps> = ({ documentId }) => {
|
||||||
);
|
);
|
||||||
}, [document, documentId, readable, editable, gotoEdit]);
|
}, [document, documentId, readable, editable, gotoEdit]);
|
||||||
|
|
||||||
const editBtnStyle = useMemo(() => getEditBtnStyle(isMobile ? 16 : 100), [isMobile]);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.wrap}>
|
<div className={styles.wrap}>
|
||||||
<Header className={styles.headerWrap}>
|
<Header className={styles.headerWrap}>
|
||||||
|
@ -121,7 +114,7 @@ export const DocumentReader: React.FC<IProps> = ({ documentId }) => {
|
||||||
ellipsis={{
|
ellipsis={{
|
||||||
showTooltip: { opts: { content: document.title, style: { wordBreak: 'break-all' } } },
|
showTooltip: { opts: { content: document.title, style: { wordBreak: 'break-all' } } },
|
||||||
}}
|
}}
|
||||||
style={{ width: isMobile ? windowWidth - 100 : ~~(windowWidth / 4) }}
|
style={{ width: isMobile ? windowWidth - 100 : ~~(windowWidth / 3) }}
|
||||||
>
|
>
|
||||||
{document.title}
|
{document.title}
|
||||||
</Text>
|
</Text>
|
||||||
|
@ -161,13 +154,6 @@ export const DocumentReader: React.FC<IProps> = ({ documentId }) => {
|
||||||
onAwarenessUpdate={triggerJoinUser}
|
onAwarenessUpdate={triggerJoinUser}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{/* {!isMobile && authority && authority.editable && container && (
|
|
||||||
<BackTop style={editBtnStyle} onClick={gotoEdit} target={() => container} visibilityHeight={200}>
|
|
||||||
<IconEdit />
|
|
||||||
</BackTop>
|
|
||||||
)}
|
|
||||||
<ImageViewer containerSelector="#js-reader-container" />
|
|
||||||
{container && <BackTop style={{ bottom: 65, right: isMobile ? 16 : 100 }} target={() => container} />} */}
|
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
|
|
Loading…
Reference in New Issue