diff --git a/src/components/document/Document.tsx b/src/components/document/Document.tsx index e2b5244f..bdc50f45 100644 --- a/src/components/document/Document.tsx +++ b/src/components/document/Document.tsx @@ -37,7 +37,7 @@ export const Document = (props: DocumentProps) => { const document = doc?.getMap(YjsEditorKey.data_section)?.get(YjsEditorKey.document); const handleEnter = useCallback((text: string) => { - if(!doc) return; + if (!doc) return; const sharedRoot = doc.getMap(YjsEditorKey.data_section) as YSharedRoot; appendFirstEmptyParagraph(sharedRoot, text); @@ -46,17 +46,17 @@ export const Document = (props: DocumentProps) => { const ref = useRef(null); const handleRendered = useCallback(() => { - if(onRendered) { + if (onRendered) { onRendered(); } const el = ref.current; - if(!el) return; + if (!el) return; const scrollElement = el.closest('.MuiPaper-root'); - if(!scrollElement) { + if (!scrollElement) { el.style.minHeight = `calc(100vh - 48px)`; return; } @@ -64,7 +64,7 @@ export const Document = (props: DocumentProps) => { el.style.minHeight = `${scrollElement?.clientHeight - 64}px`; }, [onRendered]); - if(!document || !viewMeta.viewId || !viewMeta.workspaceId) return null; + if (!document || !viewMeta.viewId) return null; return ( diff --git a/src/components/publish/CollabView.tsx b/src/components/publish/CollabView.tsx index 180d556b..26250ee4 100644 --- a/src/components/publish/CollabView.tsx +++ b/src/components/publish/CollabView.tsx @@ -19,11 +19,11 @@ export interface CollabViewProps { doc?: YDoc; } -function CollabView({ doc }: CollabViewProps) { +function CollabView ({ doc }: CollabViewProps) { const visibleViewIds = usePublishContext()?.viewMeta?.visible_view_ids; const { viewId, layout, icon, cover, layoutClassName, style, name } = useViewMeta(); const View = useMemo(() => { - switch(layout) { + switch (layout) { case ViewLayout.Document: return Document; case ViewLayout.Grid: @@ -47,11 +47,11 @@ function CollabView({ doc }: CollabViewProps) { const className = useMemo(() => { const classList = ['relative w-full flex-1']; - if(isTemplateThumb && layout !== ViewLayout.Document) { + if (isTemplateThumb && layout !== ViewLayout.Document) { classList.push('flex justify-center h-full'); } - if(layoutClassName) { + if (layoutClassName) { classList.push(layoutClassName); } @@ -59,7 +59,7 @@ function CollabView({ doc }: CollabViewProps) { }, [isTemplateThumb, layout, layoutClassName]); const skeleton = useMemo(() => { - switch(layout) { + switch (layout) { case ViewLayout.Grid: return ; case ViewLayout.Board: @@ -73,9 +73,9 @@ function CollabView({ doc }: CollabViewProps) { } }, [layout]); - if(!View) return null; + if (!View) return null; - if(!doc) { + if (!doc) { return skeleton; } @@ -93,7 +93,7 @@ function CollabView({ doc }: CollabViewProps) { className={className} >