mirror of
https://github.com/AppFlowy-IO/AppFlowy-Web.git
synced 2025-11-30 03:18:02 +08:00
chore: publish bug (#74)
This commit is contained in:
@@ -37,7 +37,7 @@ export const Document = (props: DocumentProps) => {
|
|||||||
const document = doc?.getMap(YjsEditorKey.data_section)?.get(YjsEditorKey.document);
|
const document = doc?.getMap(YjsEditorKey.data_section)?.get(YjsEditorKey.document);
|
||||||
|
|
||||||
const handleEnter = useCallback((text: string) => {
|
const handleEnter = useCallback((text: string) => {
|
||||||
if(!doc) return;
|
if (!doc) return;
|
||||||
const sharedRoot = doc.getMap(YjsEditorKey.data_section) as YSharedRoot;
|
const sharedRoot = doc.getMap(YjsEditorKey.data_section) as YSharedRoot;
|
||||||
|
|
||||||
appendFirstEmptyParagraph(sharedRoot, text);
|
appendFirstEmptyParagraph(sharedRoot, text);
|
||||||
@@ -46,17 +46,17 @@ export const Document = (props: DocumentProps) => {
|
|||||||
const ref = useRef<HTMLDivElement>(null);
|
const ref = useRef<HTMLDivElement>(null);
|
||||||
|
|
||||||
const handleRendered = useCallback(() => {
|
const handleRendered = useCallback(() => {
|
||||||
if(onRendered) {
|
if (onRendered) {
|
||||||
onRendered();
|
onRendered();
|
||||||
}
|
}
|
||||||
|
|
||||||
const el = ref.current;
|
const el = ref.current;
|
||||||
|
|
||||||
if(!el) return;
|
if (!el) return;
|
||||||
|
|
||||||
const scrollElement = el.closest('.MuiPaper-root');
|
const scrollElement = el.closest('.MuiPaper-root');
|
||||||
|
|
||||||
if(!scrollElement) {
|
if (!scrollElement) {
|
||||||
el.style.minHeight = `calc(100vh - 48px)`;
|
el.style.minHeight = `calc(100vh - 48px)`;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -64,7 +64,7 @@ export const Document = (props: DocumentProps) => {
|
|||||||
el.style.minHeight = `${scrollElement?.clientHeight - 64}px`;
|
el.style.minHeight = `${scrollElement?.clientHeight - 64}px`;
|
||||||
}, [onRendered]);
|
}, [onRendered]);
|
||||||
|
|
||||||
if(!document || !viewMeta.viewId || !viewMeta.workspaceId) return null;
|
if (!document || !viewMeta.viewId) return null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
||||||
|
|||||||
@@ -19,11 +19,11 @@ export interface CollabViewProps {
|
|||||||
doc?: YDoc;
|
doc?: YDoc;
|
||||||
}
|
}
|
||||||
|
|
||||||
function CollabView({ doc }: CollabViewProps) {
|
function CollabView ({ doc }: CollabViewProps) {
|
||||||
const visibleViewIds = usePublishContext()?.viewMeta?.visible_view_ids;
|
const visibleViewIds = usePublishContext()?.viewMeta?.visible_view_ids;
|
||||||
const { viewId, layout, icon, cover, layoutClassName, style, name } = useViewMeta();
|
const { viewId, layout, icon, cover, layoutClassName, style, name } = useViewMeta();
|
||||||
const View = useMemo(() => {
|
const View = useMemo(() => {
|
||||||
switch(layout) {
|
switch (layout) {
|
||||||
case ViewLayout.Document:
|
case ViewLayout.Document:
|
||||||
return Document;
|
return Document;
|
||||||
case ViewLayout.Grid:
|
case ViewLayout.Grid:
|
||||||
@@ -47,11 +47,11 @@ function CollabView({ doc }: CollabViewProps) {
|
|||||||
const className = useMemo(() => {
|
const className = useMemo(() => {
|
||||||
const classList = ['relative w-full flex-1'];
|
const classList = ['relative w-full flex-1'];
|
||||||
|
|
||||||
if(isTemplateThumb && layout !== ViewLayout.Document) {
|
if (isTemplateThumb && layout !== ViewLayout.Document) {
|
||||||
classList.push('flex justify-center h-full');
|
classList.push('flex justify-center h-full');
|
||||||
}
|
}
|
||||||
|
|
||||||
if(layoutClassName) {
|
if (layoutClassName) {
|
||||||
classList.push(layoutClassName);
|
classList.push(layoutClassName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,7 +59,7 @@ function CollabView({ doc }: CollabViewProps) {
|
|||||||
}, [isTemplateThumb, layout, layoutClassName]);
|
}, [isTemplateThumb, layout, layoutClassName]);
|
||||||
|
|
||||||
const skeleton = useMemo(() => {
|
const skeleton = useMemo(() => {
|
||||||
switch(layout) {
|
switch (layout) {
|
||||||
case ViewLayout.Grid:
|
case ViewLayout.Grid:
|
||||||
return <GridSkeleton />;
|
return <GridSkeleton />;
|
||||||
case ViewLayout.Board:
|
case ViewLayout.Board:
|
||||||
@@ -73,9 +73,9 @@ function CollabView({ doc }: CollabViewProps) {
|
|||||||
}
|
}
|
||||||
}, [layout]);
|
}, [layout]);
|
||||||
|
|
||||||
if(!View) return null;
|
if (!View) return null;
|
||||||
|
|
||||||
if(!doc) {
|
if (!doc) {
|
||||||
return skeleton;
|
return skeleton;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,7 +93,7 @@ function CollabView({ doc }: CollabViewProps) {
|
|||||||
className={className}
|
className={className}
|
||||||
>
|
>
|
||||||
<View
|
<View
|
||||||
workspaceId={''}
|
workspaceId={'publish'}
|
||||||
doc={doc}
|
doc={doc}
|
||||||
readOnly={true}
|
readOnly={true}
|
||||||
loadViewMeta={loadViewMeta}
|
loadViewMeta={loadViewMeta}
|
||||||
|
|||||||
Reference in New Issue
Block a user