feat(core): add new loading doc component (#11737)
This commit is contained in:
1 parent
bfecd1856b
commit
c2c106f508
28 files changed
+253
-84
No files matched your search
BIN
Binary file not shown.
|
After Width: | Height: | Size: 102 KiB |
BIN
Binary file not shown.
|
After Width: | Height: | Size: 126 KiB |
@@ -1,18 +1,84 @@
|
|||||||
import { cssVar } from '@toeverything/theme';
|
import { cssVar } from '@toeverything/theme';
|
||||||
|
import { cssVarV2 } from '@toeverything/theme/v2';
|
||||||
import { style } from '@vanilla-extract/css';
|
import { style } from '@vanilla-extract/css';
|
||||||
export const pageDetailSkeletonStyle = style({
|
export const pageDetailSkeletonStyle = style({
|
||||||
padding: '0 20px',
|
padding: '0 20px',
|
||||||
});
|
height: '100%',
|
||||||
export const pageDetailSkeletonTitleStyle = style({
|
display: 'flex',
|
||||||
height: '52px',
|
flexDirection: 'column',
|
||||||
width: '100%',
|
justifyContent: 'center',
|
||||||
|
alignItems: 'center',
|
||||||
});
|
});
|
||||||
export const blockSuiteEditorStyle = style({
|
export const blockSuiteEditorStyle = style({
|
||||||
maxWidth: cssVar('editorWidth'),
|
maxWidth: cssVar('editorWidth'),
|
||||||
margin: '0 2rem',
|
margin: 'auto 2rem',
|
||||||
padding: '0 24px',
|
padding: '0 24px',
|
||||||
|
display: 'flex',
|
||||||
|
flexDirection: 'column',
|
||||||
|
justifyContent: 'center',
|
||||||
|
alignItems: 'center',
|
||||||
|
height: '100%',
|
||||||
});
|
});
|
||||||
export const blockSuiteEditorHeaderStyle = style({
|
export const illustration = style({
|
||||||
marginTop: '40px',
|
maxWidth: '100%',
|
||||||
marginBottom: '40px',
|
width: 300,
|
||||||
|
alignSelf: 'center',
|
||||||
|
});
|
||||||
|
export const content = style({
|
||||||
|
width: '100%',
|
||||||
|
textAlign: 'center',
|
||||||
|
maxWidth: '261px',
|
||||||
|
display: 'flex',
|
||||||
|
flexDirection: 'column',
|
||||||
|
alignItems: 'center',
|
||||||
|
justifyContent: 'center',
|
||||||
|
margin: '16px auto 0',
|
||||||
|
selectors: {
|
||||||
|
'&[data-longer-loading="true"]': {
|
||||||
|
maxWidth: '400px',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
export const loadingIcon = style({
|
||||||
|
marginRight: '8px',
|
||||||
|
});
|
||||||
|
export const title = style({
|
||||||
|
fontSize: cssVar('fontBase'),
|
||||||
|
lineHeight: 1.6,
|
||||||
|
fontWeight: 500,
|
||||||
|
color: cssVarV2('text/primary'),
|
||||||
|
textAlign: 'center',
|
||||||
|
display: 'flex',
|
||||||
|
alignItems: 'center',
|
||||||
|
justifyContent: 'center',
|
||||||
|
gap: '8px',
|
||||||
|
marginBottom: '4px',
|
||||||
|
});
|
||||||
|
export const text = style({
|
||||||
|
fontSize: cssVar('fontSm'),
|
||||||
|
lineHeight: 1.6,
|
||||||
|
fontWeight: 400,
|
||||||
|
color: cssVarV2('text/secondary'),
|
||||||
|
textWrap: 'wrap',
|
||||||
|
wordBreak: 'break-word',
|
||||||
|
textAlign: 'center',
|
||||||
|
selectors: {
|
||||||
|
'&[data-longer-loading="true"]': {
|
||||||
|
textAlign: 'start',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
export const actionButton = style({ marginTop: '24px' });
|
||||||
|
export const mobileActionButton = style({
|
||||||
|
padding: '8px 18px',
|
||||||
|
height: 'auto',
|
||||||
|
fontWeight: 600,
|
||||||
|
marginTop: '24px',
|
||||||
|
});
|
||||||
|
|
||||||
|
export const actionContent = style({
|
||||||
|
padding: '0 4px',
|
||||||
|
});
|
||||||
|
export const mobileActionContent = style({
|
||||||
|
padding: '0 4px',
|
||||||
});
|
});
|
||||||
@@ -1,28 +1,89 @@
|
|||||||
import { Skeleton } from '../../ui/skeleton';
|
import { Trans, useI18n } from '@affine/i18n';
|
||||||
import {
|
import clsx from 'clsx';
|
||||||
blockSuiteEditorHeaderStyle,
|
import { useCallback } from 'react';
|
||||||
blockSuiteEditorStyle,
|
|
||||||
pageDetailSkeletonStyle,
|
|
||||||
pageDetailSkeletonTitleStyle,
|
|
||||||
} from './index.css';
|
|
||||||
|
|
||||||
export const EditorLoading = () => {
|
import { Button } from '../../ui/button';
|
||||||
|
import { Loading } from '../../ui/loading';
|
||||||
|
import { ThemedImg } from '../../ui/themed-img';
|
||||||
|
import imageUrlForDarkLoading from './assets/loading.dark.png';
|
||||||
|
import imageUrlForLightLoading from './assets/loading.light.png';
|
||||||
|
import * as styles from './index.css';
|
||||||
|
|
||||||
|
export const EditorLoading = ({
|
||||||
|
longerLoading = false,
|
||||||
|
}: {
|
||||||
|
longerLoading?: boolean;
|
||||||
|
}) => {
|
||||||
|
const t = useI18n();
|
||||||
|
const reloadPage = useCallback(() => {
|
||||||
|
document.location.reload();
|
||||||
|
}, []);
|
||||||
return (
|
return (
|
||||||
<div className={blockSuiteEditorStyle}>
|
<div className={styles.blockSuiteEditorStyle}>
|
||||||
<Skeleton
|
<ThemedImg
|
||||||
className={blockSuiteEditorHeaderStyle}
|
style={{ width: '300px' }}
|
||||||
animation="wave"
|
draggable={false}
|
||||||
height={50}
|
className={styles.illustration}
|
||||||
|
lightSrc={imageUrlForLightLoading}
|
||||||
|
darkSrc={imageUrlForDarkLoading}
|
||||||
/>
|
/>
|
||||||
<Skeleton animation="wave" height={30} width="40%" />
|
{longerLoading ? (
|
||||||
|
<div className={styles.content} data-longer-loading={true}>
|
||||||
|
<div>
|
||||||
|
<div className={styles.text} data-longer-loading={true}>
|
||||||
|
{t['com.affine.error.loading-timeout-error']()}
|
||||||
|
</div>
|
||||||
|
<div className={styles.text} data-longer-loading={true}>
|
||||||
|
<Trans
|
||||||
|
i18nKey="com.affine.error.contact-us"
|
||||||
|
components={{
|
||||||
|
1: (
|
||||||
|
<a
|
||||||
|
style={{ color: 'var(--affine-primary-color)' }}
|
||||||
|
href="https://community.affine.pro"
|
||||||
|
target="__blank"
|
||||||
|
/>
|
||||||
|
),
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<Button
|
||||||
|
size="large"
|
||||||
|
className={clsx(
|
||||||
|
BUILD_CONFIG.isMobileEdition
|
||||||
|
? styles.mobileActionButton
|
||||||
|
: styles.actionButton
|
||||||
|
)}
|
||||||
|
contentClassName={clsx(
|
||||||
|
BUILD_CONFIG.isMobileEdition
|
||||||
|
? styles.mobileActionContent
|
||||||
|
: styles.actionContent
|
||||||
|
)}
|
||||||
|
onClick={reloadPage}
|
||||||
|
variant="primary"
|
||||||
|
>
|
||||||
|
{t['com.affine.error.reload']()}
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<div className={styles.content}>
|
||||||
|
<div className={styles.title}>
|
||||||
|
<Loading size={20} className={styles.loadingIcon} />
|
||||||
|
{t['com.affine.loading']()}
|
||||||
|
</div>
|
||||||
|
<div className={styles.text}>
|
||||||
|
{t['com.affine.loading.description']()}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const PageDetailSkeleton = () => {
|
export const PageDetailLoading = () => {
|
||||||
return (
|
return (
|
||||||
<div className={pageDetailSkeletonStyle}>
|
<div className={styles.pageDetailSkeletonStyle}>
|
||||||
<div className={pageDetailSkeletonTitleStyle} />
|
|
||||||
<EditorLoading />
|
<EditorLoading />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import {
|
|||||||
fontStyleOptions,
|
fontStyleOptions,
|
||||||
} from '@affine/core/modules/editor-setting';
|
} from '@affine/core/modules/editor-setting';
|
||||||
import { FeatureFlagService } from '@affine/core/modules/feature-flag';
|
import { FeatureFlagService } from '@affine/core/modules/feature-flag';
|
||||||
|
import track from '@affine/track';
|
||||||
import {
|
import {
|
||||||
customImageProxyMiddleware,
|
customImageProxyMiddleware,
|
||||||
ImageProxyService,
|
ImageProxyService,
|
||||||
@@ -31,7 +32,6 @@ import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|||||||
|
|
||||||
import type { DefaultOpenProperty } from '../../components/doc-properties';
|
import type { DefaultOpenProperty } from '../../components/doc-properties';
|
||||||
import { BlocksuiteDocEditor, BlocksuiteEdgelessEditor } from './lit-adaper';
|
import { BlocksuiteDocEditor, BlocksuiteEdgelessEditor } from './lit-adaper';
|
||||||
import { NoPageRootError } from './no-page-error';
|
|
||||||
import * as styles from './styles.css';
|
import * as styles from './styles.css';
|
||||||
|
|
||||||
export interface AffineEditorContainer extends HTMLElement {
|
export interface AffineEditorContainer extends HTMLElement {
|
||||||
@@ -289,7 +289,8 @@ const BlockSuiteEditorImpl = ({
|
|||||||
|
|
||||||
export const BlockSuiteEditor = (props: EditorProps) => {
|
export const BlockSuiteEditor = (props: EditorProps) => {
|
||||||
const [isLoading, setIsLoading] = useState(true);
|
const [isLoading, setIsLoading] = useState(true);
|
||||||
const [error, setError] = useState<Error | null>(null);
|
const [longerLoading, setLongerLoading] = useState(false);
|
||||||
|
const [loadStartTime] = useState(Date.now());
|
||||||
|
|
||||||
const editorSetting = useService(EditorSettingService).editorSetting;
|
const editorSetting = useService(EditorSettingService).editorSetting;
|
||||||
const settings = useLiveData(
|
const settings = useLiveData(
|
||||||
@@ -319,28 +320,41 @@ export const BlockSuiteEditor = (props: EditorProps) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const timer = setTimeout(() => {
|
const timer = setTimeout(() => {
|
||||||
disposable.unsubscribe();
|
setLongerLoading(true);
|
||||||
setError(new NoPageRootError(props.page));
|
|
||||||
}, 20 * 1000);
|
}, 20 * 1000);
|
||||||
|
const reportErrorTimer = setTimeout(() => {
|
||||||
|
if (isLoading) {
|
||||||
|
track.doc.$.$.loadDoc({
|
||||||
|
workspaceId: props.page.workspace.id,
|
||||||
|
docId: props.page.id,
|
||||||
|
// time cost in ms
|
||||||
|
time: Date.now() - loadStartTime,
|
||||||
|
success: false,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, 60 * 1000);
|
||||||
const disposable = props.page.slots.rootAdded.subscribe(() => {
|
const disposable = props.page.slots.rootAdded.subscribe(() => {
|
||||||
disposable.unsubscribe();
|
disposable.unsubscribe();
|
||||||
|
track.doc.$.$.loadDoc({
|
||||||
|
workspaceId: props.page.workspace.id,
|
||||||
|
docId: props.page.id,
|
||||||
|
time: Date.now() - loadStartTime,
|
||||||
|
success: true,
|
||||||
|
});
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
clearTimeout(timer);
|
setLongerLoading(false);
|
||||||
});
|
});
|
||||||
return () => {
|
return () => {
|
||||||
disposable.unsubscribe();
|
disposable.unsubscribe();
|
||||||
clearTimeout(timer);
|
clearTimeout(timer);
|
||||||
|
clearTimeout(reportErrorTimer);
|
||||||
};
|
};
|
||||||
}, [props.page]);
|
}, [isLoading, loadStartTime, props.page]);
|
||||||
|
|
||||||
if (error) {
|
|
||||||
throw error;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Slot style={{ '--affine-font-family': fontFamily } as CSSProperties}>
|
<Slot style={{ '--affine-font-family': fontFamily } as CSSProperties}>
|
||||||
{isLoading ? (
|
{isLoading ? (
|
||||||
<EditorLoading />
|
<EditorLoading longerLoading={longerLoading} />
|
||||||
) : (
|
) : (
|
||||||
<BlockSuiteEditorImpl key={props.page.id} {...props} />
|
<BlockSuiteEditorImpl key={props.page.id} {...props} />
|
||||||
)}
|
)}
|
||||||
|
|||||||
+9
-8
@@ -75,8 +75,7 @@ export const ErrorDetail: FC<ErrorDetailProps> = props => {
|
|||||||
}, [onButtonClick, resetError]);
|
}, [onButtonClick, resetError]);
|
||||||
|
|
||||||
const desc = descriptions.map((item, i) => (
|
const desc = descriptions.map((item, i) => (
|
||||||
// eslint-disable-next-line react/no-array-index-key
|
<p key={`error-desc-${i}`} className={styles.text}>
|
||||||
<p key={i} className={styles.text}>
|
|
||||||
{item}
|
{item}
|
||||||
</p>
|
</p>
|
||||||
));
|
));
|
||||||
@@ -137,15 +136,17 @@ export const ErrorDetail: FC<ErrorDetailProps> = props => {
|
|||||||
|
|
||||||
export function ContactUS() {
|
export function ContactUS() {
|
||||||
return (
|
return (
|
||||||
<Trans>
|
<Trans
|
||||||
If you are still experiencing this issue, please{' '}
|
i18nKey="com.affine.error.contact-us"
|
||||||
|
components={{
|
||||||
|
1: (
|
||||||
<a
|
<a
|
||||||
style={{ color: 'var(--affine-primary-color)' }}
|
style={{ color: 'var(--affine-primary-color)' }}
|
||||||
href="https://community.affine.pro"
|
href="https://community.affine.pro"
|
||||||
target="__blank"
|
target="__blank"
|
||||||
>
|
/>
|
||||||
contact us through the community.
|
),
|
||||||
</a>
|
}}
|
||||||
</Trans>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -1,20 +1,34 @@
|
|||||||
import { Scrollable } from '@affine/component';
|
import { Scrollable } from '@affine/component';
|
||||||
import { PageDetailSkeleton } from '@affine/component/page-detail-skeleton';
|
import { PageDetailLoading } from '@affine/component/page-detail-skeleton';
|
||||||
import type { ChatPanel } from '@affine/core/blocksuite/ai';
|
import type { ChatPanel } from '@affine/core/blocksuite/ai';
|
||||||
import { AIProvider } from '@affine/core/blocksuite/ai';
|
import { AIProvider } from '@affine/core/blocksuite/ai';
|
||||||
import type { AffineEditorContainer } from '@affine/core/blocksuite/block-suite-editor';
|
import type { AffineEditorContainer } from '@affine/core/blocksuite/block-suite-editor';
|
||||||
import { EditorOutlineViewer } from '@affine/core/blocksuite/outline-viewer';
|
import { EditorOutlineViewer } from '@affine/core/blocksuite/outline-viewer';
|
||||||
|
import { AffineErrorBoundary } from '@affine/core/components/affine/affine-error-boundary';
|
||||||
import { PageAIOnboarding } from '@affine/core/components/affine/ai-onboarding';
|
import { PageAIOnboarding } from '@affine/core/components/affine/ai-onboarding';
|
||||||
|
import { GlobalPageHistoryModal } from '@affine/core/components/affine/page-history-modal';
|
||||||
import { DocPropertySidebar } from '@affine/core/components/doc-properties/sidebar';
|
import { DocPropertySidebar } from '@affine/core/components/doc-properties/sidebar';
|
||||||
import { useGuard } from '@affine/core/components/guard';
|
import { useGuard } from '@affine/core/components/guard';
|
||||||
import { useAppSettingHelper } from '@affine/core/components/hooks/affine/use-app-setting-helper';
|
import { useAppSettingHelper } from '@affine/core/components/hooks/affine/use-app-setting-helper';
|
||||||
import { useEnableAI } from '@affine/core/components/hooks/affine/use-enable-ai';
|
import { useEnableAI } from '@affine/core/components/hooks/affine/use-enable-ai';
|
||||||
|
import { useRegisterBlocksuiteEditorCommands } from '@affine/core/components/hooks/affine/use-register-blocksuite-editor-commands';
|
||||||
|
import { useActiveBlocksuiteEditor } from '@affine/core/components/hooks/use-block-suite-editor';
|
||||||
|
import { PageDetailEditor } from '@affine/core/components/page-detail-editor';
|
||||||
|
import { TrashPageFooter } from '@affine/core/components/pure/trash-page-footer';
|
||||||
|
import { TopTip } from '@affine/core/components/top-tip';
|
||||||
import { DocService } from '@affine/core/modules/doc';
|
import { DocService } from '@affine/core/modules/doc';
|
||||||
import { EditorService } from '@affine/core/modules/editor';
|
import { EditorService } from '@affine/core/modules/editor';
|
||||||
import { GlobalContextService } from '@affine/core/modules/global-context';
|
import { GlobalContextService } from '@affine/core/modules/global-context';
|
||||||
import { PeekViewService } from '@affine/core/modules/peek-view';
|
import { PeekViewService } from '@affine/core/modules/peek-view';
|
||||||
import { RecentDocsService } from '@affine/core/modules/quicksearch';
|
import { RecentDocsService } from '@affine/core/modules/quicksearch';
|
||||||
import { ViewService } from '@affine/core/modules/workbench';
|
import {
|
||||||
|
useIsActiveView,
|
||||||
|
ViewBody,
|
||||||
|
ViewHeader,
|
||||||
|
ViewService,
|
||||||
|
ViewSidebarTab,
|
||||||
|
WorkbenchService,
|
||||||
|
} from '@affine/core/modules/workbench';
|
||||||
import { WorkspaceService } from '@affine/core/modules/workspace';
|
import { WorkspaceService } from '@affine/core/modules/workspace';
|
||||||
import { isNewTabTrigger } from '@affine/core/utils';
|
import { isNewTabTrigger } from '@affine/core/utils';
|
||||||
import track from '@affine/track';
|
import track from '@affine/track';
|
||||||
@@ -39,20 +53,6 @@ import { memo, useCallback, useEffect, useRef, useState } from 'react';
|
|||||||
import { useParams } from 'react-router-dom';
|
import { useParams } from 'react-router-dom';
|
||||||
import type { Subscription } from 'rxjs';
|
import type { Subscription } from 'rxjs';
|
||||||
|
|
||||||
import { AffineErrorBoundary } from '../../../../components/affine/affine-error-boundary';
|
|
||||||
import { GlobalPageHistoryModal } from '../../../../components/affine/page-history-modal';
|
|
||||||
import { useRegisterBlocksuiteEditorCommands } from '../../../../components/hooks/affine/use-register-blocksuite-editor-commands';
|
|
||||||
import { useActiveBlocksuiteEditor } from '../../../../components/hooks/use-block-suite-editor';
|
|
||||||
import { PageDetailEditor } from '../../../../components/page-detail-editor';
|
|
||||||
import { TrashPageFooter } from '../../../../components/pure/trash-page-footer';
|
|
||||||
import { TopTip } from '../../../../components/top-tip';
|
|
||||||
import {
|
|
||||||
useIsActiveView,
|
|
||||||
ViewBody,
|
|
||||||
ViewHeader,
|
|
||||||
ViewSidebarTab,
|
|
||||||
WorkbenchService,
|
|
||||||
} from '../../../../modules/workbench';
|
|
||||||
import { PageNotFound } from '../../404';
|
import { PageNotFound } from '../../404';
|
||||||
import * as styles from './detail-page.css';
|
import * as styles from './detail-page.css';
|
||||||
import { DetailPageHeader } from './detail-page-header';
|
import { DetailPageHeader } from './detail-page-header';
|
||||||
@@ -386,7 +386,7 @@ export const Component = () => {
|
|||||||
<DetailPageWrapper
|
<DetailPageWrapper
|
||||||
pageId={pageId}
|
pageId={pageId}
|
||||||
canAccess={canAccess}
|
canAccess={canAccess}
|
||||||
skeleton={<PageDetailSkeleton />}
|
skeleton={<PageDetailLoading />}
|
||||||
notFound={<PageNotFound noPermission />}
|
notFound={<PageNotFound noPermission />}
|
||||||
>
|
>
|
||||||
<DetailPageImpl />
|
<DetailPageImpl />
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { useThemeColorV2 } from '@affine/component';
|
import { useThemeColorV2 } from '@affine/component';
|
||||||
import { PageDetailSkeleton } from '@affine/component/page-detail-skeleton';
|
import { PageDetailLoading } from '@affine/component/page-detail-skeleton';
|
||||||
import type { AffineEditorContainer } from '@affine/core/blocksuite/block-suite-editor';
|
import type { AffineEditorContainer } from '@affine/core/blocksuite/block-suite-editor';
|
||||||
import { AffineErrorBoundary } from '@affine/core/components/affine/affine-error-boundary';
|
import { AffineErrorBoundary } from '@affine/core/components/affine/affine-error-boundary';
|
||||||
import { useGuard } from '@affine/core/components/guard';
|
import { useGuard } from '@affine/core/components/guard';
|
||||||
@@ -223,7 +223,7 @@ const DetailPageImpl = () => {
|
|||||||
const getSkeleton = (back: boolean) => (
|
const getSkeleton = (back: boolean) => (
|
||||||
<>
|
<>
|
||||||
<PageHeader back={back} className={styles.header} />
|
<PageHeader back={back} className={styles.header} />
|
||||||
<PageDetailSkeleton />
|
<PageDetailLoading />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
const getNotFound = (back: boolean) => (
|
const getNotFound = (back: boolean) => (
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { Scrollable } from '@affine/component';
|
import { Scrollable } from '@affine/component';
|
||||||
import { PageDetailSkeleton } from '@affine/component/page-detail-skeleton';
|
import { PageDetailLoading } from '@affine/component/page-detail-skeleton';
|
||||||
import { AIProvider } from '@affine/core/blocksuite/ai';
|
import { AIProvider } from '@affine/core/blocksuite/ai';
|
||||||
import type { AffineEditorContainer } from '@affine/core/blocksuite/block-suite-editor';
|
import type { AffineEditorContainer } from '@affine/core/blocksuite/block-suite-editor';
|
||||||
import { EditorOutlineViewer } from '@affine/core/blocksuite/outline-viewer';
|
import { EditorOutlineViewer } from '@affine/core/blocksuite/outline-viewer';
|
||||||
@@ -160,7 +160,7 @@ function DocPeekPreviewEditor({
|
|||||||
<Scrollable.Viewport
|
<Scrollable.Viewport
|
||||||
className={clsx('affine-page-viewport', styles.affineDocViewport)}
|
className={clsx('affine-page-viewport', styles.affineDocViewport)}
|
||||||
>
|
>
|
||||||
<Suspense fallback={<PageDetailSkeleton />}>
|
<Suspense fallback={<PageDetailLoading />}>
|
||||||
<BlockSuiteEditor
|
<BlockSuiteEditor
|
||||||
className={styles.editor}
|
className={styles.editor}
|
||||||
mode={mode}
|
mode={mode}
|
||||||
@@ -224,7 +224,7 @@ export function DocPeekPreview({
|
|||||||
// if sync engine has been synced and the page is null, show 404 page.
|
// if sync engine has been synced and the page is null, show 404 page.
|
||||||
if (!doc || !editor || !canAccess) {
|
if (!doc || !editor || !canAccess) {
|
||||||
return loading || canAccess === undefined ? (
|
return loading || canAccess === undefined ? (
|
||||||
<PageDetailSkeleton key="current-page-is-null" />
|
<PageDetailLoading key="current-page-is-null" />
|
||||||
) : (
|
) : (
|
||||||
<PageNotFound noPermission />
|
<PageNotFound noPermission />
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1989,6 +1989,10 @@ export function useAFFiNEI18N(): {
|
|||||||
* `Doc content is missing`
|
* `Doc content is missing`
|
||||||
*/
|
*/
|
||||||
["com.affine.error.no-page-root.title"](): string;
|
["com.affine.error.no-page-root.title"](): string;
|
||||||
|
/**
|
||||||
|
* `It takes longer to load the doc content.`
|
||||||
|
*/
|
||||||
|
["com.affine.error.loading-timeout-error"](): string;
|
||||||
/**
|
/**
|
||||||
* `Refetch`
|
* `Refetch`
|
||||||
*/
|
*/
|
||||||
@@ -2596,9 +2600,13 @@ export function useAFFiNEI18N(): {
|
|||||||
*/
|
*/
|
||||||
["com.affine.lastYear"](): string;
|
["com.affine.lastYear"](): string;
|
||||||
/**
|
/**
|
||||||
* `Loading...`
|
* `Loading`
|
||||||
*/
|
*/
|
||||||
["com.affine.loading"](): string;
|
["com.affine.loading"](): string;
|
||||||
|
/**
|
||||||
|
* `Loading document content, please wait a moment.`
|
||||||
|
*/
|
||||||
|
["com.affine.loading.description"](): string;
|
||||||
/**
|
/**
|
||||||
* `Rename`
|
* `Rename`
|
||||||
*/
|
*/
|
||||||
@@ -8417,6 +8425,12 @@ export const TypedTrans: {
|
|||||||
}, {
|
}, {
|
||||||
["2"]: JSX.Element;
|
["2"]: JSX.Element;
|
||||||
}>>;
|
}>>;
|
||||||
|
/**
|
||||||
|
* `If you are still experiencing this issue, please <1>contact us through the community</1>.`
|
||||||
|
*/
|
||||||
|
["com.affine.error.contact-us"]: ComponentType<TypedTransProps<Readonly<{}>, {
|
||||||
|
["1"]: JSX.Element;
|
||||||
|
}>>;
|
||||||
/**
|
/**
|
||||||
* `With the workspace creator's free account, every member can access up to <1>7 days<1> of version history.`
|
* `With the workspace creator's free account, every member can access up to <1>7 days<1> of version history.`
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -642,7 +642,7 @@
|
|||||||
"com.affine.lastMonth": "الشهر الماضي",
|
"com.affine.lastMonth": "الشهر الماضي",
|
||||||
"com.affine.lastWeek": "الأسبوع الماضي",
|
"com.affine.lastWeek": "الأسبوع الماضي",
|
||||||
"com.affine.lastYear": "العام الماضي",
|
"com.affine.lastYear": "العام الماضي",
|
||||||
"com.affine.loading": "جاري التحميل...",
|
"com.affine.loading": "جاري التحميل",
|
||||||
"com.affine.menu.rename": "إعادة التسمية",
|
"com.affine.menu.rename": "إعادة التسمية",
|
||||||
"com.affine.mobile.search.empty": "لم يتم العثور على نتائج",
|
"com.affine.mobile.search.empty": "لم يتم العثور على نتائج",
|
||||||
"com.affine.mobile.setting.about.appVersion": "إصدار التطبيق",
|
"com.affine.mobile.setting.about.appVersion": "إصدار التطبيق",
|
||||||
|
|||||||
@@ -642,7 +642,7 @@
|
|||||||
"com.affine.lastMonth": "Letzter Monat",
|
"com.affine.lastMonth": "Letzter Monat",
|
||||||
"com.affine.lastWeek": "Letzte Woche",
|
"com.affine.lastWeek": "Letzte Woche",
|
||||||
"com.affine.lastYear": "Letztes Jahr",
|
"com.affine.lastYear": "Letztes Jahr",
|
||||||
"com.affine.loading": "Laden...",
|
"com.affine.loading": "Laden",
|
||||||
"com.affine.menu.rename": "Umbenennen",
|
"com.affine.menu.rename": "Umbenennen",
|
||||||
"com.affine.mobile.search.empty": "Keine Ergebnisse gefunden",
|
"com.affine.mobile.search.empty": "Keine Ergebnisse gefunden",
|
||||||
"com.affine.mobile.setting.about.appVersion": "App-Version",
|
"com.affine.mobile.setting.about.appVersion": "App-Version",
|
||||||
|
|||||||
@@ -642,7 +642,7 @@
|
|||||||
"com.affine.lastMonth": "Προηγούμενος μήνας",
|
"com.affine.lastMonth": "Προηγούμενος μήνας",
|
||||||
"com.affine.lastWeek": "Προηγούμενη εβδομάδα",
|
"com.affine.lastWeek": "Προηγούμενη εβδομάδα",
|
||||||
"com.affine.lastYear": "Προηγούμενο έτος",
|
"com.affine.lastYear": "Προηγούμενο έτος",
|
||||||
"com.affine.loading": "Φόρτωση...",
|
"com.affine.loading": "Φόρτωση",
|
||||||
"com.affine.menu.rename": "Μετονομασία",
|
"com.affine.menu.rename": "Μετονομασία",
|
||||||
"com.affine.mobile.search.empty": "Δεν βρέθηκαν αποτελέσματα",
|
"com.affine.mobile.search.empty": "Δεν βρέθηκαν αποτελέσματα",
|
||||||
"com.affine.mobile.setting.about.appVersion": "Έκδοση εφαρμογής",
|
"com.affine.mobile.setting.about.appVersion": "Έκδοση εφαρμογής",
|
||||||
|
|||||||
@@ -496,6 +496,8 @@
|
|||||||
"com.affine.enableAffineCloudModal.custom-server.enable": "Enable Cloud",
|
"com.affine.enableAffineCloudModal.custom-server.enable": "Enable Cloud",
|
||||||
"com.affine.error.hide-error": "Hide error",
|
"com.affine.error.hide-error": "Hide error",
|
||||||
"com.affine.error.no-page-root.title": "Doc content is missing",
|
"com.affine.error.no-page-root.title": "Doc content is missing",
|
||||||
|
"com.affine.error.loading-timeout-error": "It takes longer to load the doc content.",
|
||||||
|
"com.affine.error.contact-us": "If you are still experiencing this issue, please <1>contact us through the community</1>.",
|
||||||
"com.affine.error.refetch": "Refetch",
|
"com.affine.error.refetch": "Refetch",
|
||||||
"com.affine.error.reload": "Reload AFFiNE",
|
"com.affine.error.reload": "Reload AFFiNE",
|
||||||
"com.affine.error.retry": "Refresh",
|
"com.affine.error.retry": "Refresh",
|
||||||
@@ -647,7 +649,8 @@
|
|||||||
"com.affine.lastMonth": "Last month",
|
"com.affine.lastMonth": "Last month",
|
||||||
"com.affine.lastWeek": "Last week",
|
"com.affine.lastWeek": "Last week",
|
||||||
"com.affine.lastYear": "Last year",
|
"com.affine.lastYear": "Last year",
|
||||||
"com.affine.loading": "Loading...",
|
"com.affine.loading": "Loading",
|
||||||
|
"com.affine.loading.description": "Loading document content, please wait a moment.",
|
||||||
"com.affine.menu.rename": "Rename",
|
"com.affine.menu.rename": "Rename",
|
||||||
"com.affine.mobile.search.empty": "No results found",
|
"com.affine.mobile.search.empty": "No results found",
|
||||||
"com.affine.mobile.setting.about.appVersion": "App version",
|
"com.affine.mobile.setting.about.appVersion": "App version",
|
||||||
|
|||||||
@@ -642,7 +642,7 @@
|
|||||||
"com.affine.lastMonth": "Mes pasado",
|
"com.affine.lastMonth": "Mes pasado",
|
||||||
"com.affine.lastWeek": "La semana pasada",
|
"com.affine.lastWeek": "La semana pasada",
|
||||||
"com.affine.lastYear": "El año pasado",
|
"com.affine.lastYear": "El año pasado",
|
||||||
"com.affine.loading": "Cargando...",
|
"com.affine.loading": "Cargando",
|
||||||
"com.affine.menu.rename": "Renombrar",
|
"com.affine.menu.rename": "Renombrar",
|
||||||
"com.affine.mobile.search.empty": "No se encontraron resultados",
|
"com.affine.mobile.search.empty": "No se encontraron resultados",
|
||||||
"com.affine.mobile.setting.about.appVersion": "Versión de la Aplicación",
|
"com.affine.mobile.setting.about.appVersion": "Versión de la Aplicación",
|
||||||
|
|||||||
@@ -642,7 +642,7 @@
|
|||||||
"com.affine.lastMonth": "ماه گذشته",
|
"com.affine.lastMonth": "ماه گذشته",
|
||||||
"com.affine.lastWeek": "هفته گذشته",
|
"com.affine.lastWeek": "هفته گذشته",
|
||||||
"com.affine.lastYear": "سال گذشته",
|
"com.affine.lastYear": "سال گذشته",
|
||||||
"com.affine.loading": "در حال بارگذاری...",
|
"com.affine.loading": "در حال بارگذاری",
|
||||||
"com.affine.menu.rename": "تغییر نام",
|
"com.affine.menu.rename": "تغییر نام",
|
||||||
"com.affine.mobile.search.empty": "نتیجهای یافت نشد",
|
"com.affine.mobile.search.empty": "نتیجهای یافت نشد",
|
||||||
"com.affine.mobile.setting.about.appVersion": "نسخه برنامه",
|
"com.affine.mobile.setting.about.appVersion": "نسخه برنامه",
|
||||||
|
|||||||
@@ -642,7 +642,7 @@
|
|||||||
"com.affine.lastMonth": "Le mois dernier",
|
"com.affine.lastMonth": "Le mois dernier",
|
||||||
"com.affine.lastWeek": "La semaine dernière ",
|
"com.affine.lastWeek": "La semaine dernière ",
|
||||||
"com.affine.lastYear": "L'année dernière ",
|
"com.affine.lastYear": "L'année dernière ",
|
||||||
"com.affine.loading": "Chargement...",
|
"com.affine.loading": "Chargement",
|
||||||
"com.affine.menu.rename": "Renommer",
|
"com.affine.menu.rename": "Renommer",
|
||||||
"com.affine.mobile.search.empty": "Aucun résultat trouvé",
|
"com.affine.mobile.search.empty": "Aucun résultat trouvé",
|
||||||
"com.affine.mobile.setting.about.appVersion": "Version de l'application",
|
"com.affine.mobile.setting.about.appVersion": "Version de l'application",
|
||||||
|
|||||||
@@ -642,7 +642,7 @@
|
|||||||
"com.affine.lastMonth": "Ultimo mese",
|
"com.affine.lastMonth": "Ultimo mese",
|
||||||
"com.affine.lastWeek": "Ultima settimana",
|
"com.affine.lastWeek": "Ultima settimana",
|
||||||
"com.affine.lastYear": "Ultimo anno",
|
"com.affine.lastYear": "Ultimo anno",
|
||||||
"com.affine.loading": "Caricamento...",
|
"com.affine.loading": "Caricamento",
|
||||||
"com.affine.menu.rename": "Rinomina",
|
"com.affine.menu.rename": "Rinomina",
|
||||||
"com.affine.mobile.search.empty": "Nessun risultato trovato",
|
"com.affine.mobile.search.empty": "Nessun risultato trovato",
|
||||||
"com.affine.mobile.setting.about.appVersion": "Versione dell'app",
|
"com.affine.mobile.setting.about.appVersion": "Versione dell'app",
|
||||||
|
|||||||
@@ -642,7 +642,7 @@
|
|||||||
"com.affine.lastMonth": "先月",
|
"com.affine.lastMonth": "先月",
|
||||||
"com.affine.lastWeek": "先週",
|
"com.affine.lastWeek": "先週",
|
||||||
"com.affine.lastYear": "昨年",
|
"com.affine.lastYear": "昨年",
|
||||||
"com.affine.loading": "読み込み中...",
|
"com.affine.loading": "読み込み中",
|
||||||
"com.affine.menu.rename": "名前の変更",
|
"com.affine.menu.rename": "名前の変更",
|
||||||
"com.affine.mobile.search.empty": "結果が見つかりません",
|
"com.affine.mobile.search.empty": "結果が見つかりません",
|
||||||
"com.affine.mobile.setting.about.appVersion": "アプリ版",
|
"com.affine.mobile.setting.about.appVersion": "アプリ版",
|
||||||
|
|||||||
@@ -809,7 +809,7 @@
|
|||||||
"com.affine.lastMonth": "지난 달",
|
"com.affine.lastMonth": "지난 달",
|
||||||
"com.affine.lastWeek": "지난 주",
|
"com.affine.lastWeek": "지난 주",
|
||||||
"com.affine.lastYear": "지난 해",
|
"com.affine.lastYear": "지난 해",
|
||||||
"com.affine.loading": "로딩...",
|
"com.affine.loading": "로딩",
|
||||||
"com.affine.moreThan30Days": "한 달 이상",
|
"com.affine.moreThan30Days": "한 달 이상",
|
||||||
"com.affine.moveToTrash.confirmModal.description": "{{title}} 을(를) 휴지통으로 옮김",
|
"com.affine.moveToTrash.confirmModal.description": "{{title}} 을(를) 휴지통으로 옮김",
|
||||||
"com.affine.moveToTrash.confirmModal.description.multiple": "{{ number }} 페이지를 휴지통으로 옮김",
|
"com.affine.moveToTrash.confirmModal.description.multiple": "{{ number }} 페이지를 휴지통으로 옮김",
|
||||||
|
|||||||
@@ -642,7 +642,7 @@
|
|||||||
"com.affine.lastMonth": "Ostatni miesiąc",
|
"com.affine.lastMonth": "Ostatni miesiąc",
|
||||||
"com.affine.lastWeek": "Ostatni tydzień",
|
"com.affine.lastWeek": "Ostatni tydzień",
|
||||||
"com.affine.lastYear": "Ostatni rok",
|
"com.affine.lastYear": "Ostatni rok",
|
||||||
"com.affine.loading": "Ładowanie...",
|
"com.affine.loading": "Ładowanie",
|
||||||
"com.affine.menu.rename": "Zmień nazwę",
|
"com.affine.menu.rename": "Zmień nazwę",
|
||||||
"com.affine.mobile.search.empty": "Nie znaleziono wyników",
|
"com.affine.mobile.search.empty": "Nie znaleziono wyników",
|
||||||
"com.affine.mobile.setting.about.appVersion": "Wersja aplikacji",
|
"com.affine.mobile.setting.about.appVersion": "Wersja aplikacji",
|
||||||
|
|||||||
@@ -642,7 +642,7 @@
|
|||||||
"com.affine.lastMonth": "Mês passado",
|
"com.affine.lastMonth": "Mês passado",
|
||||||
"com.affine.lastWeek": "Semana passada",
|
"com.affine.lastWeek": "Semana passada",
|
||||||
"com.affine.lastYear": "Ano passado",
|
"com.affine.lastYear": "Ano passado",
|
||||||
"com.affine.loading": "Carregando...",
|
"com.affine.loading": "Carregando",
|
||||||
"com.affine.menu.rename": "Renomear",
|
"com.affine.menu.rename": "Renomear",
|
||||||
"com.affine.mobile.search.empty": "Nenhum resultado encontrado",
|
"com.affine.mobile.search.empty": "Nenhum resultado encontrado",
|
||||||
"com.affine.mobile.setting.about.appVersion": "Versão do aplicativo",
|
"com.affine.mobile.setting.about.appVersion": "Versão do aplicativo",
|
||||||
|
|||||||
@@ -642,7 +642,7 @@
|
|||||||
"com.affine.lastMonth": "Последний месяц",
|
"com.affine.lastMonth": "Последний месяц",
|
||||||
"com.affine.lastWeek": "Прошлая неделя",
|
"com.affine.lastWeek": "Прошлая неделя",
|
||||||
"com.affine.lastYear": "Прошлый год",
|
"com.affine.lastYear": "Прошлый год",
|
||||||
"com.affine.loading": "Загрузка...",
|
"com.affine.loading": "Загрузка",
|
||||||
"com.affine.menu.rename": "Переименовать",
|
"com.affine.menu.rename": "Переименовать",
|
||||||
"com.affine.mobile.search.empty": "Не найдено результатов",
|
"com.affine.mobile.search.empty": "Не найдено результатов",
|
||||||
"com.affine.mobile.setting.about.appVersion": "Версия приложения",
|
"com.affine.mobile.setting.about.appVersion": "Версия приложения",
|
||||||
|
|||||||
@@ -642,7 +642,7 @@
|
|||||||
"com.affine.lastMonth": "Senaste månaden",
|
"com.affine.lastMonth": "Senaste månaden",
|
||||||
"com.affine.lastWeek": "Senaste veckan",
|
"com.affine.lastWeek": "Senaste veckan",
|
||||||
"com.affine.lastYear": "Förra året",
|
"com.affine.lastYear": "Förra året",
|
||||||
"com.affine.loading": "Laddar...",
|
"com.affine.loading": "Laddar",
|
||||||
"com.affine.menu.rename": "Döp om",
|
"com.affine.menu.rename": "Döp om",
|
||||||
"com.affine.mobile.search.empty": "Inga resultat hittades",
|
"com.affine.mobile.search.empty": "Inga resultat hittades",
|
||||||
"com.affine.mobile.setting.about.appVersion": "App Version",
|
"com.affine.mobile.setting.about.appVersion": "App Version",
|
||||||
|
|||||||
@@ -642,7 +642,7 @@
|
|||||||
"com.affine.lastMonth": "Минулий місяць",
|
"com.affine.lastMonth": "Минулий місяць",
|
||||||
"com.affine.lastWeek": "Минулий тиждень",
|
"com.affine.lastWeek": "Минулий тиждень",
|
||||||
"com.affine.lastYear": "Минулий рік",
|
"com.affine.lastYear": "Минулий рік",
|
||||||
"com.affine.loading": "Завантаження...",
|
"com.affine.loading": "Завантаження",
|
||||||
"com.affine.menu.rename": "Перейменувати",
|
"com.affine.menu.rename": "Перейменувати",
|
||||||
"com.affine.mobile.search.empty": "Нічого не знайдено",
|
"com.affine.mobile.search.empty": "Нічого не знайдено",
|
||||||
"com.affine.mobile.setting.about.appVersion": "Версія додатка",
|
"com.affine.mobile.setting.about.appVersion": "Версія додатка",
|
||||||
|
|||||||
@@ -642,7 +642,7 @@
|
|||||||
"com.affine.lastMonth": "上个月",
|
"com.affine.lastMonth": "上个月",
|
||||||
"com.affine.lastWeek": "上周",
|
"com.affine.lastWeek": "上周",
|
||||||
"com.affine.lastYear": "去年",
|
"com.affine.lastYear": "去年",
|
||||||
"com.affine.loading": "加载中...",
|
"com.affine.loading": "加载中",
|
||||||
"com.affine.menu.rename": "重命名",
|
"com.affine.menu.rename": "重命名",
|
||||||
"com.affine.mobile.search.empty": "找到 0 个结果",
|
"com.affine.mobile.search.empty": "找到 0 个结果",
|
||||||
"com.affine.mobile.setting.about.appVersion": "应用版本",
|
"com.affine.mobile.setting.about.appVersion": "应用版本",
|
||||||
|
|||||||
@@ -642,7 +642,7 @@
|
|||||||
"com.affine.lastMonth": "上個月",
|
"com.affine.lastMonth": "上個月",
|
||||||
"com.affine.lastWeek": "上個星期",
|
"com.affine.lastWeek": "上個星期",
|
||||||
"com.affine.lastYear": "去年",
|
"com.affine.lastYear": "去年",
|
||||||
"com.affine.loading": "載入中⋯⋯",
|
"com.affine.loading": "載入中",
|
||||||
"com.affine.menu.rename": "重新命名",
|
"com.affine.menu.rename": "重新命名",
|
||||||
"com.affine.mobile.search.empty": "找到 0 個結果",
|
"com.affine.mobile.search.empty": "找到 0 個結果",
|
||||||
"com.affine.mobile.setting.about.appVersion": "App 版本",
|
"com.affine.mobile.setting.about.appVersion": "App 版本",
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ type DocEvents =
|
|||||||
| 'openDocOptionsMenu'
|
| 'openDocOptionsMenu'
|
||||||
| 'openDocInfo'
|
| 'openDocInfo'
|
||||||
| 'copyBlockToLink'
|
| 'copyBlockToLink'
|
||||||
|
| 'loadDoc'
|
||||||
| 'bookmark'
|
| 'bookmark'
|
||||||
| 'editProperty'
|
| 'editProperty'
|
||||||
| 'editPropertyMeta'
|
| 'editPropertyMeta'
|
||||||
@@ -409,6 +410,9 @@ const PageEvents = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
doc: {
|
doc: {
|
||||||
|
$: {
|
||||||
|
$: ['loadDoc'],
|
||||||
|
},
|
||||||
editor: {
|
editor: {
|
||||||
slashMenu: ['linkDoc', 'createDoc', 'bookmark'],
|
slashMenu: ['linkDoc', 'createDoc', 'bookmark'],
|
||||||
atMenu: [
|
atMenu: [
|
||||||
@@ -714,6 +718,12 @@ export type EventArgs = {
|
|||||||
type: 'member' | 'invite' | 'more';
|
type: 'member' | 'invite' | 'more';
|
||||||
};
|
};
|
||||||
noAccessPrompted: {};
|
noAccessPrompted: {};
|
||||||
|
loadDoc: {
|
||||||
|
workspaceId: string;
|
||||||
|
docId: string;
|
||||||
|
time: number;
|
||||||
|
success: boolean;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
// for type checking
|
// for type checking
|
||||||
|
|||||||
Reference in new issue
Block a user