mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 21:05:19 +00: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>;
|
||||
};
|
||||
Reference in New Issue
Block a user