mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-09-06 08:50:50 +08:00
feat: add block suite editor sample
This commit is contained in:
@@ -0,0 +1,28 @@
|
|||||||
|
import type { EditorContainer } from '@blocksuite/editor';
|
||||||
|
import '@blocksuite/blocks';
|
||||||
|
import '@blocksuite/editor';
|
||||||
|
import '@blocksuite/blocks/style';
|
||||||
|
|
||||||
|
export const Editor = () => {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
Editor
|
||||||
|
<editor-container />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface HTMLElementTagNameMap {
|
||||||
|
'editor-container': EditorContainer;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace JSX {
|
||||||
|
interface IntrinsicElements {
|
||||||
|
// TODO fix type error
|
||||||
|
'editor-container': any; // EditorContainer
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Editor;
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
import type { NextPage } from 'next';
|
import type { NextPage } from 'next';
|
||||||
|
import dynamic from 'next/dynamic';
|
||||||
import { styled, useTheme } from '@/styles';
|
import { styled, useTheme } from '@/styles';
|
||||||
|
|
||||||
import '@/components/simple-counter';
|
import '@/components/simple-counter';
|
||||||
|
|
||||||
const Button = styled('div')(({ theme }) => {
|
const Button = styled('div')(({ theme }) => {
|
||||||
@@ -8,6 +10,11 @@ const Button = styled('div')(({ theme }) => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const DynamicEditor = dynamic(() => import('../components/editor'), {
|
||||||
|
loading: () => <div>Loading...</div>,
|
||||||
|
ssr: false,
|
||||||
|
});
|
||||||
|
|
||||||
const Home: NextPage = () => {
|
const Home: NextPage = () => {
|
||||||
const { changeMode, mode } = useTheme();
|
const { changeMode, mode } = useTheme();
|
||||||
return (
|
return (
|
||||||
@@ -36,6 +43,7 @@ const Home: NextPage = () => {
|
|||||||
>
|
>
|
||||||
auto
|
auto
|
||||||
</button>
|
</button>
|
||||||
|
<DynamicEditor />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user