feat: update blocksuite version

This commit is contained in:
QiShaoXuan
2022-12-05 23:06:28 +08:00
parent 2ca52c187b
commit d3d45a9dd7
5 changed files with 41 additions and 27 deletions
+3 -3
View File
@@ -9,10 +9,10 @@
"lint": "next lint"
},
"dependencies": {
"@blocksuite/blocks": "0.3.0-alpha.3",
"@blocksuite/editor": "0.3.0-alpha.3",
"@blocksuite/blocks": "0.3.0-alpha.5",
"@blocksuite/editor": "0.3.0-alpha.5",
"@blocksuite/icons": "^1.0.3",
"@blocksuite/store": "0.3.0-alpha.3",
"@blocksuite/store": "0.3.0-alpha.5",
"@emotion/css": "^11.10.0",
"@emotion/react": "^11.10.4",
"@emotion/server": "^11.10.0",
+1 -1
View File
@@ -6,7 +6,7 @@ export const Editor = () => {
const { editor } = useEditor();
const ref = useRef<any>();
useEffect(() => {
if (editor && ref.current?.space.id !== editor?.space.id) {
if (editor && ref.current?.page.id !== editor?.page.id) {
ref.current?.remove();
ref.current = editor;
@@ -4,7 +4,7 @@ import type { EditorContainer } from '@blocksuite/editor';
import { BlockSchema, createEditor } from '@blocksuite/editor';
import { useEffect } from 'react';
import pkg from '../../../package.json';
import { createWebsocketDocProvider, Store } from '@blocksuite/store';
import { createWebsocketDocProvider, Workspace } from '@blocksuite/store';
const getEditorParams = () => {
const providers = [];
@@ -27,11 +27,11 @@ const InitialEditor = ({
setEditor: (editor: EditorContainer) => void;
}) => {
useEffect(() => {
const store = new Store({
const store = new Workspace({
...getEditorParams(),
});
const space = store.createSpace('page0').register(BlockSchema);
const editor = createEditor(space);
const page = store.createPage('page0').register(BlockSchema);
const editor = createEditor(page);
setEditor(editor);
@@ -2,12 +2,12 @@ import { EditorContainer } from '@blocksuite/editor';
import exampleMarkdown from '@/providers/editor-provider/example-markdown';
export const initDefaultContent = (editor: EditorContainer) => {
const { space } = editor;
const pageId = space.addBlock({
const { page } = editor;
const pageId = page.addBlock({
flavour: 'affine:page',
title: 'Welcome to the AFFiNE Alpha',
});
const groupId = space.addBlock({ flavour: 'affine:group' }, pageId);
const groupId = page.addBlock({ flavour: 'affine:group' }, pageId);
editor.clipboard.importMarkdown(exampleMarkdown, `${groupId}`);
space.resetHistory();
page.resetHistory();
};
+29 -15
View File
@@ -22,10 +22,10 @@ importers:
packages/app:
specifiers:
'@blocksuite/blocks': 0.3.0-alpha.3
'@blocksuite/editor': 0.3.0-alpha.3
'@blocksuite/blocks': 0.3.0-alpha.5
'@blocksuite/editor': 0.3.0-alpha.5
'@blocksuite/icons': ^1.0.3
'@blocksuite/store': 0.3.0-alpha.3
'@blocksuite/store': 0.3.0-alpha.5
'@emotion/css': ^11.10.0
'@emotion/react': ^11.10.4
'@emotion/server': ^11.10.0
@@ -53,10 +53,10 @@ importers:
react-dom: 18.2.0
typescript: 4.8.3
dependencies:
'@blocksuite/blocks': 0.3.0-alpha.3
'@blocksuite/editor': 0.3.0-alpha.3
'@blocksuite/blocks': 0.3.0-alpha.5
'@blocksuite/editor': 0.3.0-alpha.5
'@blocksuite/icons': 1.0.3_w5j4k42lgipnm43s3brx6h3c34
'@blocksuite/store': 0.3.0-alpha.3
'@blocksuite/store': 0.3.0-alpha.5
'@emotion/css': 11.10.0
'@emotion/react': 11.10.4_w5j4k42lgipnm43s3brx6h3c34
'@emotion/server': 11.10.0_@emotion+css@11.10.0
@@ -172,10 +172,10 @@ packages:
to-fast-properties: 2.0.0
dev: false
/@blocksuite/blocks/0.3.0-alpha.3:
resolution: {integrity: sha512-/GeyAZn1cpkQL0gNQq95uDUnF9TshrNUTBSO8cCIXq4qwfcFMU5ov58XiJ/cvEN67SUTiZGQbA/qTvWEgEUyrQ==}
/@blocksuite/blocks/0.3.0-alpha.5:
resolution: {integrity: sha512-jZy1mXaC2s/b227Yf/wNPRwMAFGa1USH/Q0OJ6KAcmY8YQdeGXKAoNTz4p7K5rMJgtE1t17/Mzwo5+exCRbIkg==}
dependencies:
'@blocksuite/store': 0.3.0-alpha.3
'@blocksuite/store': 0.3.0-alpha.5
hotkeys-js: 3.10.0
lit: 2.4.0
quill: 1.3.7
@@ -186,11 +186,11 @@ packages:
- utf-8-validate
dev: false
/@blocksuite/editor/0.3.0-alpha.3:
resolution: {integrity: sha512-MP1mLoj2TXkhPxKro8K0yPPxBmvOUutTEZVNL4XyP5JNa4gKvshJIIlEgKL3/c55EzFDBd7Ig9tl2SbPvptE1w==}
/@blocksuite/editor/0.3.0-alpha.5:
resolution: {integrity: sha512-H7RZkG3ptyzLs0+6YgwQnp6H8hByfWRSjDi388ZIz3/exgliyBz2QkQwY4Tj2nlAYSq/U5/8hdDMjw4a092Ivw==}
dependencies:
'@blocksuite/blocks': 0.3.0-alpha.3
'@blocksuite/store': 0.3.0-alpha.3
'@blocksuite/blocks': 0.3.0-alpha.5
'@blocksuite/store': 0.3.0-alpha.5
lit: 2.4.0
marked: 4.1.1
turndown: 7.1.1
@@ -210,12 +210,15 @@ packages:
react: 18.2.0
dev: false
/@blocksuite/store/0.3.0-alpha.3:
resolution: {integrity: sha512-XIe2FROwq+zJV3dWYXwcmiEqGF08ywkgAgKSnCn6iD1N2x+wWZEvGxowKPi7871DAd2QvCOaSM2vv9QTggXXag==}
/@blocksuite/store/0.3.0-alpha.5:
resolution: {integrity: sha512-pkbSrwB7KTfW56iH4ZFPkrS6shIU8QpmJlZmKVY95Gp5QSISW2ffKUsFrrHVHT+GoOV7+RPZQrphUnC57grPNg==}
dependencies:
buffer: 6.0.3
flexsearch: 0.7.21
idb-keyval: 6.2.0
ky: 0.32.2
lib0: 0.2.52
sha3: 2.1.4
y-indexeddb: 9.0.9_yjs@13.5.41
y-protocols: 1.0.5
y-webrtc: 10.2.3
@@ -2313,6 +2316,11 @@ packages:
object.assign: 4.1.4
dev: true
/ky/0.32.2:
resolution: {integrity: sha512-eBJeF6IXNwX5rksdwBrE2rIJrU2d84GoTvdM7OmmTIwUVXEMd72wIwvT+nyhrqtv7AzbSNsWz7yRsHgVhj1uog==}
engines: {node: '>=14.16'}
dev: false
/language-subtag-registry/0.3.22:
resolution: {integrity: sha512-tN0MCzyWnoz/4nHS6uxdlFWoUZT7ABptwKPQ52Ea7URk6vll88bWBVhodtnlfEuCcKWNGoc+uGbw1cwa9IKh/w==}
dev: true
@@ -3033,6 +3041,12 @@ packages:
lru-cache: 6.0.0
dev: true
/sha3/2.1.4:
resolution: {integrity: sha512-S8cNxbyb0UGUM2VhRD4Poe5N58gJnJsLJ5vC7FYWGUmGhcsj4++WaIOBFVDxlG0W3To6xBuiRh+i0Qp2oNCOtg==}
dependencies:
buffer: 6.0.3
dev: false
/shebang-command/2.0.0:
resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==}
engines: {node: '>=8'}