diff --git a/apps/web/package.json b/apps/web/package.json index d9255f1725..9f2e953894 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -19,12 +19,12 @@ "@affine/jotai": "workspace:*", "@affine/templates": "workspace:*", "@affine/workspace": "workspace:*", - "@blocksuite/blocks": "0.0.0-20230601101714-0d24ba91-nightly", - "@blocksuite/editor": "0.0.0-20230601101714-0d24ba91-nightly", - "@blocksuite/global": "0.0.0-20230601101714-0d24ba91-nightly", + "@blocksuite/blocks": "0.0.0-20230606130340-805f430b-nightly", + "@blocksuite/editor": "0.0.0-20230606130340-805f430b-nightly", + "@blocksuite/global": "0.0.0-20230606130340-805f430b-nightly", "@blocksuite/icons": "^2.1.19", - "@blocksuite/lit": "0.0.0-20230601101714-0d24ba91-nightly", - "@blocksuite/store": "0.0.0-20230601101714-0d24ba91-nightly", + "@blocksuite/lit": "0.0.0-20230606130340-805f430b-nightly", + "@blocksuite/store": "0.0.0-20230606130340-805f430b-nightly", "@dnd-kit/core": "^6.0.8", "@dnd-kit/sortable": "^7.0.2", "@emotion/cache": "^11.11.0", diff --git a/apps/web/preset.config.mjs b/apps/web/preset.config.mjs index 38bc6657e8..84488fd2a3 100644 --- a/apps/web/preset.config.mjs +++ b/apps/web/preset.config.mjs @@ -41,4 +41,8 @@ export const buildFlags = { ), changelogUrl: process.env.CHANGELOG_URL ?? 'http://affine.pro/blog/whats-new-affine-0601', + enablePreloading: + process.env.ENABLE_PRELOADING === undefined + ? true + : process.env.ENABLE_PRELOADING === 'true', }; diff --git a/apps/web/src/adapters/affine/index.tsx b/apps/web/src/adapters/affine/index.tsx index 1ee1177237..6a7d2b4645 100644 --- a/apps/web/src/adapters/affine/index.tsx +++ b/apps/web/src/adapters/affine/index.tsx @@ -3,7 +3,7 @@ * please use new affine cloud instead. */ import { AFFINE_STORAGE_KEY, config } from '@affine/env'; -import { initPage } from '@affine/env/blocksuite'; +import { initEmptyPage } from '@affine/env/blocksuite'; import { PageNotFoundError } from '@affine/env/constant'; import { currentAffineUserAtom } from '@affine/workspace/affine/atom'; import { @@ -330,7 +330,7 @@ export const AffineAdapter: WorkspaceAdapter = { diff --git a/apps/web/src/adapters/local/index.tsx b/apps/web/src/adapters/local/index.tsx index c70e16e955..1d0f4f5734 100644 --- a/apps/web/src/adapters/local/index.tsx +++ b/apps/web/src/adapters/local/index.tsx @@ -1,9 +1,10 @@ import { DebugLogger } from '@affine/debug'; import { + config, DEFAULT_HELLO_WORLD_PAGE_ID, DEFAULT_WORKSPACE_NAME, } from '@affine/env'; -import { initPage } from '@affine/env/blocksuite'; +import { initEmptyPage, initPageWithPreloading } from '@affine/env/blocksuite'; import { PageNotFoundError } from '@affine/env/constant'; import { CRUD, @@ -17,8 +18,8 @@ import { } from '@affine/workspace/type'; import { createEmptyBlockSuiteWorkspace } from '@affine/workspace/utils'; import { nanoid } from '@blocksuite/store'; -import React from 'react'; +import { setEditorFlags } from '../../utils/editor-flag'; import { BlockSuitePageList, PageDetailEditor, @@ -43,10 +44,12 @@ export const LocalAdapter: WorkspaceAdapter = { const page = blockSuiteWorkspace.createPage({ id: DEFAULT_HELLO_WORLD_PAGE_ID, }); - blockSuiteWorkspace.setPageMeta(page.id, { - init: true, - }); - initPage(page); + setEditorFlags(blockSuiteWorkspace); + if (config.enablePreloading) { + initPageWithPreloading(page); + } else { + initEmptyPage(page); + } blockSuiteWorkspace.setPageMeta(page.id, { jumpOnce: true, }); @@ -78,7 +81,7 @@ export const LocalAdapter: WorkspaceAdapter = { <> diff --git a/apps/web/src/atoms/__tests__/atom.spec.ts b/apps/web/src/atoms/__tests__/atom.spec.ts index 1d49a5854e..0e3f9d990b 100644 --- a/apps/web/src/atoms/__tests__/atom.spec.ts +++ b/apps/web/src/atoms/__tests__/atom.spec.ts @@ -3,7 +3,7 @@ */ import 'fake-indexeddb/auto'; -import { initPage } from '@affine/env/blocksuite'; +import { initEmptyPage } from '@affine/env/blocksuite'; import { rootCurrentWorkspaceIdAtom, rootWorkspacesMetadataAtom, @@ -32,7 +32,7 @@ describe('currentWorkspace atom', () => { WorkspaceFlavour.LOCAL ); const page = workspace.createPage({ id: 'page0' }); - initPage(page); + initEmptyPage(page); const frameId = page.getBlockByFlavour('affine:frame').at(0) ?.id as string; id = page.addBlock( diff --git a/apps/web/src/components/__debug__/client/editor.tsx b/apps/web/src/components/__debug__/client/editor.tsx index 6e5511c3fa..3a1c5a2075 100644 --- a/apps/web/src/components/__debug__/client/editor.tsx +++ b/apps/web/src/components/__debug__/client/editor.tsx @@ -1,10 +1,11 @@ +import { initEmptyPage } from '@affine/env/blocksuite'; import { WorkspaceFlavour } from '@affine/workspace/type'; import { createEmptyBlockSuiteWorkspace } from '@affine/workspace/utils'; import type { EditorContainer } from '@blocksuite/editor'; import type { Page } from '@blocksuite/store'; import { Generator } from '@blocksuite/store'; import type React from 'react'; -import { useCallback, useRef } from 'react'; +import { useCallback } from 'react'; import { BlockSuiteEditor } from '../../blocksuite/block-suite-editor'; @@ -18,19 +19,7 @@ const blockSuiteWorkspace = createEmptyBlockSuiteWorkspace( const page = blockSuiteWorkspace.createPage({ id: 'page0' }); -const Editor: React.FC<{ - onInit: (page: Page, editor: Readonly) => void; - testType: 'empty' | 'importMarkdown'; -}> = ({ onInit, testType }) => { - const onceRef = useRef(false); - if (!onceRef.current) { - if (testType === 'importMarkdown') { - page.workspace.meta.setPageMeta(page.id, { - init: true, - }); - } - } - +const Editor: React.FC = () => { const onLoad = useCallback((page: Page, editor: EditorContainer) => { // @ts-ignore globalThis.page = page; @@ -43,7 +32,12 @@ const Editor: React.FC<{ return <>loading...; } return ( - + ); }; diff --git a/apps/web/src/components/pure/quick-search-modal/footer.tsx b/apps/web/src/components/pure/quick-search-modal/footer.tsx index 7bed0836c8..8a5dba24c1 100644 --- a/apps/web/src/components/pure/quick-search-modal/footer.tsx +++ b/apps/web/src/components/pure/quick-search-modal/footer.tsx @@ -1,4 +1,4 @@ -import { initPage } from '@affine/env/blocksuite'; +import { initEmptyPage } from '@affine/env/blocksuite'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; import type { PageBlockModel } from '@blocksuite/blocks'; import { PlusIcon } from '@blocksuite/icons'; @@ -41,7 +41,7 @@ export const Footer: React.FC = ({ const id = nanoid(); const page = createPage(id); assertEquals(page.id, id); - initPage(page); + initEmptyPage(page); const block = page.getBlockByFlavour( 'affine:page' )[0] as PageBlockModel; diff --git a/apps/web/src/layouts/workspace-layout.tsx b/apps/web/src/layouts/workspace-layout.tsx index 3de3566281..ed74bd04ea 100644 --- a/apps/web/src/layouts/workspace-layout.tsx +++ b/apps/web/src/layouts/workspace-layout.tsx @@ -10,8 +10,8 @@ import { WorkspaceFallback, } from '@affine/component/workspace'; import { DebugLogger } from '@affine/debug'; -import { DEFAULT_HELLO_WORLD_PAGE_ID } from '@affine/env'; -import { initPage } from '@affine/env/blocksuite'; +import { config, DEFAULT_HELLO_WORLD_PAGE_ID } from '@affine/env'; +import { initEmptyPage, initPageWithPreloading } from '@affine/env/blocksuite'; import { setUpLanguage, useI18N } from '@affine/i18n'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; import { createAffineGlobalChannel } from '@affine/workspace/affine/sync'; @@ -64,6 +64,7 @@ import { } from '../providers/modal-provider'; import { pathGenerator, publicPathGenerator } from '../shared'; import { toast } from '../utils'; +import { setEditorFlags } from '../utils/editor-flag'; const QuickSearchModal = lazy(() => import('../components/pure/quick-search-modal').then(module => ({ @@ -305,10 +306,12 @@ export const WorkspaceLayoutInner: FC = ({ children }) => { id: pageId, }); assertEquals(page.id, pageId); - currentWorkspace.blockSuiteWorkspace.setPageMeta(page.id, { - init: true, - }); - initPage(page); + setEditorFlags(currentWorkspace.blockSuiteWorkspace); + if (config.enablePreloading) { + initPageWithPreloading(page); + } else { + initEmptyPage(page); + } if (!router.query.pageId) { setCurrentPageId(pageId); void jumpToPage(currentWorkspace.id, pageId); diff --git a/apps/web/src/pages/_debug/init-page.dev.tsx b/apps/web/src/pages/_debug/init-page.dev.tsx index 8e8d35b298..22bdbefd02 100644 --- a/apps/web/src/pages/_debug/init-page.dev.tsx +++ b/apps/web/src/pages/_debug/init-page.dev.tsx @@ -1,5 +1,4 @@ import { AppContainer, MainContainer } from '@affine/component/workspace'; -import { initPage } from '@affine/env/blocksuite'; import { useRouter } from 'next/router'; import { lazy, Suspense } from 'react'; @@ -16,17 +15,12 @@ const InitPagePage: NextPageWithLayout = () => { if (!router.isReady) { return <>loading...; } - let testType: 'empty' | 'importMarkdown' = 'empty'; - if (router.query.type === 'importMarkdown') { - testType = 'importMarkdown'; - } else if (router.query.type === 'empty') { - testType = 'empty'; - } + return ( - +
diff --git a/apps/web/src/pages/public-workspace/[workspaceId]/[pageId].tsx b/apps/web/src/pages/public-workspace/[workspaceId]/[pageId].tsx index 7d2f070c61..cd9072e5e2 100644 --- a/apps/web/src/pages/public-workspace/[workspaceId]/[pageId].tsx +++ b/apps/web/src/pages/public-workspace/[workspaceId]/[pageId].tsx @@ -1,5 +1,5 @@ import { Breadcrumbs, displayFlex, styled } from '@affine/component'; -import { initPage } from '@affine/env/blocksuite'; +import { initEmptyPage } from '@affine/env/blocksuite'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; import { PageIcon } from '@blocksuite/icons'; import { assertExists } from '@blocksuite/store'; @@ -107,7 +107,7 @@ const PublicWorkspaceDetailPageInner = (): ReactElement => { dispose.dispose(); }; }} - onInit={initPage} + onInit={initEmptyPage} /> ); diff --git a/apps/web/src/pages/workspace/[workspaceId]/[pageId].tsx b/apps/web/src/pages/workspace/[workspaceId]/[pageId].tsx index c4a916de5e..525b8d4e72 100644 --- a/apps/web/src/pages/workspace/[workspaceId]/[pageId].tsx +++ b/apps/web/src/pages/workspace/[workspaceId]/[pageId].tsx @@ -1,6 +1,4 @@ import { PageDetailSkeleton } from '@affine/component/page-detail-skeleton'; -import type { BlockSuiteFeatureFlags } from '@affine/env'; -import { config } from '@affine/env'; import { rootCurrentPageIdAtom } from '@affine/workspace/atom'; import type { EditorContainer } from '@blocksuite/editor'; import type { Page } from '@blocksuite/store'; @@ -9,7 +7,7 @@ import { useBlockSuiteWorkspacePage } from '@toeverything/hooks/use-block-suite- import { useAtomValue } from 'jotai'; import { useRouter } from 'next/router'; import type React from 'react'; -import { useCallback, useEffect } from 'react'; +import { useCallback } from 'react'; import { getUIAdapter } from '../../../adapters/workspace'; import { rootCurrentWorkspaceAtom } from '../../../atoms/root'; @@ -17,16 +15,7 @@ import { useCurrentWorkspace } from '../../../hooks/current/use-current-workspac import { useSyncRecentViewsWithRouter } from '../../../hooks/use-recent-views'; import { useRouterHelper } from '../../../hooks/use-router-helper'; import { WorkspaceLayout } from '../../../layouts/workspace-layout'; -import type { BlockSuiteWorkspace, NextPageWithLayout } from '../../../shared'; - -function setEditorFlags(blockSuiteWorkspace: BlockSuiteWorkspace) { - Object.entries(config.editorFlags).forEach(([key, value]) => { - blockSuiteWorkspace.awarenessStore.setFlag( - key as keyof BlockSuiteFeatureFlags, - value - ); - }); -} +import type { NextPageWithLayout } from '../../../shared'; const WorkspaceDetail: React.FC = () => { const router = useRouter(); @@ -50,12 +39,6 @@ const WorkspaceDetail: React.FC = () => { [blockSuiteWorkspace.id, openPage] ); - useEffect(() => { - if (currentWorkspace) { - setEditorFlags(currentWorkspace.blockSuiteWorkspace); - } - }, [currentWorkspace]); - const { PageDetail, Header } = getUIAdapter(currentWorkspace.flavour); return ( <> diff --git a/apps/web/src/utils/editor-flag.ts b/apps/web/src/utils/editor-flag.ts new file mode 100644 index 0000000000..968ece8268 --- /dev/null +++ b/apps/web/src/utils/editor-flag.ts @@ -0,0 +1,12 @@ +import { type BlockSuiteFeatureFlags, config } from '@affine/env'; + +import type { BlockSuiteWorkspace } from '../shared'; + +export function setEditorFlags(blockSuiteWorkspace: BlockSuiteWorkspace) { + Object.entries(config.editorFlags).forEach(([key, value]) => { + blockSuiteWorkspace.awarenessStore.setFlag( + key as keyof BlockSuiteFeatureFlags, + value + ); + }); +} diff --git a/package.json b/package.json index 9379844755..2ba0e6ff4b 100644 --- a/package.json +++ b/package.json @@ -31,9 +31,9 @@ "lint:fix": "yarn lint --fix", "test": "playwright test", "test:coverage": "COVERAGE=true yarn test --forbid-only", - "test:unit": "vitest --run", - "test:unit:ui": "vitest --ui", - "test:unit:coverage": "vitest run --coverage", + "test:unit": "ENABLE_PRELOADING=false vitest --run", + "test:unit:ui": "ENABLE_PRELOADING=false vitest --ui", + "test:unit:coverage": "ENABLE_PRELOADING=false vitest run --coverage", "postinstall": "i18n-codegen gen && husky install", "notify": "node scripts/notify.mjs", "typecheck": "tsc -b tsconfig.json --diagnostics" diff --git a/packages/component/package.json b/packages/component/package.json index 89abc604d7..722f8fb956 100644 --- a/packages/component/package.json +++ b/packages/component/package.json @@ -49,12 +49,12 @@ "rxjs": "^7.8.1" }, "devDependencies": { - "@blocksuite/blocks": "0.0.0-20230601122821-16196c35-nightly", - "@blocksuite/editor": "0.0.0-20230601122821-16196c35-nightly", - "@blocksuite/global": "0.0.0-20230601122821-16196c35-nightly", + "@blocksuite/blocks": "0.0.0-20230606130340-805f430b-nightly", + "@blocksuite/editor": "0.0.0-20230606130340-805f430b-nightly", + "@blocksuite/global": "0.0.0-20230606130340-805f430b-nightly", "@blocksuite/icons": "^2.1.19", - "@blocksuite/lit": "0.0.0-20230601122821-16196c35-nightly", - "@blocksuite/store": "0.0.0-20230601122821-16196c35-nightly", + "@blocksuite/lit": "0.0.0-20230606130340-805f430b-nightly", + "@blocksuite/store": "0.0.0-20230606130340-805f430b-nightly", "@types/react": "^18.2.6", "@types/react-dnd": "^3.0.2", "@types/react-dom": "18.2.4", diff --git a/packages/env/package.json b/packages/env/package.json index b4375eb335..5aba17edc3 100644 --- a/packages/env/package.json +++ b/packages/env/package.json @@ -5,7 +5,7 @@ "module": "./src/index.ts", "devDependencies": { "@affine/templates": "workspace:*", - "@blocksuite/global": "0.0.0-20230601122821-16196c35-nightly", + "@blocksuite/global": "0.0.0-20230606130340-805f430b-nightly", "next": "=13.4.2", "react": "18.3.0-canary-16d053d59-20230506", "react-dom": "18.3.0-canary-16d053d59-20230506", diff --git a/packages/env/src/blocksuite/index.ts b/packages/env/src/blocksuite/index.ts index f34e1cba66..02d565307f 100644 --- a/packages/env/src/blocksuite/index.ts +++ b/packages/env/src/blocksuite/index.ts @@ -1,57 +1,16 @@ -import markdownTemplate from '@affine/templates/AFFiNE-beta-0.5.4.md'; -import { ContentParser } from '@blocksuite/blocks/content-parser'; import type { Page } from '@blocksuite/store'; -declare global { - interface Window { - lastImportedMarkdown: string; - } +export async function initPageWithPreloading(page: Page) { + const workspace = page.workspace; + const { data } = await import('@affine/templates/preloading.json'); + await workspace.importPageSnapshot(data['space:Qmo9-1SGTB'], page.id); } -const markdown = markdownTemplate as unknown as string; - -const demoTitle = markdown - .split('\n') - .splice(0, 1) - .join('') - .replaceAll('#', '') - .trim(); - -const demoText = markdown.split('\n').slice(1).join('\n'); - -export function initPage(page: Page): void { - console.debug('initEmptyPage', page.id); - // Add page block and surface block at root level - const isFirstPage = page.meta.init === true; - if (isFirstPage) { - page.workspace.setPageMeta(page.id, { - init: false, - }); - _initPageWithDemoMarkdown(page); - } else { - _initEmptyPage(page); - } - page.resetHistory(); -} - -export function _initEmptyPage(page: Page, title?: string): void { +export function initEmptyPage(page: Page): void { const pageBlockId = page.addBlock('affine:page', { - title: new page.Text(title ?? ''), + title: new page.Text(''), }); page.addBlock('affine:surface', {}, pageBlockId); const frameId = page.addBlock('affine:frame', {}, pageBlockId); page.addBlock('affine:paragraph', {}, frameId); } - -export function _initPageWithDemoMarkdown(page: Page): void { - console.debug('initPageWithDefaultMarkdown', page.id); - const pageBlockId = page.addBlock('affine:page', { - title: new page.Text(demoTitle), - }); - page.addBlock('affine:surface', {}, pageBlockId); - const frameId = page.addBlock('affine:frame', {}, pageBlockId); - page.addBlock('affine:paragraph', {}, frameId); - const contentParser = new ContentParser(page); - contentParser.importMarkdown(demoText, frameId); - page.workspace.setPageMeta(page.id, { title: demoTitle }); -} diff --git a/packages/env/src/config.ts b/packages/env/src/config.ts index 64f2624cac..454d43a557 100644 --- a/packages/env/src/config.ts +++ b/packages/env/src/config.ts @@ -21,6 +21,7 @@ export const buildFlagsSchema = z.object({ enableDebugPage: z.boolean(), enableLegacyCloud: z.boolean(), changelogUrl: z.string(), + enablePreloading: z.boolean(), }); export const blockSuiteFeatureFlags = z.object({ diff --git a/packages/hooks/src/__tests__/use-blocksuite-workspace-helper.spec.ts b/packages/hooks/src/__tests__/use-blocksuite-workspace-helper.spec.ts index fb33273715..99861de381 100644 --- a/packages/hooks/src/__tests__/use-blocksuite-workspace-helper.spec.ts +++ b/packages/hooks/src/__tests__/use-blocksuite-workspace-helper.spec.ts @@ -3,7 +3,7 @@ */ import 'fake-indexeddb/auto'; -import { initPage } from '@affine/env/blocksuite'; +import { initEmptyPage } from '@affine/env/blocksuite'; import { __unstableSchemas, AffineSchemas } from '@blocksuite/blocks/models'; import { Workspace } from '@blocksuite/store'; import { renderHook } from '@testing-library/react'; @@ -20,9 +20,9 @@ beforeEach(() => { }) .register(AffineSchemas) .register(__unstableSchemas); - initPage(blockSuiteWorkspace.createPage({ id: 'page0' })); - initPage(blockSuiteWorkspace.createPage({ id: 'page1' })); - initPage(blockSuiteWorkspace.createPage({ id: 'page2' })); + initEmptyPage(blockSuiteWorkspace.createPage({ id: 'page0' })); + initEmptyPage(blockSuiteWorkspace.createPage({ id: 'page1' })); + initEmptyPage(blockSuiteWorkspace.createPage({ id: 'page2' })); }); describe('useBlockSuiteWorkspaceHelper', () => { @@ -50,7 +50,7 @@ describe('useBlockSuiteWorkspaceHelper', () => { ); await helperHook.result.current.markMilestone('test'); expect(blockSuiteWorkspace.meta.pageMetas.length).toBe(3); - initPage(helperHook.result.current.createPage('page4')); + initEmptyPage(helperHook.result.current.createPage('page4')); expect(blockSuiteWorkspace.meta.pageMetas.length).toBe(4); expect(await helperHook.result.current.listMilestone()).toHaveProperty( 'test' diff --git a/packages/hooks/src/use-block-suite-page-meta.ts b/packages/hooks/src/use-block-suite-page-meta.ts index 02d4795675..1017c562a5 100644 --- a/packages/hooks/src/use-block-suite-page-meta.ts +++ b/packages/hooks/src/use-block-suite-page-meta.ts @@ -16,8 +16,6 @@ declare module '@blocksuite/store' { updatedDate?: number; mode?: 'page' | 'edgeless'; jumpOnce?: boolean; - // whether to create the page with the default template - init?: boolean; // todo: support `number` in the future isPublic?: boolean; } diff --git a/packages/jotai/package.json b/packages/jotai/package.json index 6702aaf8fc..0844edba60 100644 --- a/packages/jotai/package.json +++ b/packages/jotai/package.json @@ -7,11 +7,11 @@ "jotai": "^2.1.1" }, "devDependencies": { - "@blocksuite/blocks": "0.0.0-20230601101714-0d24ba91-nightly", - "@blocksuite/editor": "0.0.0-20230601101714-0d24ba91-nightly", - "@blocksuite/global": "0.0.0-20230601101714-0d24ba91-nightly", - "@blocksuite/lit": "0.0.0-20230601101714-0d24ba91-nightly", - "@blocksuite/store": "0.0.0-20230601101714-0d24ba91-nightly", + "@blocksuite/blocks": "0.0.0-20230606130340-805f430b-nightly", + "@blocksuite/editor": "0.0.0-20230606130340-805f430b-nightly", + "@blocksuite/global": "0.0.0-20230606130340-805f430b-nightly", + "@blocksuite/lit": "0.0.0-20230606130340-805f430b-nightly", + "@blocksuite/store": "0.0.0-20230606130340-805f430b-nightly", "lottie-web": "^5.12.0" }, "peerDependencies": { diff --git a/packages/plugin-infra/package.json b/packages/plugin-infra/package.json index b83cb1248e..20a46ba47e 100644 --- a/packages/plugin-infra/package.json +++ b/packages/plugin-infra/package.json @@ -13,11 +13,11 @@ "@affine/component": "workspace:*", "@affine/env": "workspace:*", "@affine/workspace": "workspace:*", - "@blocksuite/blocks": "0.0.0-20230601101714-0d24ba91-nightly", - "@blocksuite/editor": "0.0.0-20230601101714-0d24ba91-nightly", - "@blocksuite/global": "0.0.0-20230601101714-0d24ba91-nightly", - "@blocksuite/lit": "0.0.0-20230601101714-0d24ba91-nightly", - "@blocksuite/store": "0.0.0-20230601101714-0d24ba91-nightly" + "@blocksuite/blocks": "0.0.0-20230606130340-805f430b-nightly", + "@blocksuite/editor": "0.0.0-20230606130340-805f430b-nightly", + "@blocksuite/global": "0.0.0-20230606130340-805f430b-nightly", + "@blocksuite/lit": "0.0.0-20230606130340-805f430b-nightly", + "@blocksuite/store": "0.0.0-20230606130340-805f430b-nightly" }, "devDependencies": { "jotai": "^2.1.1" diff --git a/packages/storybook/src/stories/image-preview-modal.stories.tsx b/packages/storybook/src/stories/image-preview-modal.stories.tsx index fccaeb3c7a..74e524df04 100644 --- a/packages/storybook/src/stories/image-preview-modal.stories.tsx +++ b/packages/storybook/src/stories/image-preview-modal.stories.tsx @@ -1,6 +1,6 @@ import { BlockSuiteEditor } from '@affine/component/block-suite-editor'; import { ImagePreviewModal } from '@affine/component/image-preview-modal'; -import { initPage } from '@affine/env/blocksuite'; +import { initEmptyPage } from '@affine/env/blocksuite'; import { WorkspaceFlavour } from '@affine/workspace/type'; import { createEmptyBlockSuiteWorkspace } from '@affine/workspace/utils'; import type { Meta } from '@storybook/react'; @@ -15,7 +15,7 @@ const workspace = createEmptyBlockSuiteWorkspace( WorkspaceFlavour.LOCAL ); const page = workspace.createPage('page0'); -initPage(page); +initEmptyPage(page); fetch(new URL('@affine-test/fixtures/large-image.png', import.meta.url)) .then(res => res.arrayBuffer()) .then(async buffer => { @@ -49,7 +49,7 @@ export const Default = () => { overflow: 'auto', }} > - +
{ describe('utils', () => { test('download binary', async () => { const page = workspace.createPage('page0'); - initPage(page); + initEmptyPage(page); const provider = createIndexedDBProvider( workspace.id, workspace.doc, diff --git a/tests/libs/page-logic.ts b/tests/libs/page-logic.ts index a3021f9055..8c1840aca7 100644 --- a/tests/libs/page-logic.ts +++ b/tests/libs/page-logic.ts @@ -1,8 +1,10 @@ import type { Page } from '@playwright/test'; import { expect } from '@playwright/test'; -export async function waitMarkdownImported(page: Page) { - await page.waitForSelector('v-line'); +export async function waitEditorLoad(page: Page) { + await page.waitForSelector('v-line', { + timeout: 10000, + }); } export async function newPage(page: Page) { @@ -10,7 +12,7 @@ export async function newPage(page: Page) { await page.getByTestId('new-page-button').click({ delay: 100, }); - await page.waitForSelector('v-line'); + await waitEditorLoad(page); } export function getBlockSuiteEditorTitle(page: Page) { diff --git a/tests/parallels/affine/affine-built-in-workspace.spec.ts b/tests/parallels/affine/affine-built-in-workspace.spec.ts index 393e493fef..5ab6e3de43 100644 --- a/tests/parallels/affine/affine-built-in-workspace.spec.ts +++ b/tests/parallels/affine/affine-built-in-workspace.spec.ts @@ -2,7 +2,7 @@ import { test } from '@affine-test/kit/playwright'; import { expect } from '@playwright/test'; import { openHomePage } from '../../libs/load-page'; -import { waitMarkdownImported } from '../../libs/page-logic'; +import { waitEditorLoad } from '../../libs/page-logic'; import { clickNewPageButton, clickSideBarCurrentWorkspaceBanner, @@ -11,7 +11,7 @@ import { getBuiltInUser, loginUser } from '../../libs/utils'; test('collaborative', async ({ page, browser }) => { await openHomePage(page); - await waitMarkdownImported(page); + await waitEditorLoad(page); const [a, b] = await getBuiltInUser(); await loginUser(page, a); await page.reload(); diff --git a/tests/parallels/affine/affine-lost-auth.spec.ts b/tests/parallels/affine/affine-lost-auth.spec.ts index a83c3eac18..824abc60a0 100644 --- a/tests/parallels/affine/affine-lost-auth.spec.ts +++ b/tests/parallels/affine/affine-lost-auth.spec.ts @@ -2,14 +2,14 @@ import { test } from '@affine-test/kit/playwright'; import { expect } from '@playwright/test'; import { openHomePage } from '../../libs/load-page'; -import { waitMarkdownImported } from '../../libs/page-logic'; +import { waitEditorLoad } from '../../libs/page-logic'; import { clickSideBarAllPageButton } from '../../libs/sidebar'; import { createFakeUser, loginUser } from '../../libs/utils'; import { enableAffineCloudWorkspace } from '../../libs/workspace'; test('authorization expired', async ({ page }) => { await openHomePage(page); - await waitMarkdownImported(page); + await waitEditorLoad(page); const [a] = await createFakeUser(); await loginUser(page, a); await enableAffineCloudWorkspace(page); diff --git a/tests/parallels/affine/affine-public-single-page.spec.ts b/tests/parallels/affine/affine-public-single-page.spec.ts index 418e83ce35..5c8f7e5d07 100644 --- a/tests/parallels/affine/affine-public-single-page.spec.ts +++ b/tests/parallels/affine/affine-public-single-page.spec.ts @@ -2,7 +2,7 @@ import { test } from '@affine-test/kit/playwright'; import { expect } from '@playwright/test'; import { openHomePage } from '../../libs/load-page'; -import { waitMarkdownImported } from '../../libs/page-logic'; +import { waitEditorLoad } from '../../libs/page-logic'; import { clickNewPageButton } from '../../libs/sidebar'; import { createFakeUser, loginUser } from '../../libs/utils'; import { createWorkspace } from '../../libs/workspace'; @@ -13,7 +13,7 @@ test('public single page', async ({ page, browser }) => { await loginUser(page, a); const name = `test-${Date.now()}`; await createWorkspace({ name }, page); - await waitMarkdownImported(page); + await waitEditorLoad(page); await clickNewPageButton(page); const page1Id = page.url().split('/').at(-1); await clickNewPageButton(page); diff --git a/tests/parallels/affine/affine-public-workspace.spec.ts b/tests/parallels/affine/affine-public-workspace.spec.ts index 4403eb1b6a..717add589c 100644 --- a/tests/parallels/affine/affine-public-workspace.spec.ts +++ b/tests/parallels/affine/affine-public-workspace.spec.ts @@ -2,7 +2,7 @@ import { test } from '@affine-test/kit/playwright'; import { expect } from '@playwright/test'; import { openHomePage } from '../../libs/load-page'; -import { waitMarkdownImported } from '../../libs/page-logic'; +import { waitEditorLoad } from '../../libs/page-logic'; import { clickPublishPanel } from '../../libs/setting'; import { clickSideBarAllPageButton, @@ -15,10 +15,10 @@ test('enable public workspace', async ({ page, context }) => { await openHomePage(page); const [a] = await createFakeUser(); await loginUser(page, a); - await waitMarkdownImported(page); + await waitEditorLoad(page); const name = `test-${Date.now()}`; await createWorkspace({ name }, page); - await waitMarkdownImported(page); + await waitEditorLoad(page); await clickSideBarSettingButton(page); await page.waitForTimeout(50); await clickPublishPanel(page); @@ -45,10 +45,10 @@ test('access public workspace page', async ({ page, browser }) => { await openHomePage(page); const [a] = await createFakeUser(); await loginUser(page, a); - await waitMarkdownImported(page); + await waitEditorLoad(page); const name = `test-${Date.now()}`; await createWorkspace({ name }, page); - await waitMarkdownImported(page); + await waitEditorLoad(page); await clickSideBarSettingButton(page); await page.waitForTimeout(50); await clickPublishPanel(page); diff --git a/tests/parallels/affine/affine-workspace.spec.ts b/tests/parallels/affine/affine-workspace.spec.ts index 2fc6be2ee8..2c3f0981b7 100644 --- a/tests/parallels/affine/affine-workspace.spec.ts +++ b/tests/parallels/affine/affine-workspace.spec.ts @@ -1,7 +1,7 @@ import { expect } from '@playwright/test'; import { openHomePage } from '../../libs/load-page'; -import { waitMarkdownImported } from '../../libs/page-logic'; +import { waitEditorLoad } from '../../libs/page-logic'; // eslint-disable-next-line @typescript-eslint/no-var-requires const userA = require('../../fixtures/userA.json'); @@ -23,7 +23,7 @@ import { test('should login with user A', async ({ page }) => { await openHomePage(page); - await waitMarkdownImported(page); + await waitEditorLoad(page); const [a] = await createFakeUser(userA, userB); await loginUser(page, a); await clickSideBarCurrentWorkspaceBanner(page); @@ -35,7 +35,7 @@ test('should login with user A', async ({ page }) => { test('should enable affine workspace successfully', async ({ page }) => { await openHomePage(page); - await waitMarkdownImported(page); + await waitEditorLoad(page); const [a] = await createFakeUser(); await loginUser(page, a); const name = `test-${Date.now()}`; @@ -50,6 +50,6 @@ test('should enable affine workspace successfully', async ({ page }) => { await assertCurrentWorkspaceFlavour('affine', page); await openWorkspaceListModal(page); await page.getByTestId('workspace-list-modal-sign-out').click(); - await waitMarkdownImported(page); + await waitEditorLoad(page); await assertCurrentWorkspaceFlavour('local', page); }); diff --git a/tests/parallels/all-page.spec.ts b/tests/parallels/all-page.spec.ts index f6c59cc16a..0243a67c6e 100644 --- a/tests/parallels/all-page.spec.ts +++ b/tests/parallels/all-page.spec.ts @@ -3,10 +3,7 @@ import type { Page } from '@playwright/test'; import { expect } from '@playwright/test'; import { openHomePage } from '../libs/load-page'; -import { - getBlockSuiteEditorTitle, - waitMarkdownImported, -} from '../libs/page-logic'; +import { getBlockSuiteEditorTitle, waitEditorLoad } from '../libs/page-logic'; import { clickSideBarAllPageButton } from '../libs/sidebar'; function getAllPage(page: Page) { @@ -29,14 +26,14 @@ function getAllPage(page: Page) { test('all page', async ({ page }) => { await openHomePage(page); - await waitMarkdownImported(page); + await waitEditorLoad(page); await clickSideBarAllPageButton(page); }); test('all page can create new page', async ({ page }) => { const { clickNewPageButton } = getAllPage(page); await openHomePage(page); - await waitMarkdownImported(page); + await waitEditorLoad(page); await clickSideBarAllPageButton(page); await clickNewPageButton(); const title = getBlockSuiteEditorTitle(page); @@ -49,7 +46,7 @@ test('all page can create new page', async ({ page }) => { test('all page can create new edgeless page', async ({ page }) => { const { clickNewEdgelessDropdown } = getAllPage(page); await openHomePage(page); - await waitMarkdownImported(page); + await waitEditorLoad(page); await clickSideBarAllPageButton(page); await clickNewEdgelessDropdown(); await expect(page.locator('affine-edgeless-page')).toBeVisible(); @@ -79,7 +76,7 @@ const checkFilterName = async (page: Page, name: string) => { test('allow creation of filters by favorite', async ({ page }) => { await openHomePage(page); - await waitMarkdownImported(page); + await waitEditorLoad(page); await clickSideBarAllPageButton(page); await closeDownloadTip(page); await createFirstFilter(page, 'Is Favourited'); @@ -118,7 +115,7 @@ const fillDatePicker = async (page: Page, date: Date) => { }; test('allow creation of filters by created time', async ({ page }) => { await openHomePage(page); - await waitMarkdownImported(page); + await waitEditorLoad(page); await clickSideBarAllPageButton(page); await closeDownloadTip(page); await createFirstFilter(page, 'Created'); diff --git a/tests/parallels/change-page-mode.spec.ts b/tests/parallels/change-page-mode.spec.ts index 316577ed6a..ceb81e34fd 100644 --- a/tests/parallels/change-page-mode.spec.ts +++ b/tests/parallels/change-page-mode.spec.ts @@ -2,7 +2,7 @@ import { test } from '@affine-test/kit/playwright'; import { expect } from '@playwright/test'; import { openHomePage } from '../libs/load-page'; -import { clickPageMoreActions, waitMarkdownImported } from '../libs/page-logic'; +import { clickPageMoreActions, waitEditorLoad } from '../libs/page-logic'; test('Switch to edgeless by switch edgeless item', async ({ page }) => { async function getCount(): Promise { @@ -11,7 +11,7 @@ test('Switch to edgeless by switch edgeless item', async ({ page }) => { }); } await openHomePage(page); - await waitMarkdownImported(page); + await waitEditorLoad(page); const btn = await page.getByTestId('switch-edgeless-mode-button'); await page.evaluate(() => { globalThis.__toastCount = 0; @@ -50,7 +50,7 @@ test('Switch to edgeless by switch edgeless item', async ({ page }) => { test('Convert to edgeless by editor header items', async ({ page }) => { await openHomePage(page); - await waitMarkdownImported(page); + await waitEditorLoad(page); await clickPageMoreActions(page); const menusEdgelessItem = page.getByTestId('editor-option-menu-edgeless'); await menusEdgelessItem.click({ delay: 100 }); diff --git a/tests/parallels/contact-us.spec.ts b/tests/parallels/contact-us.spec.ts index c523b98258..9a0366f3f8 100644 --- a/tests/parallels/contact-us.spec.ts +++ b/tests/parallels/contact-us.spec.ts @@ -2,11 +2,11 @@ import { test } from '@affine-test/kit/playwright'; import { expect } from '@playwright/test'; import { openHomePage } from '../libs/load-page'; -import { waitMarkdownImported } from '../libs/page-logic'; +import { waitEditorLoad } from '../libs/page-logic'; test('Click right-bottom corner contact icon', async ({ page }) => { await openHomePage(page); - await waitMarkdownImported(page); + await waitEditorLoad(page); await page.locator('[data-testid=help-island]').click(); const rightBottomContactUs = page.locator( '[data-testid=right-bottom-contact-us-icon]' diff --git a/tests/parallels/debug-init-page.spec.ts b/tests/parallels/debug-init-page.spec.ts index 72736df47d..43ab8dfef5 100644 --- a/tests/parallels/debug-init-page.spec.ts +++ b/tests/parallels/debug-init-page.spec.ts @@ -2,7 +2,7 @@ import { test } from '@affine-test/kit/playwright'; import { expect } from '@playwright/test'; test('should have page0', async ({ page }) => { - await page.goto('http://localhost:8080/_debug/init-page?type=importMarkdown'); + await page.goto('http://localhost:8080/_debug/init-page'); await page.waitForSelector('v-line'); const pageId = await page.evaluate(async () => { // @ts-ignore diff --git a/tests/parallels/drag-page-to-trash-folder.spec.ts b/tests/parallels/drag-page-to-trash-folder.spec.ts index 42e4a2aeb2..c74c3c1deb 100644 --- a/tests/parallels/drag-page-to-trash-folder.spec.ts +++ b/tests/parallels/drag-page-to-trash-folder.spec.ts @@ -2,7 +2,7 @@ import { test } from '@affine-test/kit/playwright'; import { expect } from '@playwright/test'; import { openHomePage } from '../libs/load-page'; -import { waitMarkdownImported } from '../libs/page-logic'; +import { waitEditorLoad } from '../libs/page-logic'; test('drag a page from "All pages" list onto the "Trash" folder in the sidebar to move it to trash list', async ({ page, @@ -11,7 +11,7 @@ test('drag a page from "All pages" list onto the "Trash" folder in the sidebar t // Init test db with known workspaces and open "All Pages" page via url directly { await openHomePage(page); - await waitMarkdownImported(page); + await waitEditorLoad(page); await page.getByText('All Pages').click(); } diff --git a/tests/parallels/image-preview.spec.ts b/tests/parallels/image-preview.spec.ts index da7a046497..12aeb16781 100644 --- a/tests/parallels/image-preview.spec.ts +++ b/tests/parallels/image-preview.spec.ts @@ -5,7 +5,7 @@ import { openHomePage } from '../libs/load-page'; import { getBlockSuiteEditorTitle, newPage, - waitMarkdownImported, + waitEditorLoad, } from '../libs/page-logic'; async function importImage(page: Page, url: string) { @@ -42,7 +42,7 @@ async function closeImagePreviewModal(page: Page) { test('image preview should be shown', async ({ page }) => { await openHomePage(page); - await waitMarkdownImported(page); + await waitEditorLoad(page); await newPage(page); const title = await getBlockSuiteEditorTitle(page); await title.click(); @@ -57,7 +57,7 @@ test('image preview should be shown', async ({ page }) => { test('image go left and right', async ({ page }) => { await openHomePage(page); - await waitMarkdownImported(page); + await waitEditorLoad(page); await newPage(page); let blobId: string; { diff --git a/tests/parallels/layout.spec.ts b/tests/parallels/layout.spec.ts index 096b00a809..780073d4db 100644 --- a/tests/parallels/layout.spec.ts +++ b/tests/parallels/layout.spec.ts @@ -2,11 +2,11 @@ import { test } from '@affine-test/kit/playwright'; import { expect } from '@playwright/test'; import { openHomePage } from '../libs/load-page'; -import { waitMarkdownImported } from '../libs/page-logic'; +import { waitEditorLoad } from '../libs/page-logic'; test('Collapse Sidebar', async ({ page }) => { await openHomePage(page); - await waitMarkdownImported(page); + await waitEditorLoad(page); await page.getByTestId('app-sidebar-arrow-button-collapse').click(); const sliderBarArea = page.getByTestId('app-sidebar'); await expect(sliderBarArea).not.toBeInViewport(); @@ -14,7 +14,7 @@ test('Collapse Sidebar', async ({ page }) => { test('Expand Sidebar', async ({ page }) => { await openHomePage(page); - await waitMarkdownImported(page); + await waitEditorLoad(page); await page.getByTestId('app-sidebar-arrow-button-collapse').click(); const sliderBarArea = page.getByTestId('sliderBar-inner'); await expect(sliderBarArea).not.toBeInViewport(); @@ -25,7 +25,7 @@ test('Expand Sidebar', async ({ page }) => { test('Click resizer can close sidebar', async ({ page }) => { await openHomePage(page); - await waitMarkdownImported(page); + await waitEditorLoad(page); const sliderBarArea = page.getByTestId('sliderBar-inner'); await expect(sliderBarArea).toBeVisible(); @@ -35,7 +35,7 @@ test('Click resizer can close sidebar', async ({ page }) => { test('Drag resizer can resize sidebar', async ({ page }) => { await openHomePage(page); - await waitMarkdownImported(page); + await waitEditorLoad(page); const sliderBarArea = page.getByTestId('sliderBar-inner'); await expect(sliderBarArea).toBeVisible(); @@ -52,7 +52,7 @@ test('Drag resizer can resize sidebar', async ({ page }) => { test('Sidebar in between sm & md breakpoint', async ({ page }) => { await openHomePage(page); - await waitMarkdownImported(page); + await waitEditorLoad(page); const sliderBarArea = page.getByTestId('sliderBar-inner'); const sliderBarModalBackground = page.getByTestId('app-sidebar-float-mask'); await expect(sliderBarArea).toBeInViewport(); diff --git a/tests/parallels/local-first-avatar.spec.ts b/tests/parallels/local-first-avatar.spec.ts index 9d84bf4551..37602f7c56 100644 --- a/tests/parallels/local-first-avatar.spec.ts +++ b/tests/parallels/local-first-avatar.spec.ts @@ -2,12 +2,12 @@ import { test } from '@affine-test/kit/playwright'; import { expect } from '@playwright/test'; import { openHomePage } from '../libs/load-page'; -import { newPage, waitMarkdownImported } from '../libs/page-logic'; +import { newPage, waitEditorLoad } from '../libs/page-logic'; import { assertCurrentWorkspaceFlavour } from '../libs/workspace'; test('should create a page with a local first avatar', async ({ page }) => { await openHomePage(page); - await waitMarkdownImported(page); + await waitEditorLoad(page); await newPage(page); await page.getByTestId('workspace-name').click(); await page.getByTestId('new-workspace').click({ delay: 50 }); diff --git a/tests/parallels/local-first-delete-page.spec.ts b/tests/parallels/local-first-delete-page.spec.ts index 4d1c0aec91..156a6b1cc9 100644 --- a/tests/parallels/local-first-delete-page.spec.ts +++ b/tests/parallels/local-first-delete-page.spec.ts @@ -5,7 +5,7 @@ import { openHomePage } from '../libs/load-page'; import { getBlockSuiteEditorTitle, newPage, - waitMarkdownImported, + waitEditorLoad, } from '../libs/page-logic'; import { assertCurrentWorkspaceFlavour } from '../libs/workspace'; @@ -13,7 +13,7 @@ test('New a page , then delete it in all pages, permanently delete it', async ({ page, }) => { await openHomePage(page); - await waitMarkdownImported(page); + await waitEditorLoad(page); await newPage(page); await getBlockSuiteEditorTitle(page).click(); await getBlockSuiteEditorTitle(page).fill('this is a new page to restore'); diff --git a/tests/parallels/local-first-delete-workspace.spec.ts b/tests/parallels/local-first-delete-workspace.spec.ts index ddf4b91b33..a613062e08 100644 --- a/tests/parallels/local-first-delete-workspace.spec.ts +++ b/tests/parallels/local-first-delete-workspace.spec.ts @@ -2,7 +2,7 @@ import { test } from '@affine-test/kit/playwright'; import { expect } from '@playwright/test'; import { openHomePage } from '../libs/load-page'; -import { waitMarkdownImported } from '../libs/page-logic'; +import { waitEditorLoad } from '../libs/page-logic'; import { clickSideBarCurrentWorkspaceBanner, clickSideBarSettingButton, @@ -11,7 +11,7 @@ import { assertCurrentWorkspaceFlavour } from '../libs/workspace'; test('Create new workspace, then delete it', async ({ page }) => { await openHomePage(page); - await waitMarkdownImported(page); + await waitEditorLoad(page); await clickSideBarCurrentWorkspaceBanner(page); await page.getByTestId('new-workspace').click(); await page @@ -49,7 +49,7 @@ test('Create new workspace, then delete it', async ({ page }) => { test('Delete last workspace', async ({ page }) => { await openHomePage(page); - await waitMarkdownImported(page); + await waitEditorLoad(page); await clickSideBarSettingButton(page); await page.getByTestId('delete-workspace-button').click(); const workspaceNameDom = await page.getByTestId('workspace-name'); diff --git a/tests/parallels/local-first-export-page.spec.ts b/tests/parallels/local-first-export-page.spec.ts index e4d74a5555..08577cccaa 100644 --- a/tests/parallels/local-first-export-page.spec.ts +++ b/tests/parallels/local-first-export-page.spec.ts @@ -6,13 +6,13 @@ import { clickPageMoreActions, getBlockSuiteEditorTitle, newPage, - waitMarkdownImported, + waitEditorLoad, } from '../libs/page-logic'; import { assertCurrentWorkspaceFlavour } from '../libs/workspace'; test.skip('New a page ,then open it and export html', async ({ page }) => { await openHomePage(page); - await waitMarkdownImported(page); + await waitEditorLoad(page); await newPage(page); await getBlockSuiteEditorTitle(page).click(); await page diff --git a/tests/parallels/local-first-favorite-page.spec.ts b/tests/parallels/local-first-favorite-page.spec.ts index 4c51d78232..0d00a80024 100644 --- a/tests/parallels/local-first-favorite-page.spec.ts +++ b/tests/parallels/local-first-favorite-page.spec.ts @@ -6,14 +6,14 @@ import { clickPageMoreActions, getBlockSuiteEditorTitle, newPage, - waitMarkdownImported, + waitEditorLoad, } from '../libs/page-logic'; import { waitForLogMessage } from '../libs/utils'; import { assertCurrentWorkspaceFlavour } from '../libs/workspace'; test('New a page and open it ,then favorite it', async ({ page }) => { await openHomePage(page); - await waitMarkdownImported(page); + await waitEditorLoad(page); await newPage(page); await getBlockSuiteEditorTitle(page).click(); await getBlockSuiteEditorTitle(page).fill('this is a new page to favorite'); @@ -32,7 +32,7 @@ test('New a page and open it ,then favorite it', async ({ page }) => { test('Export to html, markdown and png', async ({ page }) => { await openHomePage(page); - await waitMarkdownImported(page); + await waitEditorLoad(page); { await clickPageMoreActions(page); await page.getByTestId('export-menu').click(); @@ -66,7 +66,7 @@ test.skip('Export to pdf', async ({ page }) => { }); }); await openHomePage(page); - await waitMarkdownImported(page); + await waitEditorLoad(page); { await clickPageMoreActions(page); await page.getByTestId('export-menu').click(); @@ -77,7 +77,7 @@ test.skip('Export to pdf', async ({ page }) => { test('Cancel favorite', async ({ page }) => { await openHomePage(page); - await waitMarkdownImported(page); + await waitEditorLoad(page); await newPage(page); await getBlockSuiteEditorTitle(page).click(); await getBlockSuiteEditorTitle(page).fill('this is a new page to favorite'); diff --git a/tests/parallels/local-first-favorites-items.spec.ts b/tests/parallels/local-first-favorites-items.spec.ts index 44cf6aff0b..7157df0672 100644 --- a/tests/parallels/local-first-favorites-items.spec.ts +++ b/tests/parallels/local-first-favorites-items.spec.ts @@ -7,12 +7,12 @@ import { createLinkedPage, getBlockSuiteEditorTitle, newPage, - waitMarkdownImported, + waitEditorLoad, } from '../libs/page-logic'; test('Show favorite items in sidebar', async ({ page }) => { await openHomePage(page); - await waitMarkdownImported(page); + await waitEditorLoad(page); await newPage(page); await getBlockSuiteEditorTitle(page).click(); await getBlockSuiteEditorTitle(page).fill('this is a new page to favorite'); @@ -37,7 +37,7 @@ test('Show favorite items in sidebar', async ({ page }) => { test('Show favorite reference in sidebar', async ({ page }) => { await openHomePage(page); - await waitMarkdownImported(page); + await waitEditorLoad(page); await newPage(page); await getBlockSuiteEditorTitle(page).click(); await getBlockSuiteEditorTitle(page).fill('this is a new page to favorite'); @@ -76,7 +76,7 @@ test("Deleted page's reference will not be shown in sidebar", async ({ page, }) => { await openHomePage(page); - await waitMarkdownImported(page); + await waitEditorLoad(page); await newPage(page); await getBlockSuiteEditorTitle(page).click(); await getBlockSuiteEditorTitle(page).fill('this is a new page to favorite'); diff --git a/tests/parallels/local-first-new-page.spec.ts b/tests/parallels/local-first-new-page.spec.ts index 0a46ebdb0a..13ea13f110 100644 --- a/tests/parallels/local-first-new-page.spec.ts +++ b/tests/parallels/local-first-new-page.spec.ts @@ -5,13 +5,13 @@ import { openHomePage } from '../libs/load-page'; import { getBlockSuiteEditorTitle, newPage, - waitMarkdownImported, + waitEditorLoad, } from '../libs/page-logic'; import { assertCurrentWorkspaceFlavour } from '../libs/workspace'; test('click btn new page', async ({ page }) => { await openHomePage(page); - await waitMarkdownImported(page); + await waitEditorLoad(page); const originPageId = page.url().split('/').reverse()[0]; await newPage(page); const newPageId = page.url().split('/').reverse()[0]; @@ -21,7 +21,7 @@ test('click btn new page', async ({ page }) => { test('click btn bew page and find it in all pages', async ({ page }) => { await openHomePage(page); - await waitMarkdownImported(page); + await waitEditorLoad(page); await newPage(page); await getBlockSuiteEditorTitle(page).click(); await getBlockSuiteEditorTitle(page).fill('this is a new page'); diff --git a/tests/parallels/local-first-openpage-newtab.spec.ts b/tests/parallels/local-first-openpage-newtab.spec.ts index d335b74acf..6a84309623 100644 --- a/tests/parallels/local-first-openpage-newtab.spec.ts +++ b/tests/parallels/local-first-openpage-newtab.spec.ts @@ -5,13 +5,13 @@ import { openHomePage } from '../libs/load-page'; import { getBlockSuiteEditorTitle, newPage, - waitMarkdownImported, + waitEditorLoad, } from '../libs/page-logic'; import { assertCurrentWorkspaceFlavour } from '../libs/workspace'; test('click btn bew page and open in tab', async ({ page }) => { await openHomePage(page); - await waitMarkdownImported(page); + await waitEditorLoad(page); await newPage(page); await getBlockSuiteEditorTitle(page).click(); await getBlockSuiteEditorTitle(page).fill('this is a new page'); diff --git a/tests/parallels/local-first-restore-page.spec.ts b/tests/parallels/local-first-restore-page.spec.ts index 49995ffba5..ff0254f91c 100644 --- a/tests/parallels/local-first-restore-page.spec.ts +++ b/tests/parallels/local-first-restore-page.spec.ts @@ -5,7 +5,7 @@ import { openHomePage } from '../libs/load-page'; import { getBlockSuiteEditorTitle, newPage, - waitMarkdownImported, + waitEditorLoad, } from '../libs/page-logic'; import { assertCurrentWorkspaceFlavour } from '../libs/workspace'; @@ -13,7 +13,7 @@ test('New a page , then delete it in all pages, restore it', async ({ page, }) => { await openHomePage(page); - await waitMarkdownImported(page); + await waitEditorLoad(page); await newPage(page); await getBlockSuiteEditorTitle(page).click(); await getBlockSuiteEditorTitle(page).fill('this is a new page to restore'); diff --git a/tests/parallels/local-first-setting-page.spec.ts b/tests/parallels/local-first-setting-page.spec.ts index 5df4dd7249..a50f0e74b0 100644 --- a/tests/parallels/local-first-setting-page.spec.ts +++ b/tests/parallels/local-first-setting-page.spec.ts @@ -4,14 +4,14 @@ import { test, testResultDir } from '@affine-test/kit/playwright'; import { expect } from '@playwright/test'; import { openHomePage } from '../libs/load-page'; -import { waitMarkdownImported } from '../libs/page-logic'; +import { waitEditorLoad } from '../libs/page-logic'; import { clickSideBarSettingButton } from '../libs/sidebar'; test('Should highlight the setting page menu when selected', async ({ page, }) => { await openHomePage(page); - await waitMarkdownImported(page); + await waitEditorLoad(page); const element = await page.getByTestId('slider-bar-workspace-setting-button'); const prev = await element.screenshot({ path: resolve( diff --git a/tests/parallels/local-first-show-delete-modal.spec.ts b/tests/parallels/local-first-show-delete-modal.spec.ts index 3933806b7b..b49f907b5b 100644 --- a/tests/parallels/local-first-show-delete-modal.spec.ts +++ b/tests/parallels/local-first-show-delete-modal.spec.ts @@ -6,13 +6,13 @@ import { clickPageMoreActions, getBlockSuiteEditorTitle, newPage, - waitMarkdownImported, + waitEditorLoad, } from '../libs/page-logic'; import { assertCurrentWorkspaceFlavour } from '../libs/workspace'; test('New a page ,then open it and show delete modal', async ({ page }) => { await openHomePage(page); - await waitMarkdownImported(page); + await waitEditorLoad(page); await newPage(page); await getBlockSuiteEditorTitle(page).click(); await getBlockSuiteEditorTitle(page).fill('this is a new page to delete'); @@ -35,7 +35,7 @@ test('New a page ,then go to all pages and show delete modal', async ({ page, }) => { await openHomePage(page); - await waitMarkdownImported(page); + await waitEditorLoad(page); await newPage(page); await getBlockSuiteEditorTitle(page).click(); await getBlockSuiteEditorTitle(page).fill('this is a new page to delete'); diff --git a/tests/parallels/local-first-trash-page.spec.ts b/tests/parallels/local-first-trash-page.spec.ts index 451829f7c9..6b0fb76d91 100644 --- a/tests/parallels/local-first-trash-page.spec.ts +++ b/tests/parallels/local-first-trash-page.spec.ts @@ -5,7 +5,7 @@ import { openHomePage } from '../libs/load-page'; import { getBlockSuiteEditorTitle, newPage, - waitMarkdownImported, + waitEditorLoad, } from '../libs/page-logic'; import { assertCurrentWorkspaceFlavour } from '../libs/workspace'; @@ -13,7 +13,7 @@ test('New a page , then delete it in all pages, finally find it in trash', async page, }) => { await openHomePage(page); - await waitMarkdownImported(page); + await waitEditorLoad(page); await newPage(page); await getBlockSuiteEditorTitle(page).click(); await getBlockSuiteEditorTitle(page).fill('this is a new page to delete'); diff --git a/tests/parallels/local-first-workspace-list.spec.ts b/tests/parallels/local-first-workspace-list.spec.ts index 1b6c21bdfe..585472672f 100644 --- a/tests/parallels/local-first-workspace-list.spec.ts +++ b/tests/parallels/local-first-workspace-list.spec.ts @@ -2,13 +2,13 @@ import { test } from '@affine-test/kit/playwright'; import { expect } from '@playwright/test'; import { openHomePage } from '../libs/load-page'; -import { waitMarkdownImported } from '../libs/page-logic'; +import { waitEditorLoad } from '../libs/page-logic'; import { clickSideBarAllPageButton } from '../libs/sidebar'; import { createWorkspace, openWorkspaceListModal } from '../libs/workspace'; test('just one item in the workspace list at first', async ({ page }) => { await openHomePage(page); - await waitMarkdownImported(page); + await waitEditorLoad(page); const workspaceName = page.getByTestId('workspace-name'); await workspaceName.click(); expect( @@ -21,7 +21,7 @@ test('just one item in the workspace list at first', async ({ page }) => { test('create one workspace in the workspace list', async ({ page }) => { await openHomePage(page); - await waitMarkdownImported(page); + await waitEditorLoad(page); const newWorkspaceNameStr = 'New Workspace'; await createWorkspace({ name: newWorkspaceNameStr }, page); @@ -50,7 +50,7 @@ test('create one workspace in the workspace list', async ({ page }) => { test('create multi workspace in the workspace list', async ({ page }) => { await openHomePage(page); - await waitMarkdownImported(page); + await waitEditorLoad(page); await createWorkspace({ name: 'New Workspace 2' }, page); await createWorkspace({ name: 'New Workspace 3' }, page); @@ -67,14 +67,14 @@ test('create multi workspace in the workspace list', async ({ page }) => { await page.reload(); await openWorkspaceListModal(page); await page.getByTestId('draggable-item').nth(1).click(); - await page.waitForTimeout(50); + await page.waitForTimeout(500); // @ts-expect-error const currentId: string = await page.evaluate(() => currentWorkspace.id); await openWorkspaceListModal(page); - const sourceElement = await page.getByTestId('draggable-item').nth(2); - const targetElement = await page.getByTestId('draggable-item').nth(1); + const sourceElement = page.getByTestId('draggable-item').nth(2); + const targetElement = page.getByTestId('draggable-item').nth(1); const sourceBox = await sourceElement.boundingBox(); const targetBox = await targetElement.boundingBox(); @@ -99,7 +99,7 @@ test('create multi workspace in the workspace list', async ({ page }) => { } ); await page.mouse.up(); - await page.waitForTimeout(50); + await page.waitForTimeout(100); await page.reload(); await openWorkspaceListModal(page); @@ -110,6 +110,7 @@ test('create multi workspace in the workspace list', async ({ page }) => { } await page.getByTestId('draggable-item').nth(2).click(); + await page.waitForTimeout(100); // @ts-expect-error const nextId: string = await page.evaluate(() => currentWorkspace.id); diff --git a/tests/parallels/local-first-workspace.spec.ts b/tests/parallels/local-first-workspace.spec.ts index c9a36bf67e..921e6bb7cc 100644 --- a/tests/parallels/local-first-workspace.spec.ts +++ b/tests/parallels/local-first-workspace.spec.ts @@ -2,12 +2,12 @@ import { test } from '@affine-test/kit/playwright'; import { expect } from '@playwright/test'; import { openHomePage } from '../libs/load-page'; -import { waitMarkdownImported } from '../libs/page-logic'; +import { waitEditorLoad } from '../libs/page-logic'; import { assertCurrentWorkspaceFlavour } from '../libs/workspace'; test('preset workspace name', async ({ page }) => { await openHomePage(page); - await waitMarkdownImported(page); + await waitEditorLoad(page); const workspaceName = page.getByTestId('workspace-name'); await page.waitForTimeout(1000); expect(await workspaceName.textContent()).toBe('Demo Workspace'); @@ -22,7 +22,7 @@ test('preset workspace name', async ({ page }) => { // }); test('Open language switch menu', async ({ page }) => { await openHomePage(page); - await waitMarkdownImported(page); + await waitEditorLoad(page); const editorOptionMenuButton = page.getByTestId('editor-option-menu'); await expect(editorOptionMenuButton).toBeVisible(); await editorOptionMenuButton.click(); diff --git a/tests/parallels/open-affine.spec.ts b/tests/parallels/open-affine.spec.ts index 5721a9c16f..d2cacd16a2 100644 --- a/tests/parallels/open-affine.spec.ts +++ b/tests/parallels/open-affine.spec.ts @@ -2,14 +2,14 @@ import { test } from '@affine-test/kit/playwright'; import { expect } from '@playwright/test'; import { openHomePage } from '../libs/load-page'; -import { waitMarkdownImported } from '../libs/page-logic'; +import { waitEditorLoad } from '../libs/page-logic'; import { createWorkspace } from '../libs/workspace'; test('Open last workspace when back to affine', async ({ page }) => { await openHomePage(page); - await waitMarkdownImported(page); + await waitEditorLoad(page); await createWorkspace({ name: 'New Workspace 2' }, page); - await waitMarkdownImported(page); + await waitEditorLoad(page); // show workspace list await page.getByTestId('workspace-name').click(); @@ -19,7 +19,7 @@ test('Open last workspace when back to affine', async ({ page }) => { await workspaceCards[1].click(); await openHomePage(page); - const workspaceNameDom = await page.getByTestId('workspace-name'); + const workspaceNameDom = page.getByTestId('workspace-name'); const currentWorkspaceName = await workspaceNameDom.evaluate( node => node.textContent ); diff --git a/tests/parallels/quick-search.spec.ts b/tests/parallels/quick-search.spec.ts index 56b30481e2..39aa8ccd79 100644 --- a/tests/parallels/quick-search.spec.ts +++ b/tests/parallels/quick-search.spec.ts @@ -3,7 +3,7 @@ import { expect, type Page } from '@playwright/test'; import { withCtrlOrMeta } from '../libs/keyboard'; import { openHomePage } from '../libs/load-page'; -import { newPage, waitMarkdownImported } from '../libs/page-logic'; +import { newPage, waitEditorLoad } from '../libs/page-logic'; const openQuickSearchByShortcut = async (page: Page) => await withCtrlOrMeta(page, () => page.keyboard.press('k', { delay: 50 })); @@ -33,7 +33,7 @@ async function titleIsFocused(page: Page) { test('Click slider bar button', async ({ page }) => { await openHomePage(page); - await waitMarkdownImported(page); + await waitEditorLoad(page); await newPage(page); const quickSearchButton = page.locator( '[data-testid=slider-bar-quick-search-button]' @@ -45,7 +45,7 @@ test('Click slider bar button', async ({ page }) => { test('Click arrowDown icon after title', async ({ page }) => { await openHomePage(page); - await waitMarkdownImported(page); + await waitEditorLoad(page); await newPage(page); const quickSearchButton = page.locator( '[data-testid=slider-bar-quick-search-button]' @@ -57,7 +57,7 @@ test('Click arrowDown icon after title', async ({ page }) => { test('Press the shortcut key cmd+k', async ({ page }) => { await openHomePage(page); - await waitMarkdownImported(page); + await waitEditorLoad(page); await newPage(page); await openQuickSearchByShortcut(page); const quickSearch = page.locator('[data-testid=quickSearch]'); @@ -66,7 +66,7 @@ test('Press the shortcut key cmd+k', async ({ page }) => { test('Create a new page without keyword', async ({ page }) => { await openHomePage(page); - await waitMarkdownImported(page); + await waitEditorLoad(page); await newPage(page); await openQuickSearchByShortcut(page); const addNewPage = page.locator('[data-testid=quick-search-add-new-page]'); @@ -77,7 +77,7 @@ test('Create a new page without keyword', async ({ page }) => { test('Create a new page with keyword', async ({ page }) => { await openHomePage(page); - await waitMarkdownImported(page); + await waitEditorLoad(page); await newPage(page); await openQuickSearchByShortcut(page); await page.keyboard.insertText('test123456'); @@ -89,7 +89,7 @@ test('Create a new page with keyword', async ({ page }) => { test('Enter a keyword to search for', async ({ page }) => { await openHomePage(page); - await waitMarkdownImported(page); + await waitEditorLoad(page); await newPage(page); await openQuickSearchByShortcut(page); await page.keyboard.insertText('test123456'); @@ -99,7 +99,7 @@ test('Enter a keyword to search for', async ({ page }) => { test('Create a new page and search this page', async ({ page }) => { await openHomePage(page); - await waitMarkdownImported(page); + await waitEditorLoad(page); await newPage(page); await openQuickSearchByShortcut(page); // input title and create new page @@ -131,7 +131,7 @@ test('Navigate to the 404 page and try to open quick search', async ({ test('Open quick search on local page', async ({ page }) => { await openHomePage(page); - await waitMarkdownImported(page); + await waitEditorLoad(page); await newPage(page); await openQuickSearchByShortcut(page); const publishedSearchResults = page.locator('[publishedSearchResults]'); @@ -140,7 +140,7 @@ test('Open quick search on local page', async ({ page }) => { test('Autofocus input after opening quick search', async ({ page }) => { await openHomePage(page); - await waitMarkdownImported(page); + await waitEditorLoad(page); await newPage(page); await openQuickSearchByShortcut(page); const locator = page.locator('[cmdk-input]'); @@ -149,7 +149,7 @@ test('Autofocus input after opening quick search', async ({ page }) => { }); test('Autofocus input after select', async ({ page }) => { await openHomePage(page); - await waitMarkdownImported(page); + await waitEditorLoad(page); await newPage(page); await openQuickSearchByShortcut(page); await page.keyboard.press('ArrowUp'); @@ -159,7 +159,7 @@ test('Autofocus input after select', async ({ page }) => { }); test('Focus title after creating a new page', async ({ page }) => { await openHomePage(page); - await waitMarkdownImported(page); + await waitEditorLoad(page); await newPage(page); await openQuickSearchByShortcut(page); const addNewPage = page.locator('[data-testid=quick-search-add-new-page]'); @@ -171,7 +171,7 @@ test('Not show navigation path if page is not a subpage or current page is not i page, }) => { await openHomePage(page); - await waitMarkdownImported(page); + await waitEditorLoad(page); await openQuickSearchByShortcut(page); expect(await page.getByTestId('navigation-path').count()).toBe(0); }); diff --git a/tests/parallels/router.spec.ts b/tests/parallels/router.spec.ts index 5d66b4aea4..be0d6533db 100644 --- a/tests/parallels/router.spec.ts +++ b/tests/parallels/router.spec.ts @@ -2,11 +2,11 @@ import { test } from '@affine-test/kit/playwright'; import { expect } from '@playwright/test'; import { openHomePage, webUrl } from '../libs/load-page'; -import { waitMarkdownImported } from '../libs/page-logic'; +import { waitEditorLoad } from '../libs/page-logic'; test('goto not found page', async ({ page }) => { await openHomePage(page); - await waitMarkdownImported(page); + await waitEditorLoad(page); const currentUrl = page.url(); const invalidUrl = currentUrl.replace(/\/$/, '') + '/invalid'; await page.goto(invalidUrl); @@ -15,9 +15,9 @@ test('goto not found page', async ({ page }) => { test('goto not found workspace', async ({ page }) => { await openHomePage(page); - await waitMarkdownImported(page); + await waitEditorLoad(page); const currentUrl = page.url(); await page.goto(new URL('/workspace/invalid/all', webUrl).toString()); - await page.waitForSelector('v-line'); + await waitEditorLoad(page); expect(page.url()).toEqual(currentUrl); }); diff --git a/tests/parallels/shortcuts.spec.ts b/tests/parallels/shortcuts.spec.ts index f2263ad427..61d6b7dba0 100644 --- a/tests/parallels/shortcuts.spec.ts +++ b/tests/parallels/shortcuts.spec.ts @@ -2,11 +2,11 @@ import { test } from '@affine-test/kit/playwright'; import { expect } from '@playwright/test'; import { openHomePage } from '../libs/load-page'; -import { waitMarkdownImported } from '../libs/page-logic'; +import { waitEditorLoad } from '../libs/page-logic'; test('Open shortcuts modal', async ({ page }) => { await openHomePage(page); - await waitMarkdownImported(page); + await waitEditorLoad(page); await page.locator('[data-testid=help-island]').click(); const shortcutsIcon = page.locator('[data-testid=shortcuts-icon]'); diff --git a/tests/parallels/subpage.spec.ts b/tests/parallels/subpage.spec.ts index 29bcd2d8ab..12fe5991c7 100644 --- a/tests/parallels/subpage.spec.ts +++ b/tests/parallels/subpage.spec.ts @@ -2,11 +2,11 @@ import { test } from '@affine-test/kit/playwright'; import { expect } from '@playwright/test'; import { openHomePage } from '../libs/load-page'; -import { waitMarkdownImported } from '../libs/page-logic'; +import { waitEditorLoad } from '../libs/page-logic'; test('Create subpage', async ({ page }) => { await openHomePage(page); - await waitMarkdownImported(page); + await waitEditorLoad(page); await page.getByTestId('app-sidebar-arrow-button-collapse').click(); const sliderBarArea = page.getByTestId('sliderBar-inner'); await expect(sliderBarArea).not.toBeInViewport(); diff --git a/tests/parallels/theme.spec.ts b/tests/parallels/theme.spec.ts index c93edd89d5..c0d346f23f 100644 --- a/tests/parallels/theme.spec.ts +++ b/tests/parallels/theme.spec.ts @@ -4,7 +4,7 @@ import { test, testResultDir } from '@affine-test/kit/playwright'; import { expect } from '@playwright/test'; import { openHomePage } from '../libs/load-page'; -import { waitMarkdownImported } from '../libs/page-logic'; +import { waitEditorLoad } from '../libs/page-logic'; // default could be anything, according to the system test('default white', async ({ browser }) => { @@ -13,7 +13,7 @@ test('default white', async ({ browser }) => { }); const page = await context.newPage(); await openHomePage(page); - await waitMarkdownImported(page); + await waitEditorLoad(page); const root = page.locator('html'); const themeMode = await root.evaluate(element => element.getAttribute('data-theme') diff --git a/tsconfig.json b/tsconfig.json index 77330656b6..13944954ee 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -24,7 +24,6 @@ "./packages/component/src/components/*/index", "./packages/component/src/components/*" ], - "@affine/templates/*": ["./packages/templates/src/*"], "@affine/i18n": ["./packages/i18n/src"], "@affine/i18n/hooks": ["./packages/i18n/src/i18n-generated"], "@affine/debug": ["./packages/debug"], diff --git a/yarn.lock b/yarn.lock index 23ef42d0f0..6ce2387dfc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -64,12 +64,12 @@ __metadata: "@affine/i18n": "workspace:*" "@affine/jotai": "workspace:*" "@affine/workspace": "workspace:*" - "@blocksuite/blocks": 0.0.0-20230601122821-16196c35-nightly - "@blocksuite/editor": 0.0.0-20230601122821-16196c35-nightly - "@blocksuite/global": 0.0.0-20230601122821-16196c35-nightly + "@blocksuite/blocks": 0.0.0-20230606130340-805f430b-nightly + "@blocksuite/editor": 0.0.0-20230606130340-805f430b-nightly + "@blocksuite/global": 0.0.0-20230606130340-805f430b-nightly "@blocksuite/icons": ^2.1.19 - "@blocksuite/lit": 0.0.0-20230601122821-16196c35-nightly - "@blocksuite/store": 0.0.0-20230601122821-16196c35-nightly + "@blocksuite/lit": 0.0.0-20230606130340-805f430b-nightly + "@blocksuite/store": 0.0.0-20230606130340-805f430b-nightly "@dnd-kit/core": ^6.0.8 "@dnd-kit/sortable": ^7.0.2 "@emotion/cache": ^11.11.0 @@ -189,7 +189,7 @@ __metadata: resolution: "@affine/env@workspace:packages/env" dependencies: "@affine/templates": "workspace:*" - "@blocksuite/global": 0.0.0-20230601122821-16196c35-nightly + "@blocksuite/global": 0.0.0-20230606130340-805f430b-nightly lit: ^2.7.5 next: =13.4.2 react: 18.3.0-canary-16d053d59-20230506 @@ -235,11 +235,11 @@ __metadata: resolution: "@affine/jotai@workspace:packages/jotai" dependencies: "@affine/env": "workspace:*" - "@blocksuite/blocks": 0.0.0-20230601101714-0d24ba91-nightly - "@blocksuite/editor": 0.0.0-20230601101714-0d24ba91-nightly - "@blocksuite/global": 0.0.0-20230601101714-0d24ba91-nightly - "@blocksuite/lit": 0.0.0-20230601101714-0d24ba91-nightly - "@blocksuite/store": 0.0.0-20230601101714-0d24ba91-nightly + "@blocksuite/blocks": 0.0.0-20230606130340-805f430b-nightly + "@blocksuite/editor": 0.0.0-20230606130340-805f430b-nightly + "@blocksuite/global": 0.0.0-20230606130340-805f430b-nightly + "@blocksuite/lit": 0.0.0-20230606130340-805f430b-nightly + "@blocksuite/store": 0.0.0-20230606130340-805f430b-nightly jotai: ^2.1.1 lottie-web: ^5.12.0 peerDependencies: @@ -368,12 +368,12 @@ __metadata: "@affine/jotai": "workspace:*" "@affine/templates": "workspace:*" "@affine/workspace": "workspace:*" - "@blocksuite/blocks": 0.0.0-20230601101714-0d24ba91-nightly - "@blocksuite/editor": 0.0.0-20230601101714-0d24ba91-nightly - "@blocksuite/global": 0.0.0-20230601101714-0d24ba91-nightly + "@blocksuite/blocks": 0.0.0-20230606130340-805f430b-nightly + "@blocksuite/editor": 0.0.0-20230606130340-805f430b-nightly + "@blocksuite/global": 0.0.0-20230606130340-805f430b-nightly "@blocksuite/icons": ^2.1.19 - "@blocksuite/lit": 0.0.0-20230601101714-0d24ba91-nightly - "@blocksuite/store": 0.0.0-20230601101714-0d24ba91-nightly + "@blocksuite/lit": 0.0.0-20230606130340-805f430b-nightly + "@blocksuite/store": 0.0.0-20230606130340-805f430b-nightly "@dnd-kit/core": ^6.0.8 "@dnd-kit/sortable": ^7.0.2 "@emotion/cache": ^11.11.0 @@ -2616,31 +2616,6 @@ __metadata: languageName: node linkType: hard -"@blocksuite/blocks@npm:0.0.0-20230601101714-0d24ba91-nightly": - version: 0.0.0-20230601101714-0d24ba91-nightly - resolution: "@blocksuite/blocks@npm:0.0.0-20230601101714-0d24ba91-nightly" - dependencies: - "@blocksuite/connector": 0.0.0-20230601101714-0d24ba91-nightly - "@blocksuite/global": 0.0.0-20230601101714-0d24ba91-nightly - "@blocksuite/phasor": 0.0.0-20230601101714-0d24ba91-nightly - "@blocksuite/virgo": 0.0.0-20230601101714-0d24ba91-nightly - "@popperjs/core": ^2.11.6 - hotkeys-js: ^3.10.1 - html-to-image: ^1.11.11 - jszip: ^3.10.1 - lit: ^2.7.3 - marked: ^4.2.12 - shiki: ^0.14.1 - turndown: ^7.1.1 - zod: ^3.21.4 - peerDependencies: - "@blocksuite/lit": 0.0.0-20230601101714-0d24ba91-nightly - "@blocksuite/store": 0.0.0-20230601101714-0d24ba91-nightly - yjs: ^13 - checksum: 4fe75d7ec883cc646229453fd4a2a0faf4ce79b1ba741ef5ba392083b7e2cfaa4c2ef2dbdfcc441c7d7e096459119a1e5402eaf51b047e6ff7bf37abc5a87232 - languageName: node - linkType: hard - "@blocksuite/blocks@npm:0.0.0-20230601122821-16196c35-nightly": version: 0.0.0-20230601122821-16196c35-nightly resolution: "@blocksuite/blocks@npm:0.0.0-20230601122821-16196c35-nightly" @@ -2666,10 +2641,28 @@ __metadata: languageName: node linkType: hard -"@blocksuite/connector@npm:0.0.0-20230601101714-0d24ba91-nightly": - version: 0.0.0-20230601101714-0d24ba91-nightly - resolution: "@blocksuite/connector@npm:0.0.0-20230601101714-0d24ba91-nightly" - checksum: 277b76c713286c264855bf13138462c5dd0533631c1985a2bb87e8c4a3ca05a27313b41598cc905ed73ea600fa6d6a52462df0cdc17e250e07bdfa74606c9e38 +"@blocksuite/blocks@npm:0.0.0-20230606130340-805f430b-nightly": + version: 0.0.0-20230606130340-805f430b-nightly + resolution: "@blocksuite/blocks@npm:0.0.0-20230606130340-805f430b-nightly" + dependencies: + "@blocksuite/connector": 0.0.0-20230606130340-805f430b-nightly + "@blocksuite/global": 0.0.0-20230606130340-805f430b-nightly + "@blocksuite/phasor": 0.0.0-20230606130340-805f430b-nightly + "@blocksuite/virgo": 0.0.0-20230606130340-805f430b-nightly + "@popperjs/core": ^2.11.6 + hotkeys-js: ^3.10.1 + html-to-image: ^1.11.11 + jszip: ^3.10.1 + lit: ^2.7.3 + marked: ^4.2.12 + shiki: ^0.14.1 + turndown: ^7.1.1 + zod: ^3.21.4 + peerDependencies: + "@blocksuite/lit": 0.0.0-20230606130340-805f430b-nightly + "@blocksuite/store": 0.0.0-20230606130340-805f430b-nightly + yjs: ^13 + checksum: 6ca7304b5b7c400a7263d81976cf170d7e0cc774596dedd21e6db86b04722c91d52bc97cb6fe37854f3d6c2467019a8bd1638ddebc84f8f5d81e1b4cc0b3412c languageName: node linkType: hard @@ -2680,20 +2673,10 @@ __metadata: languageName: node linkType: hard -"@blocksuite/editor@npm:0.0.0-20230601101714-0d24ba91-nightly": - version: 0.0.0-20230601101714-0d24ba91-nightly - resolution: "@blocksuite/editor@npm:0.0.0-20230601101714-0d24ba91-nightly" - dependencies: - "@blocksuite/global": 0.0.0-20230601101714-0d24ba91-nightly - "@toeverything/theme": 0.0.0-20230530064828-8cd3bf6 - lit: ^2.7.3 - marked: ^4.2.12 - turndown: ^7.1.1 - peerDependencies: - "@blocksuite/blocks": 0.0.0-20230601101714-0d24ba91-nightly - "@blocksuite/lit": 0.0.0-20230601101714-0d24ba91-nightly - "@blocksuite/store": 0.0.0-20230601101714-0d24ba91-nightly - checksum: ef86f19cd7ddd33db021c8322f469cca01687092627fb0696a538850849a04c9cfba93ccd82eaf5b07db44c02f3a9eb17602896ea0682d256aad4b9f326be5ab +"@blocksuite/connector@npm:0.0.0-20230606130340-805f430b-nightly": + version: 0.0.0-20230606130340-805f430b-nightly + resolution: "@blocksuite/connector@npm:0.0.0-20230606130340-805f430b-nightly" + checksum: 704695aff71d307e4a1c8ca4df0c4e91f0b6bb3bfe080e192469ed8f3a6ac22c7fb2987331ec444ceaf3a3dd0bca48d515a2d0ec5b6c2e3670033d8c2c07fa06 languageName: node linkType: hard @@ -2714,18 +2697,20 @@ __metadata: languageName: node linkType: hard -"@blocksuite/global@npm:0.0.0-20230601101714-0d24ba91-nightly": - version: 0.0.0-20230601101714-0d24ba91-nightly - resolution: "@blocksuite/global@npm:0.0.0-20230601101714-0d24ba91-nightly" +"@blocksuite/editor@npm:0.0.0-20230606130340-805f430b-nightly": + version: 0.0.0-20230606130340-805f430b-nightly + resolution: "@blocksuite/editor@npm:0.0.0-20230606130340-805f430b-nightly" dependencies: - ansi-colors: ^4.1.3 - zod: ^3.21.4 + "@blocksuite/global": 0.0.0-20230606130340-805f430b-nightly + "@toeverything/theme": 0.0.0-20230530064828-8cd3bf6 + lit: ^2.7.3 + marked: ^4.2.12 + turndown: ^7.1.1 peerDependencies: - lit: ^2.7 - peerDependenciesMeta: - lit: - optional: true - checksum: f6f4ff778293ea02cb553544c0445c46d09b4483d698aafed59aea1c4da76747d9241c7793a88458da1d189196c9b07ade6b6fbdfd1706d63afc8d5797b3f32b + "@blocksuite/blocks": 0.0.0-20230606130340-805f430b-nightly + "@blocksuite/lit": 0.0.0-20230606130340-805f430b-nightly + "@blocksuite/store": 0.0.0-20230606130340-805f430b-nightly + checksum: f506a2b932b88d8115303efd598a35cef5375910a462e550c1b4754ebadef22cb54c6165e9e756cdc3055290a5f2aeb55226fc5372c7f6fa737614e3f6704239 languageName: node linkType: hard @@ -2744,6 +2729,21 @@ __metadata: languageName: node linkType: hard +"@blocksuite/global@npm:0.0.0-20230606130340-805f430b-nightly": + version: 0.0.0-20230606130340-805f430b-nightly + resolution: "@blocksuite/global@npm:0.0.0-20230606130340-805f430b-nightly" + dependencies: + ansi-colors: ^4.1.3 + zod: ^3.21.4 + peerDependencies: + lit: ^2.7 + peerDependenciesMeta: + lit: + optional: true + checksum: f8da51eb3916d734b8a01906ecb06d1b1383517d8e33662f6f40721ce3f6ab37576e85603b621bdbd17a492fcb22a7ddcd76cb9fbcf384c02cbff0484394fb45 + languageName: node + linkType: hard + "@blocksuite/icons@npm:^2.1.19": version: 2.1.19 resolution: "@blocksuite/icons@npm:2.1.19" @@ -2754,18 +2754,6 @@ __metadata: languageName: node linkType: hard -"@blocksuite/lit@npm:0.0.0-20230601101714-0d24ba91-nightly": - version: 0.0.0-20230601101714-0d24ba91-nightly - resolution: "@blocksuite/lit@npm:0.0.0-20230601101714-0d24ba91-nightly" - dependencies: - "@blocksuite/global": 0.0.0-20230601101714-0d24ba91-nightly - lit: ^2.7.3 - peerDependencies: - "@blocksuite/store": 0.0.0-20230601101714-0d24ba91-nightly - checksum: 7c40b45b159901fc6a0ed77ced7cc7636b29b0c72d13ef0950ac40f83841a2ddc81b02916b313ca8673e835f54a21781f2789befc15679ebf2289c9a1e76a77a - languageName: node - linkType: hard - "@blocksuite/lit@npm:0.0.0-20230601122821-16196c35-nightly": version: 0.0.0-20230601122821-16196c35-nightly resolution: "@blocksuite/lit@npm:0.0.0-20230601122821-16196c35-nightly" @@ -2778,17 +2766,15 @@ __metadata: languageName: node linkType: hard -"@blocksuite/phasor@npm:0.0.0-20230601101714-0d24ba91-nightly": - version: 0.0.0-20230601101714-0d24ba91-nightly - resolution: "@blocksuite/phasor@npm:0.0.0-20230601101714-0d24ba91-nightly" +"@blocksuite/lit@npm:0.0.0-20230606130340-805f430b-nightly": + version: 0.0.0-20230606130340-805f430b-nightly + resolution: "@blocksuite/lit@npm:0.0.0-20230606130340-805f430b-nightly" dependencies: - "@blocksuite/global": 0.0.0-20230601101714-0d24ba91-nightly - fractional-indexing: ^3.2.0 - roughjs: ^4.5.2 + "@blocksuite/global": 0.0.0-20230606130340-805f430b-nightly + lit: ^2.7.3 peerDependencies: - nanoid: ^4 - yjs: ^13 - checksum: bfda9f99c8a6070f59a961235ca645640eaefaf208228c975d2a0fe8525178dc7baa69693bce9fb37406c9ccbca2e3721820d923f813c8f94875adc7aad33e7f + "@blocksuite/store": 0.0.0-20230606130340-805f430b-nightly + checksum: 167c53dca2e00b8f091f47830000983f0fd8cae5af941c938735446490f0e7b9759e7366be84c6f5ccd502029caaad555b5af705338981ec93fc874e4da3b0dc languageName: node linkType: hard @@ -2806,27 +2792,17 @@ __metadata: languageName: node linkType: hard -"@blocksuite/store@npm:0.0.0-20230601101714-0d24ba91-nightly": - version: 0.0.0-20230601101714-0d24ba91-nightly - resolution: "@blocksuite/store@npm:0.0.0-20230601101714-0d24ba91-nightly" +"@blocksuite/phasor@npm:0.0.0-20230606130340-805f430b-nightly": + version: 0.0.0-20230606130340-805f430b-nightly + resolution: "@blocksuite/phasor@npm:0.0.0-20230606130340-805f430b-nightly" dependencies: - "@blocksuite/global": 0.0.0-20230601101714-0d24ba91-nightly - "@blocksuite/virgo": 0.0.0-20230601101714-0d24ba91-nightly - "@types/flexsearch": ^0.7.3 - buffer: ^6.0.3 - flexsearch: 0.7.21 - idb-keyval: ^6.2.0 - ky: ^0.33.3 - lib0: ^0.2.74 - merge: ^2.1.1 - minimatch: ^9.0.0 - nanoid: ^4.0.1 - y-protocols: ^1.0.5 - y-webrtc: ^10.2.5 - zod: ^3.21.4 + "@blocksuite/global": 0.0.0-20230606130340-805f430b-nightly + fractional-indexing: ^3.2.0 + roughjs: ^4.5.2 peerDependencies: + nanoid: ^4 yjs: ^13 - checksum: 8375f3924f4bd2a2ee59c461d2dcc3b543da322182a01450699d62e19a244f277a67e523019bdc450fae436bd32493f5524d4d95d3a8ffc2376d42d39c5cf47f + checksum: c4280e5aaec0b5f94728717c4c857bf14184c9f575bb78a56dbd18ed4b83a33c6d9b76f1513a740dd4d3188c7bfad3fdc286ff7192f81be750dc14bfdba02657 languageName: node linkType: hard @@ -2854,16 +2830,27 @@ __metadata: languageName: node linkType: hard -"@blocksuite/virgo@npm:0.0.0-20230601101714-0d24ba91-nightly": - version: 0.0.0-20230601101714-0d24ba91-nightly - resolution: "@blocksuite/virgo@npm:0.0.0-20230601101714-0d24ba91-nightly" +"@blocksuite/store@npm:0.0.0-20230606130340-805f430b-nightly": + version: 0.0.0-20230606130340-805f430b-nightly + resolution: "@blocksuite/store@npm:0.0.0-20230606130340-805f430b-nightly" dependencies: - "@blocksuite/global": 0.0.0-20230601101714-0d24ba91-nightly + "@blocksuite/global": 0.0.0-20230606130340-805f430b-nightly + "@blocksuite/virgo": 0.0.0-20230606130340-805f430b-nightly + "@types/flexsearch": ^0.7.3 + buffer: ^6.0.3 + flexsearch: 0.7.21 + idb-keyval: ^6.2.0 + ky: ^0.33.3 + lib0: ^0.2.74 + merge: ^2.1.1 + minimatch: ^9.0.0 + nanoid: ^4.0.1 + y-protocols: ^1.0.5 + y-webrtc: ^10.2.5 zod: ^3.21.4 peerDependencies: - lit: ^2.7 yjs: ^13 - checksum: 4751fc567378360043e7bb80a1f1ddce69cf9d426f42237eeca3cd2aeaef48289e921548e60ce5c4090ad844a51917e23b7e7b5de1925cb8c15e19695f0f5436 + checksum: 2a7dd01b8e0793242fdac06c95d3982a7270296f6f03fce00d3e86f6a312ce583d20eff632312a05cd7749d18e947f184967a075c97384af5c3354430c1c4d7e languageName: node linkType: hard @@ -2880,6 +2867,19 @@ __metadata: languageName: node linkType: hard +"@blocksuite/virgo@npm:0.0.0-20230606130340-805f430b-nightly": + version: 0.0.0-20230606130340-805f430b-nightly + resolution: "@blocksuite/virgo@npm:0.0.0-20230606130340-805f430b-nightly" + dependencies: + "@blocksuite/global": 0.0.0-20230606130340-805f430b-nightly + zod: ^3.21.4 + peerDependencies: + lit: ^2.7 + yjs: ^13 + checksum: 64efd21739f63f39dee9f7017c25845b19f3e5df41b6bf2d29e55584cb5f03ac66f8f78ddc82b72578bc63088f3a6103f510c45758bfa9cd6e819f92f886e377 + languageName: node + linkType: hard + "@clack/core@npm:^0.3.2": version: 0.3.2 resolution: "@clack/core@npm:0.3.2" @@ -9212,11 +9212,11 @@ __metadata: "@affine/component": "workspace:*" "@affine/env": "workspace:*" "@affine/workspace": "workspace:*" - "@blocksuite/blocks": 0.0.0-20230601101714-0d24ba91-nightly - "@blocksuite/editor": 0.0.0-20230601101714-0d24ba91-nightly - "@blocksuite/global": 0.0.0-20230601101714-0d24ba91-nightly - "@blocksuite/lit": 0.0.0-20230601101714-0d24ba91-nightly - "@blocksuite/store": 0.0.0-20230601101714-0d24ba91-nightly + "@blocksuite/blocks": 0.0.0-20230606130340-805f430b-nightly + "@blocksuite/editor": 0.0.0-20230606130340-805f430b-nightly + "@blocksuite/global": 0.0.0-20230606130340-805f430b-nightly + "@blocksuite/lit": 0.0.0-20230606130340-805f430b-nightly + "@blocksuite/store": 0.0.0-20230606130340-805f430b-nightly jotai: ^2.1.1 peerDependencies: "@blocksuite/blocks": "*" @@ -9248,8 +9248,8 @@ __metadata: version: 0.0.0-use.local resolution: "@toeverything/y-indexeddb@workspace:packages/y-indexeddb" dependencies: - "@blocksuite/blocks": 0.0.0-20230601101714-0d24ba91-nightly - "@blocksuite/store": 0.0.0-20230601101714-0d24ba91-nightly + "@blocksuite/blocks": 0.0.0-20230606130340-805f430b-nightly + "@blocksuite/store": 0.0.0-20230606130340-805f430b-nightly idb: ^7.1.1 vite: ^4.3.9 vite-plugin-dts: ^2.3.0