diff --git a/apps/electron/yarn.lock b/apps/electron/yarn.lock index 708d6e3bc2..2124ebdbbe 100644 --- a/apps/electron/yarn.lock +++ b/apps/electron/yarn.lock @@ -75,6 +75,7 @@ __metadata: clsx: ^1.2.1 concurrently: ^8.0.1 jest-mock: ^29.5.0 + jotai: ^2.0.4 kebab-case: ^1.0.2 lit: ^2.7.2 lottie-web: ^5.11.0 @@ -92,11 +93,11 @@ __metadata: wait-on: ^7.0.1 yjs: ^13.5.52 peerDependencies: - "@blocksuite/blocks": 0.0.0-20230409084303-221991d4-nightly - "@blocksuite/editor": 0.0.0-20230409084303-221991d4-nightly - "@blocksuite/global": 0.0.0-20230409084303-221991d4-nightly - "@blocksuite/icons": 2.1.10 - "@blocksuite/store": 0.0.0-20230409084303-221991d4-nightly + "@blocksuite/blocks": "*" + "@blocksuite/editor": "*" + "@blocksuite/global": "*" + "@blocksuite/icons": "*" + "@blocksuite/store": "*" languageName: unknown linkType: soft @@ -175,9 +176,17 @@ __metadata: resolution: "@affine/jotai@workspace:../../packages/jotai" dependencies: "@affine/env": "workspace:*" + "@blocksuite/blocks": 0.0.0-20230413190748-4d32b79a-nightly + "@blocksuite/editor": 0.0.0-20230413190748-4d32b79a-nightly + "@blocksuite/global": 0.0.0-20230413190748-4d32b79a-nightly + "@blocksuite/store": 0.0.0-20230413190748-4d32b79a-nightly jotai: ^2.0.4 lottie-web: ^5.11.0 peerDependencies: + "@blocksuite/blocks": "*" + "@blocksuite/editor": "*" + "@blocksuite/global": "*" + "@blocksuite/store": "*" lottie-web: "*" languageName: unknown linkType: soft @@ -219,8 +228,8 @@ __metadata: yjs: ^13.5.52 zod: ^3.21.4 peerDependencies: - "@blocksuite/blocks": 0.0.0-20230409084303-221991d4-nightly - "@blocksuite/store": 0.0.0-20230409084303-221991d4-nightly + "@blocksuite/blocks": "*" + "@blocksuite/store": "*" languageName: unknown linkType: soft diff --git a/apps/web/src/atoms/public-workspace/index.ts b/apps/web/src/atoms/public-workspace/index.ts index 76924ecc8e..07ccc77ef9 100644 --- a/apps/web/src/atoms/public-workspace/index.ts +++ b/apps/web/src/atoms/public-workspace/index.ts @@ -9,13 +9,17 @@ import { affineApis } from '../../shared/apis'; function createPublicWorkspace( workspaceId: string, - binary: ArrayBuffer + binary: ArrayBuffer, + singlePage = false ): AffinePublicWorkspace { const blockSuiteWorkspace = createEmptyBlockSuiteWorkspace( workspaceId, (k: string) => // fixme: token could be expired - ({ api: `api/workspace`, token: getLoginStorage()?.token }[k]) + ({ api: `api/workspace`, token: getLoginStorage()?.token }[k]), + { + cachePrefix: WorkspaceFlavour.PUBLIC + (singlePage ? '-single-page' : ''), + } ); BlockSuiteWorkspace.Y.applyUpdate( blockSuiteWorkspace.doc, @@ -49,7 +53,7 @@ export const publicPageBlockSuiteAtom = atom>( workspaceId, pageId ); - return createPublicWorkspace(workspaceId, binary); + return createPublicWorkspace(workspaceId, binary, true); } ); export const publicWorkspaceAtom = atom>( @@ -59,6 +63,6 @@ export const publicWorkspaceAtom = atom>( throw new Error('No workspace id'); } const binary = await affineApis.downloadWorkspace(workspaceId, true); - return createPublicWorkspace(workspaceId, binary); + return createPublicWorkspace(workspaceId, binary, false); } ); diff --git a/apps/web/src/components/__debug__/client/Editor.tsx b/apps/web/src/components/__debug__/client/Editor.tsx index 23d859ba73..0e402cde38 100644 --- a/apps/web/src/components/__debug__/client/Editor.tsx +++ b/apps/web/src/components/__debug__/client/Editor.tsx @@ -1,4 +1,3 @@ -'use client'; import { createEmptyBlockSuiteWorkspace } from '@affine/workspace/utils'; import type { EditorContainer } from '@blocksuite/editor'; import type { Page } from '@blocksuite/store'; @@ -11,7 +10,9 @@ import { BlockSuiteEditor } from '../../blocksuite/block-suite-editor'; const blockSuiteWorkspace = createEmptyBlockSuiteWorkspace( 'test', _ => undefined, - Generator.AutoIncrement + { + idGenerator: Generator.AutoIncrement, + } ); const page = blockSuiteWorkspace.createPage('page0'); diff --git a/apps/web/src/components/affine/workspace-setting-detail/panel/publish/index.tsx b/apps/web/src/components/affine/workspace-setting-detail/panel/publish/index.tsx index d969355553..d0ccbe59ae 100644 --- a/apps/web/src/components/affine/workspace-setting-detail/panel/publish/index.tsx +++ b/apps/web/src/components/affine/workspace-setting-detail/panel/publish/index.tsx @@ -89,8 +89,8 @@ const PublishPanelAffine: React.FC = ({ {t('Publishing Description')}