mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-25 06:18:45 +08:00
chore: bump blocksuite (#4801)
This commit is contained in:
Vendored
+2
-2
@@ -3,8 +3,8 @@
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"devDependencies": {
|
||||
"@blocksuite/global": "0.0.0-20231024064721-2aee7119-nightly",
|
||||
"@blocksuite/store": "0.0.0-20231024064721-2aee7119-nightly",
|
||||
"@blocksuite/global": "0.0.0-20231101080734-aa27dc89-nightly",
|
||||
"@blocksuite/store": "0.0.0-20231101080734-aa27dc89-nightly",
|
||||
"react": "18.2.0",
|
||||
"react-dom": "18.2.0",
|
||||
"vitest": "0.34.6",
|
||||
|
||||
@@ -55,9 +55,9 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@affine/sdk": "workspace:*",
|
||||
"@blocksuite/blocks": "0.0.0-20231024064721-2aee7119-nightly",
|
||||
"@blocksuite/global": "0.0.0-20231024064721-2aee7119-nightly",
|
||||
"@blocksuite/store": "0.0.0-20231024064721-2aee7119-nightly",
|
||||
"@blocksuite/blocks": "0.0.0-20231101080734-aa27dc89-nightly",
|
||||
"@blocksuite/global": "0.0.0-20231101080734-aa27dc89-nightly",
|
||||
"@blocksuite/store": "0.0.0-20231101080734-aa27dc89-nightly",
|
||||
"jotai": "^2.4.3",
|
||||
"jotai-effect": "^0.1.0",
|
||||
"tinykeys": "^2.1.0",
|
||||
@@ -66,8 +66,8 @@
|
||||
"devDependencies": {
|
||||
"@affine-test/fixtures": "workspace:*",
|
||||
"@affine/templates": "workspace:*",
|
||||
"@blocksuite/editor": "0.0.0-20231024064721-2aee7119-nightly",
|
||||
"@blocksuite/lit": "0.0.0-20231024064721-2aee7119-nightly",
|
||||
"@blocksuite/editor": "0.0.0-20231101080734-aa27dc89-nightly",
|
||||
"@blocksuite/lit": "0.0.0-20231101080734-aa27dc89-nightly",
|
||||
"@testing-library/react": "^14.0.0",
|
||||
"async-call-rpc": "^6.3.1",
|
||||
"electron": "link:../../frontend/electron/node_modules/electron",
|
||||
|
||||
@@ -22,11 +22,11 @@
|
||||
"dist"
|
||||
],
|
||||
"dependencies": {
|
||||
"@blocksuite/block-std": "0.0.0-20231024064721-2aee7119-nightly",
|
||||
"@blocksuite/blocks": "0.0.0-20231024064721-2aee7119-nightly",
|
||||
"@blocksuite/editor": "0.0.0-20231024064721-2aee7119-nightly",
|
||||
"@blocksuite/global": "0.0.0-20231024064721-2aee7119-nightly",
|
||||
"@blocksuite/store": "0.0.0-20231024064721-2aee7119-nightly",
|
||||
"@blocksuite/block-std": "0.0.0-20231101080734-aa27dc89-nightly",
|
||||
"@blocksuite/blocks": "0.0.0-20231101080734-aa27dc89-nightly",
|
||||
"@blocksuite/editor": "0.0.0-20231101080734-aa27dc89-nightly",
|
||||
"@blocksuite/global": "0.0.0-20231101080734-aa27dc89-nightly",
|
||||
"@blocksuite/store": "0.0.0-20231101080734-aa27dc89-nightly",
|
||||
"jotai": "^2.4.3",
|
||||
"zod": "^3.22.4"
|
||||
},
|
||||
|
||||
@@ -37,8 +37,8 @@
|
||||
"y-provider": "workspace:*"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@blocksuite/blocks": "0.0.0-20231024064721-2aee7119-nightly",
|
||||
"@blocksuite/store": "0.0.0-20231024064721-2aee7119-nightly",
|
||||
"@blocksuite/blocks": "0.0.0-20231101080734-aa27dc89-nightly",
|
||||
"@blocksuite/store": "0.0.0-20231101080734-aa27dc89-nightly",
|
||||
"fake-indexeddb": "^5.0.0",
|
||||
"vite": "^4.4.11",
|
||||
"vite-plugin-dts": "3.6.0",
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
"build": "vite build"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@blocksuite/store": "0.0.0-20231024064721-2aee7119-nightly",
|
||||
"@blocksuite/store": "0.0.0-20231101080734-aa27dc89-nightly",
|
||||
"vite": "^4.4.11",
|
||||
"vite-plugin-dts": "3.6.0",
|
||||
"vitest": "0.34.6",
|
||||
|
||||
@@ -66,12 +66,12 @@
|
||||
"uuid": "^9.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@blocksuite/blocks": "0.0.0-20231024064721-2aee7119-nightly",
|
||||
"@blocksuite/editor": "0.0.0-20231024064721-2aee7119-nightly",
|
||||
"@blocksuite/global": "0.0.0-20231024064721-2aee7119-nightly",
|
||||
"@blocksuite/blocks": "0.0.0-20231101080734-aa27dc89-nightly",
|
||||
"@blocksuite/editor": "0.0.0-20231101080734-aa27dc89-nightly",
|
||||
"@blocksuite/global": "0.0.0-20231101080734-aa27dc89-nightly",
|
||||
"@blocksuite/icons": "2.1.35",
|
||||
"@blocksuite/lit": "0.0.0-20231024064721-2aee7119-nightly",
|
||||
"@blocksuite/store": "0.0.0-20231024064721-2aee7119-nightly",
|
||||
"@blocksuite/lit": "0.0.0-20231101080734-aa27dc89-nightly",
|
||||
"@blocksuite/store": "0.0.0-20231101080734-aa27dc89-nightly",
|
||||
"@storybook/jest": "^0.2.3",
|
||||
"@storybook/testing-library": "^0.2.2",
|
||||
"@testing-library/react": "^14.0.0",
|
||||
|
||||
@@ -18,6 +18,7 @@ export type EditorProps = {
|
||||
page: Page;
|
||||
mode: 'page' | 'edgeless';
|
||||
onInit: (page: Page, editor: Readonly<EditorContainer>) => void;
|
||||
onModeChange?: (mode: 'page' | 'edgeless') => void;
|
||||
setBlockHub?: (blockHub: BlockHub | null) => void;
|
||||
onLoad?: (page: Page, editor: EditorContainer) => () => void;
|
||||
style?: CSSProperties;
|
||||
@@ -36,7 +37,7 @@ declare global {
|
||||
}
|
||||
|
||||
const BlockSuiteEditorImpl = (props: EditorProps): ReactElement => {
|
||||
const { onLoad, page, mode, style } = props;
|
||||
const { onLoad, onModeChange, page, mode, style } = props;
|
||||
if (!page.loaded) {
|
||||
use(page.waitForLoaded());
|
||||
}
|
||||
@@ -59,17 +60,26 @@ const BlockSuiteEditorImpl = (props: EditorProps): ReactElement => {
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (editor.page && onLoad) {
|
||||
const disposes = [] as ((() => void) | undefined)[];
|
||||
disposes.push(onLoad?.(page, editor));
|
||||
return () => {
|
||||
disposes
|
||||
.filter((dispose): dispose is () => void => !!dispose)
|
||||
.forEach(dispose => dispose());
|
||||
};
|
||||
const disposes = [] as ((() => void) | undefined)[];
|
||||
|
||||
if (editor) {
|
||||
const dipose = editor.slots.pageModeSwitched.on(mode => {
|
||||
onModeChange?.(mode);
|
||||
});
|
||||
|
||||
disposes.push(() => dipose.dispose());
|
||||
}
|
||||
return;
|
||||
}, [editor, editor.page, page, onLoad]);
|
||||
|
||||
if (editor.page && onLoad) {
|
||||
disposes.push(onLoad?.(page, editor));
|
||||
}
|
||||
|
||||
return () => {
|
||||
disposes
|
||||
.filter((dispose): dispose is () => void => !!dispose)
|
||||
.forEach(dispose => dispose());
|
||||
};
|
||||
}, [editor, editor.page, page, onLoad, onModeChange]);
|
||||
|
||||
const ref = useRef<HTMLDivElement>(null);
|
||||
|
||||
|
||||
@@ -24,13 +24,13 @@
|
||||
"@affine/i18n": "workspace:*",
|
||||
"@affine/templates": "workspace:*",
|
||||
"@affine/workspace": "workspace:*",
|
||||
"@blocksuite/block-std": "0.0.0-20231024064721-2aee7119-nightly",
|
||||
"@blocksuite/blocks": "0.0.0-20231024064721-2aee7119-nightly",
|
||||
"@blocksuite/editor": "0.0.0-20231024064721-2aee7119-nightly",
|
||||
"@blocksuite/global": "0.0.0-20231024064721-2aee7119-nightly",
|
||||
"@blocksuite/block-std": "0.0.0-20231101080734-aa27dc89-nightly",
|
||||
"@blocksuite/blocks": "0.0.0-20231101080734-aa27dc89-nightly",
|
||||
"@blocksuite/editor": "0.0.0-20231101080734-aa27dc89-nightly",
|
||||
"@blocksuite/global": "0.0.0-20231101080734-aa27dc89-nightly",
|
||||
"@blocksuite/icons": "2.1.35",
|
||||
"@blocksuite/lit": "0.0.0-20231024064721-2aee7119-nightly",
|
||||
"@blocksuite/store": "0.0.0-20231024064721-2aee7119-nightly",
|
||||
"@blocksuite/lit": "0.0.0-20231101080734-aa27dc89-nightly",
|
||||
"@blocksuite/store": "0.0.0-20231101080734-aa27dc89-nightly",
|
||||
"@dnd-kit/core": "^6.0.8",
|
||||
"@dnd-kit/sortable": "^7.0.2",
|
||||
"@emotion/cache": "^11.11.0",
|
||||
|
||||
@@ -31,6 +31,7 @@ import { Panel, PanelGroup, PanelResizeHandle } from 'react-resizable-panels';
|
||||
import { pageSettingFamily } from '../atoms';
|
||||
import { fontStyleOptions } from '../atoms/settings';
|
||||
import { useAppSettingHelper } from '../hooks/affine/use-app-setting-helper';
|
||||
import { useBlockSuiteMetaHelper } from '../hooks/affine/use-block-suite-meta-helper';
|
||||
import { BlockSuiteEditor as Editor } from './blocksuite/block-suite-editor';
|
||||
import { Bookmark } from './bookmark';
|
||||
import * as styles from './page-detail-editor.css';
|
||||
@@ -64,6 +65,8 @@ const EditorWrapper = memo(function EditorWrapper({
|
||||
const meta = useBlockSuitePageMeta(workspace).find(
|
||||
meta => meta.id === pageId
|
||||
);
|
||||
const { switchToEdgelessMode, switchToPageMode } =
|
||||
useBlockSuiteMetaHelper(workspace);
|
||||
const pageSettingAtom = pageSettingFamily(pageId);
|
||||
const pageSetting = useAtomValue(pageSettingAtom);
|
||||
const currentMode = pageSetting?.mode ?? 'page';
|
||||
@@ -80,6 +83,17 @@ const EditorWrapper = memo(function EditorWrapper({
|
||||
return fontStyle.value;
|
||||
}, [appSettings.fontStyle]);
|
||||
|
||||
const setEditorMode = useCallback(
|
||||
(mode: 'page' | 'edgeless') => {
|
||||
if (mode === 'edgeless') {
|
||||
switchToEdgelessMode(pageId);
|
||||
} else {
|
||||
switchToPageMode(pageId);
|
||||
}
|
||||
},
|
||||
[switchToEdgelessMode, switchToPageMode, pageId]
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Editor
|
||||
@@ -94,6 +108,7 @@ const EditorWrapper = memo(function EditorWrapper({
|
||||
}
|
||||
mode={isPublic ? 'page' : currentMode}
|
||||
page={page}
|
||||
onModeChange={setEditorMode}
|
||||
onInit={useCallback(
|
||||
(page: Page, editor: Readonly<EditorContainer>) => {
|
||||
onInit(page, editor);
|
||||
|
||||
@@ -32,10 +32,10 @@
|
||||
"@affine/sdk": "workspace:*",
|
||||
"@affine/templates": "workspace:*",
|
||||
"@affine/vue-hello-world-plugin": "workspace:*",
|
||||
"@blocksuite/blocks": "0.0.0-20231024064721-2aee7119-nightly",
|
||||
"@blocksuite/editor": "0.0.0-20231024064721-2aee7119-nightly",
|
||||
"@blocksuite/lit": "0.0.0-20231024064721-2aee7119-nightly",
|
||||
"@blocksuite/store": "0.0.0-20231024064721-2aee7119-nightly",
|
||||
"@blocksuite/blocks": "0.0.0-20231101080734-aa27dc89-nightly",
|
||||
"@blocksuite/editor": "0.0.0-20231101080734-aa27dc89-nightly",
|
||||
"@blocksuite/lit": "0.0.0-20231101080734-aa27dc89-nightly",
|
||||
"@blocksuite/store": "0.0.0-20231101080734-aa27dc89-nightly",
|
||||
"@electron-forge/cli": "^6.4.2",
|
||||
"@electron-forge/core": "^6.4.2",
|
||||
"@electron-forge/core-utils": "^6.4.2",
|
||||
|
||||
@@ -15,12 +15,12 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@affine/env": "workspace:*",
|
||||
"@blocksuite/block-std": "0.0.0-20231024064721-2aee7119-nightly",
|
||||
"@blocksuite/blocks": "0.0.0-20231024064721-2aee7119-nightly",
|
||||
"@blocksuite/editor": "0.0.0-20231024064721-2aee7119-nightly",
|
||||
"@blocksuite/global": "0.0.0-20231024064721-2aee7119-nightly",
|
||||
"@blocksuite/lit": "0.0.0-20231024064721-2aee7119-nightly",
|
||||
"@blocksuite/store": "0.0.0-20231024064721-2aee7119-nightly",
|
||||
"@blocksuite/block-std": "0.0.0-20231101080734-aa27dc89-nightly",
|
||||
"@blocksuite/blocks": "0.0.0-20231101080734-aa27dc89-nightly",
|
||||
"@blocksuite/editor": "0.0.0-20231101080734-aa27dc89-nightly",
|
||||
"@blocksuite/global": "0.0.0-20231101080734-aa27dc89-nightly",
|
||||
"@blocksuite/lit": "0.0.0-20231101080734-aa27dc89-nightly",
|
||||
"@blocksuite/store": "0.0.0-20231101080734-aa27dc89-nightly",
|
||||
"@testing-library/react": "^14.0.0",
|
||||
"@types/lodash.debounce": "^4.0.7",
|
||||
"fake-indexeddb": "^5.0.0",
|
||||
|
||||
Reference in New Issue
Block a user