diff --git a/packages/app/package.json b/packages/app/package.json index afed9b8b8..620aa0d5a 100644 --- a/packages/app/package.json +++ b/packages/app/package.json @@ -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", diff --git a/packages/app/src/components/edgeless-toolbar/index.tsx b/packages/app/src/components/edgeless-toolbar/index.tsx index 2865c2772..58a93e83d 100644 --- a/packages/app/src/components/edgeless-toolbar/index.tsx +++ b/packages/app/src/components/edgeless-toolbar/index.tsx @@ -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 = () => { { - editor?.store?.undo(); + editor?.space?.undo(); }} > @@ -102,7 +102,7 @@ const UndoRedo = () => { { - editor?.store?.redo(); + editor?.space?.redo(); }} > diff --git a/packages/app/src/components/editor.tsx b/packages/app/src/components/editor.tsx index 1735a62a5..a7ef3ff27 100644 --- a/packages/app/src/components/editor.tsx +++ b/packages/app/src/components/editor.tsx @@ -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(() => { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c0dac8dba..032815958 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -18,8 +18,8 @@ importers: packages/app: specifiers: - '@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 @@ -47,8 +47,8 @@ importers: react-dom: 18.2.0 typescript: 4.8.3 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_w5j4k42lgipnm43s3brx6h3c34 '@emotion/server': 11.10.0_@emotion+css@11.10.0 @@ -164,10 +164,10 @@ packages: to-fast-properties: 2.0.0 dev: false - /@blocksuite/blocks/0.2.24: - resolution: {integrity: sha512-gqKD1NwjL1NroMqmM9JUgvQaJB/W8tLTqt0+em7L5ys1Y9RjrIfIPKLe5Ea4oZR7HukKGyY+gDuEkOW0mqvtvg==} + /@blocksuite/blocks/0.3.0-alpha.0: + resolution: {integrity: sha512-B5c6rRVISj55Vi2ijtFNOIcB5MizQdcZWr6OkZsVMpDEGSKSh446D/5WndFlORU7aQY63WLaSX1xwF+aV6jLjg==} dependencies: - '@blocksuite/store': 0.2.24 + '@blocksuite/store': 0.3.0-alpha.0 hotkeys-js: 3.10.0 lit: 2.4.0 quill: 1.3.7 @@ -178,11 +178,11 @@ packages: - utf-8-validate dev: false - /@blocksuite/editor/0.2.24: - resolution: {integrity: sha512-L5sq4eq2cMJeGZ8akGkcRIrxahS9met8unyx9I0ELBqO1u43OkUcPCxemRTW4ECfV2T7lWR3GbJg4LL1udCPSA==} + /@blocksuite/editor/0.3.0-alpha.0: + resolution: {integrity: sha512-Vi7YOus7XFTGX5Q8o6AuW5EM34AlpNKJtCwkjuohmLxlEVD5KbvBudJTqpnZ71FIVK+pcYYGqt/0b7VDqCOxqg==} dependencies: - '@blocksuite/blocks': 0.2.24 - '@blocksuite/store': 0.2.24 + '@blocksuite/blocks': 0.3.0-alpha.0 + '@blocksuite/store': 0.3.0-alpha.0 lit: 2.4.0 marked: 4.1.1 turndown: 7.1.1 @@ -192,10 +192,11 @@ packages: - utf-8-validate dev: false - /@blocksuite/store/0.2.24: - resolution: {integrity: sha512-2eRccsokZVk1D0W6rnzIzP28YzF41JmEoRcyMmeppn5/wcXhmiWpaY1YNyVp/aSmhv+7Lmt6GOe/qx17PDXOVA==} + /@blocksuite/store/0.3.0-alpha.0: + resolution: {integrity: sha512-Lk6UisNL32Eys5yBT7qX5s4OKmLnhsMs/7v/aqkly3Gf3eJU+F++ukwWN4NeJN3S0k2I8mR638qzRJ9LdXPvQQ==} dependencies: lib0: 0.2.52 + y-indexeddb: 9.0.9_yjs@13.5.41 y-protocols: 1.0.5 y-webrtc: 10.2.3 yjs: 13.5.41 @@ -3133,6 +3134,15 @@ packages: object-keys: 0.4.0 dev: false + /y-indexeddb/9.0.9_yjs@13.5.41: + resolution: {integrity: sha512-GcJbiJa2eD5hankj46Hea9z4hbDnDjvh1fT62E5SpZRsv8GcEemw34l1hwI2eknGcv5Ih9JfusT37JLx9q3LFg==} + peerDependencies: + yjs: ^13.0.0 + dependencies: + lib0: 0.2.52 + yjs: 13.5.41 + dev: false + /y-protocols/1.0.5: resolution: {integrity: sha512-Wil92b7cGk712lRHDqS4T90IczF6RkcvCwAD0A2OPg+adKmOe+nOiT/N2hvpQIWS3zfjmtL4CPaH5sIW1Hkm/A==} dependencies: