chore:Update blocksuite dependency version (#525)

This commit is contained in:
xiaotian
2022-11-04 15:48:29 +08:00
committed by GitHub
parent 1ccc46ec72
commit 3b830e4c4a
4 changed files with 36 additions and 26 deletions

View File

@@ -9,8 +9,8 @@
"lint": "next lint"
},
"dependencies": {
"@blocksuite/blocks": "^0.2.24",
"@blocksuite/editor": "^0.2.24",
"@blocksuite/blocks": "0.3.0-alpha.0",
"@blocksuite/editor": "0.3.0-alpha.0",
"@emotion/css": "^11.10.0",
"@emotion/react": "^11.10.4",
"@emotion/server": "^11.10.0",

View File

@@ -78,11 +78,11 @@ const UndoRedo = () => {
const { editor } = useEditor();
useEffect(() => {
if (!editor) return;
const { store } = editor;
const { space } = editor;
store.signals.historyUpdated.on(() => {
setCanUndo(store.canUndo);
setCanRedo(store.canRedo);
space.signals.historyUpdated.on(() => {
setCanUndo(space.canUndo);
setCanRedo(space.canRedo);
});
}, [editor]);
@@ -92,7 +92,7 @@ const UndoRedo = () => {
<StyledToolbarItem
disable={!canUndo}
onClick={() => {
editor?.store?.undo();
editor?.space?.undo();
}}
>
<UndoIcon />
@@ -102,7 +102,7 @@ const UndoRedo = () => {
<StyledToolbarItem
disable={!canRedo}
onClick={() => {
editor?.store?.redo();
editor?.space?.redo();
}}
>
<RedoIcon />

View File

@@ -38,14 +38,14 @@ export const Editor = () => {
return;
}
setEditor(editorRef.current);
const { store } = editorRef.current as EditorContainer;
const pageId = store.addBlock({
flavour: 'page',
const { space } = editorRef.current as EditorContainer;
const pageId = space.addBlock({
flavour: 'affine:page',
title: 'Welcome to the AFFiNE Alpha',
});
const groupId = store.addBlock({ flavour: 'group' }, pageId);
const groupId = space.addBlock({ flavour: 'affine:group' }, pageId);
editorRef.current.clipboard.importMarkdown(exampleMarkdown, `${groupId}`);
store.resetHistory();
space.resetHistory();
}, [setEditor]);
useEffect(() => {