mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-18 23:07:02 +08:00
test: add test case for blocksuite editor (#1528)
This commit is contained in:
41
apps/web/src/pages/_debug/init-page.dev.tsx
Normal file
41
apps/web/src/pages/_debug/init-page.dev.tsx
Normal file
@@ -0,0 +1,41 @@
|
||||
import { NoSsr } from '@mui/material';
|
||||
import dynamic from 'next/dynamic';
|
||||
import { useRouter } from 'next/router';
|
||||
|
||||
import { StyledPage, StyledWrapper } from '../../layouts/styles';
|
||||
import { NextPageWithLayout } from '../../shared';
|
||||
import { initPage } from '../../utils/blocksuite';
|
||||
|
||||
const Editor = dynamic(
|
||||
() => import('../../components/__debug__/client/Editor'),
|
||||
{
|
||||
ssr: false,
|
||||
}
|
||||
);
|
||||
|
||||
const InitPagePage: NextPageWithLayout = () => {
|
||||
const router = useRouter();
|
||||
if (!router.isReady) {
|
||||
return <>loading...</>;
|
||||
}
|
||||
let testType: 'empty' | 'importMarkdown' = 'empty';
|
||||
if (router.query.type === 'importMarkdown') {
|
||||
testType = 'importMarkdown';
|
||||
} else if (router.query.type === 'empty') {
|
||||
testType = 'empty';
|
||||
}
|
||||
return (
|
||||
<StyledPage>
|
||||
<StyledWrapper>
|
||||
<Editor onInit={initPage} testType={testType} />
|
||||
<div id="toolWrapper" />
|
||||
</StyledWrapper>
|
||||
</StyledPage>
|
||||
);
|
||||
};
|
||||
|
||||
export default InitPagePage;
|
||||
|
||||
InitPagePage.getLayout = page => {
|
||||
return <NoSsr>{page}</NoSsr>;
|
||||
};
|
||||
@@ -23,6 +23,7 @@ import { useBlockSuiteWorkspaceAvatarUrl } from '../../../hooks/use-blocksuite-w
|
||||
import { useBlockSuiteWorkspaceName } from '../../../hooks/use-blocksuite-workspace-name';
|
||||
import { WorkspaceLayout } from '../../../layouts';
|
||||
import { NextPageWithLayout } from '../../../shared';
|
||||
import { initPage } from '../../../utils/blocksuite';
|
||||
|
||||
export const NavContainer = styled('div')(({ theme }) => {
|
||||
return {
|
||||
@@ -85,6 +86,7 @@ const PublicWorkspaceDetailPageInner: React.FC<{
|
||||
const { page } = editor;
|
||||
page.awarenessStore.setReadonly(page, true);
|
||||
}}
|
||||
onInit={initPage}
|
||||
header={
|
||||
<NavContainer>
|
||||
<Breadcrumbs>
|
||||
|
||||
Reference in New Issue
Block a user