chore: publish bug (#74)

This commit is contained in:
Kilu.He
2025-04-01 10:23:03 +08:00
committed by GitHub
parent 71c7ff52f2
commit b48205128a
2 changed files with 13 additions and 13 deletions

View File

@@ -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<HTMLDivElement>(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 (

View File

@@ -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 <GridSkeleton />;
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}
>
<View
workspaceId={''}
workspaceId={'publish'}
doc={doc}
readOnly={true}
loadViewMeta={loadViewMeta}