mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 04:18:54 +00:00
feat: bump blocksuite (#5194)
Co-authored-by: AyushAgrawal-A2 <ayushagl06@gmail.com>
This commit is contained in:
4
packages/common/env/package.json
vendored
4
packages/common/env/package.json
vendored
@@ -3,8 +3,8 @@
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"devDependencies": {
|
||||
"@blocksuite/global": "0.0.0-20231130092516-0f858b95-nightly",
|
||||
"@blocksuite/store": "0.0.0-20231130092516-0f858b95-nightly",
|
||||
"@blocksuite/global": "0.0.0-20231205045113-03964196-nightly",
|
||||
"@blocksuite/store": "0.0.0-20231205045113-03964196-nightly",
|
||||
"react": "18.2.0",
|
||||
"react-dom": "18.2.0",
|
||||
"vitest": "0.34.6",
|
||||
|
||||
2
packages/common/env/src/workspace.ts
vendored
2
packages/common/env/src/workspace.ts
vendored
@@ -1,4 +1,4 @@
|
||||
import type { EditorContainer } from '@blocksuite/editor';
|
||||
import type { EditorContainer } from '@blocksuite/presets';
|
||||
import type { Page } from '@blocksuite/store';
|
||||
import type {
|
||||
ActiveDocProvider,
|
||||
|
||||
@@ -55,9 +55,9 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@affine/sdk": "workspace:*",
|
||||
"@blocksuite/blocks": "0.0.0-20231130092516-0f858b95-nightly",
|
||||
"@blocksuite/global": "0.0.0-20231130092516-0f858b95-nightly",
|
||||
"@blocksuite/store": "0.0.0-20231130092516-0f858b95-nightly",
|
||||
"@blocksuite/blocks": "0.0.0-20231205045113-03964196-nightly",
|
||||
"@blocksuite/global": "0.0.0-20231205045113-03964196-nightly",
|
||||
"@blocksuite/store": "0.0.0-20231205045113-03964196-nightly",
|
||||
"jotai": "^2.5.1",
|
||||
"jotai-effect": "^0.2.3",
|
||||
"tinykeys": "^2.1.0",
|
||||
@@ -66,8 +66,8 @@
|
||||
"devDependencies": {
|
||||
"@affine-test/fixtures": "workspace:*",
|
||||
"@affine/templates": "workspace:*",
|
||||
"@blocksuite/editor": "0.0.0-20231130092516-0f858b95-nightly",
|
||||
"@blocksuite/lit": "0.0.0-20231130092516-0f858b95-nightly",
|
||||
"@blocksuite/lit": "0.0.0-20231205045113-03964196-nightly",
|
||||
"@blocksuite/presets": "0.0.0-20231205045113-03964196-nightly",
|
||||
"@testing-library/react": "^14.0.0",
|
||||
"async-call-rpc": "^6.3.1",
|
||||
"electron": "link:../../frontend/electron/node_modules/electron",
|
||||
@@ -81,7 +81,7 @@
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@affine/templates": "*",
|
||||
"@blocksuite/editor": "*",
|
||||
"@blocksuite/presets": "*",
|
||||
"async-call-rpc": "*",
|
||||
"electron": "*",
|
||||
"react": "*",
|
||||
@@ -91,7 +91,7 @@
|
||||
"@affine/templates": {
|
||||
"optional": true
|
||||
},
|
||||
"@blocksuite/editor": {
|
||||
"@blocksuite/presets": {
|
||||
"optional": true
|
||||
},
|
||||
"async-call-rpc": {
|
||||
|
||||
@@ -22,11 +22,11 @@
|
||||
"dist"
|
||||
],
|
||||
"dependencies": {
|
||||
"@blocksuite/block-std": "0.0.0-20231130092516-0f858b95-nightly",
|
||||
"@blocksuite/blocks": "0.0.0-20231130092516-0f858b95-nightly",
|
||||
"@blocksuite/editor": "0.0.0-20231130092516-0f858b95-nightly",
|
||||
"@blocksuite/global": "0.0.0-20231130092516-0f858b95-nightly",
|
||||
"@blocksuite/store": "0.0.0-20231130092516-0f858b95-nightly",
|
||||
"@blocksuite/block-std": "0.0.0-20231205045113-03964196-nightly",
|
||||
"@blocksuite/blocks": "0.0.0-20231205045113-03964196-nightly",
|
||||
"@blocksuite/global": "0.0.0-20231205045113-03964196-nightly",
|
||||
"@blocksuite/presets": "0.0.0-20231205045113-03964196-nightly",
|
||||
"@blocksuite/store": "0.0.0-20231205045113-03964196-nightly",
|
||||
"jotai": "^2.5.1",
|
||||
"zod": "^3.22.4"
|
||||
},
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { BaseSelection } from '@blocksuite/block-std';
|
||||
import type { EditorContainer } from '@blocksuite/editor';
|
||||
import type { EditorContainer } from '@blocksuite/presets';
|
||||
import type { Page } from '@blocksuite/store';
|
||||
import type { Workspace } from '@blocksuite/store';
|
||||
import type { Atom, getDefaultStore } from 'jotai/vanilla';
|
||||
|
||||
@@ -37,8 +37,8 @@
|
||||
"y-provider": "workspace:*"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@blocksuite/blocks": "0.0.0-20231130092516-0f858b95-nightly",
|
||||
"@blocksuite/store": "0.0.0-20231130092516-0f858b95-nightly",
|
||||
"@blocksuite/blocks": "0.0.0-20231205045113-03964196-nightly",
|
||||
"@blocksuite/store": "0.0.0-20231205045113-03964196-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-20231130092516-0f858b95-nightly",
|
||||
"@blocksuite/store": "0.0.0-20231205045113-03964196-nightly",
|
||||
"vite": "^4.4.11",
|
||||
"vite-plugin-dts": "3.6.0",
|
||||
"vitest": "0.34.6",
|
||||
|
||||
@@ -13,9 +13,9 @@
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@blocksuite/blocks": "*",
|
||||
"@blocksuite/editor": "*",
|
||||
"@blocksuite/global": "*",
|
||||
"@blocksuite/icons": "2.1.34",
|
||||
"@blocksuite/presets": "*",
|
||||
"@blocksuite/store": "*"
|
||||
},
|
||||
"dependencies": {
|
||||
@@ -71,12 +71,12 @@
|
||||
"uuid": "^9.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@blocksuite/blocks": "0.0.0-20231130092516-0f858b95-nightly",
|
||||
"@blocksuite/editor": "0.0.0-20231130092516-0f858b95-nightly",
|
||||
"@blocksuite/global": "0.0.0-20231130092516-0f858b95-nightly",
|
||||
"@blocksuite/blocks": "0.0.0-20231205045113-03964196-nightly",
|
||||
"@blocksuite/global": "0.0.0-20231205045113-03964196-nightly",
|
||||
"@blocksuite/icons": "2.1.36",
|
||||
"@blocksuite/lit": "0.0.0-20231130092516-0f858b95-nightly",
|
||||
"@blocksuite/store": "0.0.0-20231130092516-0f858b95-nightly",
|
||||
"@blocksuite/lit": "0.0.0-20231205045113-03964196-nightly",
|
||||
"@blocksuite/presets": "0.0.0-20231205045113-03964196-nightly",
|
||||
"@blocksuite/store": "0.0.0-20231205045113-03964196-nightly",
|
||||
"@storybook/addon-actions": "^7.5.3",
|
||||
"@storybook/addon-essentials": "^7.5.3",
|
||||
"@storybook/addon-interactions": "^7.5.3",
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
import { rootBlockHubAtom } from '@affine/workspace/atom';
|
||||
import { useAtomValue } from 'jotai';
|
||||
import { useEffect, useRef } from 'react';
|
||||
|
||||
export const RootBlockHub = () => {
|
||||
const ref = useRef<HTMLDivElement>(null);
|
||||
const blockHub = useAtomValue(rootBlockHubAtom);
|
||||
useEffect(() => {
|
||||
if (ref.current) {
|
||||
const div = ref.current;
|
||||
if (blockHub) {
|
||||
if (div.hasChildNodes()) {
|
||||
(div.firstChild as ChildNode).remove();
|
||||
}
|
||||
div.append(blockHub);
|
||||
}
|
||||
}
|
||||
}, [blockHub]);
|
||||
return <div ref={ref} data-testid="block-hub" />;
|
||||
};
|
||||
@@ -1,5 +1,5 @@
|
||||
import { EditorContainer } from '@blocksuite/editor';
|
||||
import { assertExists } from '@blocksuite/global/utils';
|
||||
import { EditorContainer } from '@blocksuite/presets';
|
||||
import type { Page } from '@blocksuite/store';
|
||||
import clsx from 'clsx';
|
||||
import { use } from 'foxact/use';
|
||||
|
||||
@@ -168,13 +168,13 @@ export const createConfiguration: (
|
||||
'blocks',
|
||||
'dist'
|
||||
),
|
||||
'@blocksuite/editor': blocksuiteBaseDir
|
||||
? join(blocksuiteBaseDir, 'packages', 'editor', 'src')
|
||||
'@blocksuite/presets': blocksuiteBaseDir
|
||||
? join(blocksuiteBaseDir, 'packages', 'presets', 'src')
|
||||
: join(
|
||||
workspaceRoot,
|
||||
'node_modules',
|
||||
'@blocksuite',
|
||||
'editor',
|
||||
'presets',
|
||||
'dist'
|
||||
),
|
||||
'@blocksuite/global': blocksuiteBaseDir
|
||||
|
||||
@@ -35,7 +35,7 @@ export function getRuntimeConfig(buildFlags: BuildFlags): RuntimeConfig {
|
||||
serverUrlPrefix: 'https://insider.affine.pro', // Let insider be stable environment temporarily.
|
||||
editorFlags,
|
||||
appVersion: packageJson.version,
|
||||
editorVersion: packageJson.dependencies['@blocksuite/editor'],
|
||||
editorVersion: packageJson.dependencies['@blocksuite/presets'],
|
||||
appBuildType: 'stable',
|
||||
},
|
||||
get beta() {
|
||||
@@ -82,7 +82,7 @@ export function getRuntimeConfig(buildFlags: BuildFlags): RuntimeConfig {
|
||||
serverUrlPrefix: 'https://affine.fail',
|
||||
editorFlags,
|
||||
appVersion: packageJson.version,
|
||||
editorVersion: packageJson.dependencies['@blocksuite/editor'],
|
||||
editorVersion: packageJson.dependencies['@blocksuite/presets'],
|
||||
appBuildType: 'canary',
|
||||
},
|
||||
};
|
||||
|
||||
@@ -25,14 +25,14 @@
|
||||
"@affine/i18n": "workspace:*",
|
||||
"@affine/templates": "workspace:*",
|
||||
"@affine/workspace": "workspace:*",
|
||||
"@blocksuite/block-std": "0.0.0-20231130092516-0f858b95-nightly",
|
||||
"@blocksuite/blocks": "0.0.0-20231130092516-0f858b95-nightly",
|
||||
"@blocksuite/editor": "0.0.0-20231130092516-0f858b95-nightly",
|
||||
"@blocksuite/global": "0.0.0-20231130092516-0f858b95-nightly",
|
||||
"@blocksuite/block-std": "0.0.0-20231205045113-03964196-nightly",
|
||||
"@blocksuite/blocks": "0.0.0-20231205045113-03964196-nightly",
|
||||
"@blocksuite/global": "0.0.0-20231205045113-03964196-nightly",
|
||||
"@blocksuite/icons": "2.1.36",
|
||||
"@blocksuite/lit": "0.0.0-20231130092516-0f858b95-nightly",
|
||||
"@blocksuite/store": "0.0.0-20231130092516-0f858b95-nightly",
|
||||
"@blocksuite/virgo": "0.0.0-20231130092516-0f858b95-nightly",
|
||||
"@blocksuite/lit": "0.0.0-20231205045113-03964196-nightly",
|
||||
"@blocksuite/presets": "0.0.0-20231205045113-03964196-nightly",
|
||||
"@blocksuite/store": "0.0.0-20231205045113-03964196-nightly",
|
||||
"@blocksuite/virgo": "0.0.0-20231205045113-03964196-nightly",
|
||||
"@dnd-kit/core": "^6.0.8",
|
||||
"@dnd-kit/sortable": "^8.0.0",
|
||||
"@emotion/cache": "^11.11.0",
|
||||
|
||||
@@ -2,10 +2,8 @@ import './page-detail-editor.css';
|
||||
|
||||
import { PageNotFoundError } from '@affine/env/constant';
|
||||
import type { LayoutNode } from '@affine/sdk/entry';
|
||||
import { rootBlockHubAtom } from '@affine/workspace/atom';
|
||||
import type { BlockHub } from '@blocksuite/blocks';
|
||||
import type { EditorContainer } from '@blocksuite/editor';
|
||||
import { assertExists, DisposableGroup } from '@blocksuite/global/utils';
|
||||
import type { EditorContainer } from '@blocksuite/presets';
|
||||
import type { Page, Workspace } from '@blocksuite/store';
|
||||
import { useBlockSuitePageMeta } from '@toeverything/hooks/use-block-suite-page-meta';
|
||||
import { useBlockSuiteWorkspacePage } from '@toeverything/hooks/use-block-suite-workspace-page';
|
||||
@@ -16,7 +14,7 @@ import {
|
||||
} from '@toeverything/infra/__internal__/plugin';
|
||||
import { contentLayoutAtom, getCurrentStore } from '@toeverything/infra/atom';
|
||||
import clsx from 'clsx';
|
||||
import { useAtomValue, useSetAtom } from 'jotai';
|
||||
import { useAtomValue } from 'jotai';
|
||||
import type { CSSProperties, ReactElement } from 'react';
|
||||
import {
|
||||
memo,
|
||||
@@ -59,33 +57,6 @@ function useRouterHash() {
|
||||
return useLocation().hash.substring(1);
|
||||
}
|
||||
|
||||
function useCreateAndSetRootBlockHub(
|
||||
editor?: EditorContainer,
|
||||
showBlockHub?: boolean
|
||||
) {
|
||||
const setBlockHub = useSetAtom(rootBlockHubAtom);
|
||||
useEffect(() => {
|
||||
let canceled = false;
|
||||
let blockHub: BlockHub | undefined;
|
||||
if (editor && showBlockHub) {
|
||||
editor
|
||||
.createBlockHub()
|
||||
.then(bh => {
|
||||
if (canceled) {
|
||||
return;
|
||||
}
|
||||
blockHub = bh;
|
||||
setBlockHub(blockHub);
|
||||
})
|
||||
.catch(console.error);
|
||||
}
|
||||
return () => {
|
||||
canceled = true;
|
||||
blockHub?.remove();
|
||||
};
|
||||
}, [editor, showBlockHub, setBlockHub]);
|
||||
}
|
||||
|
||||
const EditorWrapper = memo(function EditorWrapper({
|
||||
workspace,
|
||||
pageId,
|
||||
@@ -142,11 +113,9 @@ const EditorWrapper = memo(function EditorWrapper({
|
||||
[isPublic, switchToEdgelessMode, pageId, switchToPageMode]
|
||||
);
|
||||
|
||||
const [editor, setEditor] = useState<EditorContainer>();
|
||||
const [, setEditor] = useState<EditorContainer>();
|
||||
const blockId = useRouterHash();
|
||||
|
||||
useCreateAndSetRootBlockHub(editor, !meta.trash);
|
||||
|
||||
const onLoadEditor = useCallback(
|
||||
(editor: EditorContainer) => {
|
||||
// debug current detail editor
|
||||
|
||||
@@ -2,7 +2,6 @@ import {
|
||||
AppSidebarFallback,
|
||||
appSidebarResizingAtom,
|
||||
} from '@affine/component/app-sidebar';
|
||||
import { RootBlockHub } from '@affine/component/block-hub';
|
||||
import {
|
||||
type DraggableTitleCellData,
|
||||
PageListDragOverlay,
|
||||
@@ -305,7 +304,6 @@ export const WorkspaceLayoutInner = ({
|
||||
children
|
||||
)}
|
||||
<ToolContainer inTrashPage={inTrashPage}>
|
||||
<RootBlockHub />
|
||||
<HelpIsland showList={pageId ? undefined : showList} />
|
||||
</ToolContainer>
|
||||
</MainContainer>
|
||||
|
||||
@@ -6,8 +6,8 @@ import {
|
||||
import { WorkspaceSubPath } from '@affine/env/workspace';
|
||||
import { globalBlockSuiteSchema } from '@affine/workspace/manager';
|
||||
import { SyncEngineStep } from '@affine/workspace/providers';
|
||||
import type { EditorContainer } from '@blocksuite/editor';
|
||||
import { assertExists } from '@blocksuite/global/utils';
|
||||
import type { EditorContainer } from '@blocksuite/presets';
|
||||
import type { Page } from '@blocksuite/store';
|
||||
import {
|
||||
contentLayoutAtom,
|
||||
|
||||
@@ -45,9 +45,13 @@ export const loader: LoaderFunction = async args => {
|
||||
return redirect('/404');
|
||||
}
|
||||
|
||||
if (!args.params.pageId) {
|
||||
if (args.params.pageId) {
|
||||
localStorage.setItem('last_page_id', args.params.pageId);
|
||||
rootStore.set(currentPageIdAtom, args.params.pageId);
|
||||
} else {
|
||||
rootStore.set(currentPageIdAtom, null);
|
||||
}
|
||||
|
||||
const [workspaceAtom] = getBlockSuiteWorkspaceAtom(currentMetadata.id);
|
||||
workspaceLoaderLogger.info('get cloud workspace atom');
|
||||
|
||||
|
||||
@@ -32,10 +32,10 @@
|
||||
"@affine/sdk": "workspace:*",
|
||||
"@affine/templates": "workspace:*",
|
||||
"@affine/vue-hello-world-plugin": "workspace:*",
|
||||
"@blocksuite/blocks": "0.0.0-20231130092516-0f858b95-nightly",
|
||||
"@blocksuite/editor": "0.0.0-20231130092516-0f858b95-nightly",
|
||||
"@blocksuite/lit": "0.0.0-20231130092516-0f858b95-nightly",
|
||||
"@blocksuite/store": "0.0.0-20231130092516-0f858b95-nightly",
|
||||
"@blocksuite/blocks": "0.0.0-20231205045113-03964196-nightly",
|
||||
"@blocksuite/lit": "0.0.0-20231205045113-03964196-nightly",
|
||||
"@blocksuite/presets": "0.0.0-20231205045113-03964196-nightly",
|
||||
"@blocksuite/store": "0.0.0-20231205045113-03964196-nightly",
|
||||
"@electron-forge/cli": "^7.1.0",
|
||||
"@electron-forge/core": "^7.1.0",
|
||||
"@electron-forge/core-utils": "^7.1.0",
|
||||
|
||||
@@ -19,12 +19,12 @@
|
||||
"devDependencies": {
|
||||
"@affine/debug": "workspace:*",
|
||||
"@affine/env": "workspace:*",
|
||||
"@blocksuite/block-std": "0.0.0-20231130092516-0f858b95-nightly",
|
||||
"@blocksuite/blocks": "0.0.0-20231130092516-0f858b95-nightly",
|
||||
"@blocksuite/editor": "0.0.0-20231130092516-0f858b95-nightly",
|
||||
"@blocksuite/global": "0.0.0-20231130092516-0f858b95-nightly",
|
||||
"@blocksuite/lit": "0.0.0-20231130092516-0f858b95-nightly",
|
||||
"@blocksuite/store": "0.0.0-20231130092516-0f858b95-nightly",
|
||||
"@blocksuite/block-std": "0.0.0-20231205045113-03964196-nightly",
|
||||
"@blocksuite/blocks": "0.0.0-20231205045113-03964196-nightly",
|
||||
"@blocksuite/global": "0.0.0-20231205045113-03964196-nightly",
|
||||
"@blocksuite/lit": "0.0.0-20231205045113-03964196-nightly",
|
||||
"@blocksuite/presets": "0.0.0-20231205045113-03964196-nightly",
|
||||
"@blocksuite/store": "0.0.0-20231205045113-03964196-nightly",
|
||||
"@testing-library/react": "^14.0.0",
|
||||
"@types/image-blob-reduce": "^4.1.3",
|
||||
"@types/lodash.debounce": "^4.0.7",
|
||||
@@ -35,8 +35,8 @@
|
||||
"peerDependencies": {
|
||||
"@blocksuite/block-std": "*",
|
||||
"@blocksuite/blocks": "*",
|
||||
"@blocksuite/editor": "*",
|
||||
"@blocksuite/global": "*",
|
||||
"@blocksuite/presets": "*",
|
||||
"@blocksuite/store": "*",
|
||||
"y-provider": "workspace:*"
|
||||
},
|
||||
@@ -50,10 +50,10 @@
|
||||
"@blocksuite/blocks": {
|
||||
"optional": true
|
||||
},
|
||||
"@blocksuite/editor": {
|
||||
"@blocksuite/global": {
|
||||
"optional": true
|
||||
},
|
||||
"@blocksuite/global": {
|
||||
"@blocksuite/presets": {
|
||||
"optional": true
|
||||
},
|
||||
"@blocksuite/store": {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { DebugLogger } from '@affine/debug';
|
||||
import type { WorkspaceAdapter } from '@affine/env/workspace';
|
||||
import { WorkspaceFlavour } from '@affine/env/workspace';
|
||||
import type { BlockHub } from '@blocksuite/blocks';
|
||||
import { assertEquals, assertExists } from '@blocksuite/global/utils';
|
||||
import {
|
||||
currentPageIdAtom,
|
||||
@@ -259,7 +258,4 @@ export const refreshRootMetadataAtom = atom(null, (get, set) => {
|
||||
set(rootWorkspacesMetadataPrimitiveAtom, fetchMetadata(get));
|
||||
});
|
||||
|
||||
// blocksuite atoms,
|
||||
// each app should have only one block-hub in the same time
|
||||
export const rootBlockHubAtom = atom<Readonly<BlockHub> | null>(null);
|
||||
//#endregion
|
||||
|
||||
Reference in New Issue
Block a user