mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-11 15:16:28 +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 dynamic from 'next/dynamic';
|
||||
import { styled, useTheme } from '@/styles';
|
||||
|
||||
import '@/components/simple-counter';
|
||||
|
||||
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 { changeMode, mode } = useTheme();
|
||||
return (
|
||||
@@ -36,6 +43,7 @@ const Home: NextPage = () => {
|
||||
>
|
||||
auto
|
||||
</button>
|
||||
<DynamicEditor />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user