feat: add preloading template

This commit is contained in:
Flrande
2023-06-07 17:31:54 +08:00
committed by himself65
parent ead106b940
commit e6cd2ace7d
67 changed files with 6732 additions and 385 deletions

View File

@@ -19,12 +19,12 @@
"@affine/jotai": "workspace:*", "@affine/jotai": "workspace:*",
"@affine/templates": "workspace:*", "@affine/templates": "workspace:*",
"@affine/workspace": "workspace:*", "@affine/workspace": "workspace:*",
"@blocksuite/blocks": "0.0.0-20230601101714-0d24ba91-nightly", "@blocksuite/blocks": "0.0.0-20230606130340-805f430b-nightly",
"@blocksuite/editor": "0.0.0-20230601101714-0d24ba91-nightly", "@blocksuite/editor": "0.0.0-20230606130340-805f430b-nightly",
"@blocksuite/global": "0.0.0-20230601101714-0d24ba91-nightly", "@blocksuite/global": "0.0.0-20230606130340-805f430b-nightly",
"@blocksuite/icons": "^2.1.19", "@blocksuite/icons": "^2.1.19",
"@blocksuite/lit": "0.0.0-20230601101714-0d24ba91-nightly", "@blocksuite/lit": "0.0.0-20230606130340-805f430b-nightly",
"@blocksuite/store": "0.0.0-20230601101714-0d24ba91-nightly", "@blocksuite/store": "0.0.0-20230606130340-805f430b-nightly",
"@dnd-kit/core": "^6.0.8", "@dnd-kit/core": "^6.0.8",
"@dnd-kit/sortable": "^7.0.2", "@dnd-kit/sortable": "^7.0.2",
"@emotion/cache": "^11.11.0", "@emotion/cache": "^11.11.0",

View File

@@ -41,4 +41,8 @@ export const buildFlags = {
), ),
changelogUrl: changelogUrl:
process.env.CHANGELOG_URL ?? 'http://affine.pro/blog/whats-new-affine-0601', process.env.CHANGELOG_URL ?? 'http://affine.pro/blog/whats-new-affine-0601',
enablePreloading:
process.env.ENABLE_PRELOADING === undefined
? true
: process.env.ENABLE_PRELOADING === 'true',
}; };

View File

@@ -3,7 +3,7 @@
* please use new affine cloud instead. * please use new affine cloud instead.
*/ */
import { AFFINE_STORAGE_KEY, config } from '@affine/env'; 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 { PageNotFoundError } from '@affine/env/constant';
import { currentAffineUserAtom } from '@affine/workspace/affine/atom'; import { currentAffineUserAtom } from '@affine/workspace/affine/atom';
import { import {
@@ -330,7 +330,7 @@ export const AffineAdapter: WorkspaceAdapter<WorkspaceFlavour.AFFINE> = {
<PageDetailEditor <PageDetailEditor
pageId={currentPageId} pageId={currentPageId}
workspace={currentWorkspace} workspace={currentWorkspace}
onInit={initPage} onInit={initEmptyPage}
onLoad={onLoadEditor} onLoad={onLoadEditor}
/> />
</> </>

View File

@@ -1,9 +1,10 @@
import { DebugLogger } from '@affine/debug'; import { DebugLogger } from '@affine/debug';
import { import {
config,
DEFAULT_HELLO_WORLD_PAGE_ID, DEFAULT_HELLO_WORLD_PAGE_ID,
DEFAULT_WORKSPACE_NAME, DEFAULT_WORKSPACE_NAME,
} from '@affine/env'; } from '@affine/env';
import { initPage } from '@affine/env/blocksuite'; import { initEmptyPage, initPageWithPreloading } from '@affine/env/blocksuite';
import { PageNotFoundError } from '@affine/env/constant'; import { PageNotFoundError } from '@affine/env/constant';
import { import {
CRUD, CRUD,
@@ -17,8 +18,8 @@ import {
} from '@affine/workspace/type'; } from '@affine/workspace/type';
import { createEmptyBlockSuiteWorkspace } from '@affine/workspace/utils'; import { createEmptyBlockSuiteWorkspace } from '@affine/workspace/utils';
import { nanoid } from '@blocksuite/store'; import { nanoid } from '@blocksuite/store';
import React from 'react';
import { setEditorFlags } from '../../utils/editor-flag';
import { import {
BlockSuitePageList, BlockSuitePageList,
PageDetailEditor, PageDetailEditor,
@@ -43,10 +44,12 @@ export const LocalAdapter: WorkspaceAdapter<WorkspaceFlavour.LOCAL> = {
const page = blockSuiteWorkspace.createPage({ const page = blockSuiteWorkspace.createPage({
id: DEFAULT_HELLO_WORLD_PAGE_ID, id: DEFAULT_HELLO_WORLD_PAGE_ID,
}); });
blockSuiteWorkspace.setPageMeta(page.id, { setEditorFlags(blockSuiteWorkspace);
init: true, if (config.enablePreloading) {
}); initPageWithPreloading(page);
initPage(page); } else {
initEmptyPage(page);
}
blockSuiteWorkspace.setPageMeta(page.id, { blockSuiteWorkspace.setPageMeta(page.id, {
jumpOnce: true, jumpOnce: true,
}); });
@@ -78,7 +81,7 @@ export const LocalAdapter: WorkspaceAdapter<WorkspaceFlavour.LOCAL> = {
<> <>
<PageDetailEditor <PageDetailEditor
pageId={currentPageId} pageId={currentPageId}
onInit={initPage} onInit={initEmptyPage}
onLoad={onLoadEditor} onLoad={onLoadEditor}
workspace={currentWorkspace} workspace={currentWorkspace}
/> />

View File

@@ -3,7 +3,7 @@
*/ */
import 'fake-indexeddb/auto'; import 'fake-indexeddb/auto';
import { initPage } from '@affine/env/blocksuite'; import { initEmptyPage } from '@affine/env/blocksuite';
import { import {
rootCurrentWorkspaceIdAtom, rootCurrentWorkspaceIdAtom,
rootWorkspacesMetadataAtom, rootWorkspacesMetadataAtom,
@@ -32,7 +32,7 @@ describe('currentWorkspace atom', () => {
WorkspaceFlavour.LOCAL WorkspaceFlavour.LOCAL
); );
const page = workspace.createPage({ id: 'page0' }); const page = workspace.createPage({ id: 'page0' });
initPage(page); initEmptyPage(page);
const frameId = page.getBlockByFlavour('affine:frame').at(0) const frameId = page.getBlockByFlavour('affine:frame').at(0)
?.id as string; ?.id as string;
id = page.addBlock( id = page.addBlock(

View File

@@ -1,10 +1,11 @@
import { initEmptyPage } from '@affine/env/blocksuite';
import { WorkspaceFlavour } from '@affine/workspace/type'; import { WorkspaceFlavour } from '@affine/workspace/type';
import { createEmptyBlockSuiteWorkspace } from '@affine/workspace/utils'; import { createEmptyBlockSuiteWorkspace } from '@affine/workspace/utils';
import type { EditorContainer } from '@blocksuite/editor'; import type { EditorContainer } from '@blocksuite/editor';
import type { Page } from '@blocksuite/store'; import type { Page } from '@blocksuite/store';
import { Generator } from '@blocksuite/store'; import { Generator } from '@blocksuite/store';
import type React from 'react'; import type React from 'react';
import { useCallback, useRef } from 'react'; import { useCallback } from 'react';
import { BlockSuiteEditor } from '../../blocksuite/block-suite-editor'; import { BlockSuiteEditor } from '../../blocksuite/block-suite-editor';
@@ -18,19 +19,7 @@ const blockSuiteWorkspace = createEmptyBlockSuiteWorkspace(
const page = blockSuiteWorkspace.createPage({ id: 'page0' }); const page = blockSuiteWorkspace.createPage({ id: 'page0' });
const Editor: React.FC<{ const Editor: React.FC = () => {
onInit: (page: Page, editor: Readonly<EditorContainer>) => 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 onLoad = useCallback((page: Page, editor: EditorContainer) => { const onLoad = useCallback((page: Page, editor: EditorContainer) => {
// @ts-ignore // @ts-ignore
globalThis.page = page; globalThis.page = page;
@@ -43,7 +32,12 @@ const Editor: React.FC<{
return <>loading...</>; return <>loading...</>;
} }
return ( return (
<BlockSuiteEditor page={page} mode="page" onInit={onInit} onLoad={onLoad} /> <BlockSuiteEditor
page={page}
mode="page"
onInit={initEmptyPage}
onLoad={onLoad}
/>
); );
}; };

View File

@@ -1,4 +1,4 @@
import { initPage } from '@affine/env/blocksuite'; import { initEmptyPage } from '@affine/env/blocksuite';
import { useAFFiNEI18N } from '@affine/i18n/hooks'; import { useAFFiNEI18N } from '@affine/i18n/hooks';
import type { PageBlockModel } from '@blocksuite/blocks'; import type { PageBlockModel } from '@blocksuite/blocks';
import { PlusIcon } from '@blocksuite/icons'; import { PlusIcon } from '@blocksuite/icons';
@@ -41,7 +41,7 @@ export const Footer: React.FC<FooterProps> = ({
const id = nanoid(); const id = nanoid();
const page = createPage(id); const page = createPage(id);
assertEquals(page.id, id); assertEquals(page.id, id);
initPage(page); initEmptyPage(page);
const block = page.getBlockByFlavour( const block = page.getBlockByFlavour(
'affine:page' 'affine:page'
)[0] as PageBlockModel; )[0] as PageBlockModel;

View File

@@ -10,8 +10,8 @@ import {
WorkspaceFallback, WorkspaceFallback,
} from '@affine/component/workspace'; } from '@affine/component/workspace';
import { DebugLogger } from '@affine/debug'; import { DebugLogger } from '@affine/debug';
import { DEFAULT_HELLO_WORLD_PAGE_ID } from '@affine/env'; import { config, DEFAULT_HELLO_WORLD_PAGE_ID } from '@affine/env';
import { initPage } from '@affine/env/blocksuite'; import { initEmptyPage, initPageWithPreloading } from '@affine/env/blocksuite';
import { setUpLanguage, useI18N } from '@affine/i18n'; import { setUpLanguage, useI18N } from '@affine/i18n';
import { useAFFiNEI18N } from '@affine/i18n/hooks'; import { useAFFiNEI18N } from '@affine/i18n/hooks';
import { createAffineGlobalChannel } from '@affine/workspace/affine/sync'; import { createAffineGlobalChannel } from '@affine/workspace/affine/sync';
@@ -64,6 +64,7 @@ import {
} from '../providers/modal-provider'; } from '../providers/modal-provider';
import { pathGenerator, publicPathGenerator } from '../shared'; import { pathGenerator, publicPathGenerator } from '../shared';
import { toast } from '../utils'; import { toast } from '../utils';
import { setEditorFlags } from '../utils/editor-flag';
const QuickSearchModal = lazy(() => const QuickSearchModal = lazy(() =>
import('../components/pure/quick-search-modal').then(module => ({ import('../components/pure/quick-search-modal').then(module => ({
@@ -305,10 +306,12 @@ export const WorkspaceLayoutInner: FC<PropsWithChildren> = ({ children }) => {
id: pageId, id: pageId,
}); });
assertEquals(page.id, pageId); assertEquals(page.id, pageId);
currentWorkspace.blockSuiteWorkspace.setPageMeta(page.id, { setEditorFlags(currentWorkspace.blockSuiteWorkspace);
init: true, if (config.enablePreloading) {
}); initPageWithPreloading(page);
initPage(page); } else {
initEmptyPage(page);
}
if (!router.query.pageId) { if (!router.query.pageId) {
setCurrentPageId(pageId); setCurrentPageId(pageId);
void jumpToPage(currentWorkspace.id, pageId); void jumpToPage(currentWorkspace.id, pageId);

View File

@@ -1,5 +1,4 @@
import { AppContainer, MainContainer } from '@affine/component/workspace'; import { AppContainer, MainContainer } from '@affine/component/workspace';
import { initPage } from '@affine/env/blocksuite';
import { useRouter } from 'next/router'; import { useRouter } from 'next/router';
import { lazy, Suspense } from 'react'; import { lazy, Suspense } from 'react';
@@ -16,17 +15,12 @@ const InitPagePage: NextPageWithLayout = () => {
if (!router.isReady) { if (!router.isReady) {
return <>loading...</>; return <>loading...</>;
} }
let testType: 'empty' | 'importMarkdown' = 'empty';
if (router.query.type === 'importMarkdown') {
testType = 'importMarkdown';
} else if (router.query.type === 'empty') {
testType = 'empty';
}
return ( return (
<AppContainer> <AppContainer>
<MainContainer> <MainContainer>
<Suspense> <Suspense>
<Editor onInit={initPage} testType={testType} /> <Editor />
</Suspense> </Suspense>
<div id="toolWrapper" /> <div id="toolWrapper" />
</MainContainer> </MainContainer>

View File

@@ -1,5 +1,5 @@
import { Breadcrumbs, displayFlex, styled } from '@affine/component'; 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 { useAFFiNEI18N } from '@affine/i18n/hooks';
import { PageIcon } from '@blocksuite/icons'; import { PageIcon } from '@blocksuite/icons';
import { assertExists } from '@blocksuite/store'; import { assertExists } from '@blocksuite/store';
@@ -107,7 +107,7 @@ const PublicWorkspaceDetailPageInner = (): ReactElement => {
dispose.dispose(); dispose.dispose();
}; };
}} }}
onInit={initPage} onInit={initEmptyPage}
/> />
</> </>
); );

View File

@@ -1,6 +1,4 @@
import { PageDetailSkeleton } from '@affine/component/page-detail-skeleton'; 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 { rootCurrentPageIdAtom } from '@affine/workspace/atom';
import type { EditorContainer } from '@blocksuite/editor'; import type { EditorContainer } from '@blocksuite/editor';
import type { Page } from '@blocksuite/store'; import type { Page } from '@blocksuite/store';
@@ -9,7 +7,7 @@ import { useBlockSuiteWorkspacePage } from '@toeverything/hooks/use-block-suite-
import { useAtomValue } from 'jotai'; import { useAtomValue } from 'jotai';
import { useRouter } from 'next/router'; import { useRouter } from 'next/router';
import type React from 'react'; import type React from 'react';
import { useCallback, useEffect } from 'react'; import { useCallback } from 'react';
import { getUIAdapter } from '../../../adapters/workspace'; import { getUIAdapter } from '../../../adapters/workspace';
import { rootCurrentWorkspaceAtom } from '../../../atoms/root'; 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 { useSyncRecentViewsWithRouter } from '../../../hooks/use-recent-views';
import { useRouterHelper } from '../../../hooks/use-router-helper'; import { useRouterHelper } from '../../../hooks/use-router-helper';
import { WorkspaceLayout } from '../../../layouts/workspace-layout'; import { WorkspaceLayout } from '../../../layouts/workspace-layout';
import type { BlockSuiteWorkspace, NextPageWithLayout } from '../../../shared'; import type { NextPageWithLayout } from '../../../shared';
function setEditorFlags(blockSuiteWorkspace: BlockSuiteWorkspace) {
Object.entries(config.editorFlags).forEach(([key, value]) => {
blockSuiteWorkspace.awarenessStore.setFlag(
key as keyof BlockSuiteFeatureFlags,
value
);
});
}
const WorkspaceDetail: React.FC = () => { const WorkspaceDetail: React.FC = () => {
const router = useRouter(); const router = useRouter();
@@ -50,12 +39,6 @@ const WorkspaceDetail: React.FC = () => {
[blockSuiteWorkspace.id, openPage] [blockSuiteWorkspace.id, openPage]
); );
useEffect(() => {
if (currentWorkspace) {
setEditorFlags(currentWorkspace.blockSuiteWorkspace);
}
}, [currentWorkspace]);
const { PageDetail, Header } = getUIAdapter(currentWorkspace.flavour); const { PageDetail, Header } = getUIAdapter(currentWorkspace.flavour);
return ( return (
<> <>

View File

@@ -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
);
});
}

View File

@@ -31,9 +31,9 @@
"lint:fix": "yarn lint --fix", "lint:fix": "yarn lint --fix",
"test": "playwright test", "test": "playwright test",
"test:coverage": "COVERAGE=true yarn test --forbid-only", "test:coverage": "COVERAGE=true yarn test --forbid-only",
"test:unit": "vitest --run", "test:unit": "ENABLE_PRELOADING=false vitest --run",
"test:unit:ui": "vitest --ui", "test:unit:ui": "ENABLE_PRELOADING=false vitest --ui",
"test:unit:coverage": "vitest run --coverage", "test:unit:coverage": "ENABLE_PRELOADING=false vitest run --coverage",
"postinstall": "i18n-codegen gen && husky install", "postinstall": "i18n-codegen gen && husky install",
"notify": "node scripts/notify.mjs", "notify": "node scripts/notify.mjs",
"typecheck": "tsc -b tsconfig.json --diagnostics" "typecheck": "tsc -b tsconfig.json --diagnostics"

View File

@@ -49,12 +49,12 @@
"rxjs": "^7.8.1" "rxjs": "^7.8.1"
}, },
"devDependencies": { "devDependencies": {
"@blocksuite/blocks": "0.0.0-20230601122821-16196c35-nightly", "@blocksuite/blocks": "0.0.0-20230606130340-805f430b-nightly",
"@blocksuite/editor": "0.0.0-20230601122821-16196c35-nightly", "@blocksuite/editor": "0.0.0-20230606130340-805f430b-nightly",
"@blocksuite/global": "0.0.0-20230601122821-16196c35-nightly", "@blocksuite/global": "0.0.0-20230606130340-805f430b-nightly",
"@blocksuite/icons": "^2.1.19", "@blocksuite/icons": "^2.1.19",
"@blocksuite/lit": "0.0.0-20230601122821-16196c35-nightly", "@blocksuite/lit": "0.0.0-20230606130340-805f430b-nightly",
"@blocksuite/store": "0.0.0-20230601122821-16196c35-nightly", "@blocksuite/store": "0.0.0-20230606130340-805f430b-nightly",
"@types/react": "^18.2.6", "@types/react": "^18.2.6",
"@types/react-dnd": "^3.0.2", "@types/react-dnd": "^3.0.2",
"@types/react-dom": "18.2.4", "@types/react-dom": "18.2.4",

View File

@@ -5,7 +5,7 @@
"module": "./src/index.ts", "module": "./src/index.ts",
"devDependencies": { "devDependencies": {
"@affine/templates": "workspace:*", "@affine/templates": "workspace:*",
"@blocksuite/global": "0.0.0-20230601122821-16196c35-nightly", "@blocksuite/global": "0.0.0-20230606130340-805f430b-nightly",
"next": "=13.4.2", "next": "=13.4.2",
"react": "18.3.0-canary-16d053d59-20230506", "react": "18.3.0-canary-16d053d59-20230506",
"react-dom": "18.3.0-canary-16d053d59-20230506", "react-dom": "18.3.0-canary-16d053d59-20230506",

View File

@@ -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'; import type { Page } from '@blocksuite/store';
declare global { export async function initPageWithPreloading(page: Page) {
interface Window { const workspace = page.workspace;
lastImportedMarkdown: string; const { data } = await import('@affine/templates/preloading.json');
} await workspace.importPageSnapshot(data['space:Qmo9-1SGTB'], page.id);
} }
const markdown = markdownTemplate as unknown as string; export function initEmptyPage(page: Page): void {
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 {
const pageBlockId = page.addBlock('affine:page', { const pageBlockId = page.addBlock('affine:page', {
title: new page.Text(title ?? ''), title: new page.Text(''),
}); });
page.addBlock('affine:surface', {}, pageBlockId); page.addBlock('affine:surface', {}, pageBlockId);
const frameId = page.addBlock('affine:frame', {}, pageBlockId); const frameId = page.addBlock('affine:frame', {}, pageBlockId);
page.addBlock('affine:paragraph', {}, frameId); 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 });
}

View File

@@ -21,6 +21,7 @@ export const buildFlagsSchema = z.object({
enableDebugPage: z.boolean(), enableDebugPage: z.boolean(),
enableLegacyCloud: z.boolean(), enableLegacyCloud: z.boolean(),
changelogUrl: z.string(), changelogUrl: z.string(),
enablePreloading: z.boolean(),
}); });
export const blockSuiteFeatureFlags = z.object({ export const blockSuiteFeatureFlags = z.object({

View File

@@ -3,7 +3,7 @@
*/ */
import 'fake-indexeddb/auto'; import 'fake-indexeddb/auto';
import { initPage } from '@affine/env/blocksuite'; import { initEmptyPage } from '@affine/env/blocksuite';
import { __unstableSchemas, AffineSchemas } from '@blocksuite/blocks/models'; import { __unstableSchemas, AffineSchemas } from '@blocksuite/blocks/models';
import { Workspace } from '@blocksuite/store'; import { Workspace } from '@blocksuite/store';
import { renderHook } from '@testing-library/react'; import { renderHook } from '@testing-library/react';
@@ -20,9 +20,9 @@ beforeEach(() => {
}) })
.register(AffineSchemas) .register(AffineSchemas)
.register(__unstableSchemas); .register(__unstableSchemas);
initPage(blockSuiteWorkspace.createPage({ id: 'page0' })); initEmptyPage(blockSuiteWorkspace.createPage({ id: 'page0' }));
initPage(blockSuiteWorkspace.createPage({ id: 'page1' })); initEmptyPage(blockSuiteWorkspace.createPage({ id: 'page1' }));
initPage(blockSuiteWorkspace.createPage({ id: 'page2' })); initEmptyPage(blockSuiteWorkspace.createPage({ id: 'page2' }));
}); });
describe('useBlockSuiteWorkspaceHelper', () => { describe('useBlockSuiteWorkspaceHelper', () => {
@@ -50,7 +50,7 @@ describe('useBlockSuiteWorkspaceHelper', () => {
); );
await helperHook.result.current.markMilestone('test'); await helperHook.result.current.markMilestone('test');
expect(blockSuiteWorkspace.meta.pageMetas.length).toBe(3); 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(blockSuiteWorkspace.meta.pageMetas.length).toBe(4);
expect(await helperHook.result.current.listMilestone()).toHaveProperty( expect(await helperHook.result.current.listMilestone()).toHaveProperty(
'test' 'test'

View File

@@ -16,8 +16,6 @@ declare module '@blocksuite/store' {
updatedDate?: number; updatedDate?: number;
mode?: 'page' | 'edgeless'; mode?: 'page' | 'edgeless';
jumpOnce?: boolean; jumpOnce?: boolean;
// whether to create the page with the default template
init?: boolean;
// todo: support `number` in the future // todo: support `number` in the future
isPublic?: boolean; isPublic?: boolean;
} }

View File

@@ -7,11 +7,11 @@
"jotai": "^2.1.1" "jotai": "^2.1.1"
}, },
"devDependencies": { "devDependencies": {
"@blocksuite/blocks": "0.0.0-20230601101714-0d24ba91-nightly", "@blocksuite/blocks": "0.0.0-20230606130340-805f430b-nightly",
"@blocksuite/editor": "0.0.0-20230601101714-0d24ba91-nightly", "@blocksuite/editor": "0.0.0-20230606130340-805f430b-nightly",
"@blocksuite/global": "0.0.0-20230601101714-0d24ba91-nightly", "@blocksuite/global": "0.0.0-20230606130340-805f430b-nightly",
"@blocksuite/lit": "0.0.0-20230601101714-0d24ba91-nightly", "@blocksuite/lit": "0.0.0-20230606130340-805f430b-nightly",
"@blocksuite/store": "0.0.0-20230601101714-0d24ba91-nightly", "@blocksuite/store": "0.0.0-20230606130340-805f430b-nightly",
"lottie-web": "^5.12.0" "lottie-web": "^5.12.0"
}, },
"peerDependencies": { "peerDependencies": {

View File

@@ -13,11 +13,11 @@
"@affine/component": "workspace:*", "@affine/component": "workspace:*",
"@affine/env": "workspace:*", "@affine/env": "workspace:*",
"@affine/workspace": "workspace:*", "@affine/workspace": "workspace:*",
"@blocksuite/blocks": "0.0.0-20230601101714-0d24ba91-nightly", "@blocksuite/blocks": "0.0.0-20230606130340-805f430b-nightly",
"@blocksuite/editor": "0.0.0-20230601101714-0d24ba91-nightly", "@blocksuite/editor": "0.0.0-20230606130340-805f430b-nightly",
"@blocksuite/global": "0.0.0-20230601101714-0d24ba91-nightly", "@blocksuite/global": "0.0.0-20230606130340-805f430b-nightly",
"@blocksuite/lit": "0.0.0-20230601101714-0d24ba91-nightly", "@blocksuite/lit": "0.0.0-20230606130340-805f430b-nightly",
"@blocksuite/store": "0.0.0-20230601101714-0d24ba91-nightly" "@blocksuite/store": "0.0.0-20230606130340-805f430b-nightly"
}, },
"devDependencies": { "devDependencies": {
"jotai": "^2.1.1" "jotai": "^2.1.1"

View File

@@ -1,6 +1,6 @@
import { BlockSuiteEditor } from '@affine/component/block-suite-editor'; import { BlockSuiteEditor } from '@affine/component/block-suite-editor';
import { ImagePreviewModal } from '@affine/component/image-preview-modal'; 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 { WorkspaceFlavour } from '@affine/workspace/type';
import { createEmptyBlockSuiteWorkspace } from '@affine/workspace/utils'; import { createEmptyBlockSuiteWorkspace } from '@affine/workspace/utils';
import type { Meta } from '@storybook/react'; import type { Meta } from '@storybook/react';
@@ -15,7 +15,7 @@ const workspace = createEmptyBlockSuiteWorkspace(
WorkspaceFlavour.LOCAL WorkspaceFlavour.LOCAL
); );
const page = workspace.createPage('page0'); const page = workspace.createPage('page0');
initPage(page); initEmptyPage(page);
fetch(new URL('@affine-test/fixtures/large-image.png', import.meta.url)) fetch(new URL('@affine-test/fixtures/large-image.png', import.meta.url))
.then(res => res.arrayBuffer()) .then(res => res.arrayBuffer())
.then(async buffer => { .then(async buffer => {
@@ -49,7 +49,7 @@ export const Default = () => {
overflow: 'auto', overflow: 'auto',
}} }}
> >
<BlockSuiteEditor mode="page" page={page} onInit={initPage} /> <BlockSuiteEditor mode="page" page={page} onInit={initEmptyPage} />
</div> </div>
<div <div
style={{ style={{

View File

@@ -3,7 +3,8 @@
"private": true, "private": true,
"sideEffect": false, "sideEffect": false,
"exports": { "exports": {
"./*.md": "./src/*.md" "./*.md": "./*.md",
"./preloading.json": "./preloading.json"
}, },
"version": "0.6.0" "version": "0.6.0"
} }

File diff suppressed because it is too large Load Diff

View File

@@ -28,8 +28,8 @@
"idb": "^7.1.1" "idb": "^7.1.1"
}, },
"devDependencies": { "devDependencies": {
"@blocksuite/blocks": "0.0.0-20230601101714-0d24ba91-nightly", "@blocksuite/blocks": "0.0.0-20230606130340-805f430b-nightly",
"@blocksuite/store": "0.0.0-20230601101714-0d24ba91-nightly", "@blocksuite/store": "0.0.0-20230606130340-805f430b-nightly",
"vite": "^4.3.9", "vite": "^4.3.9",
"vite-plugin-dts": "^2.3.0", "vite-plugin-dts": "^2.3.0",
"y-indexeddb": "^9.0.11" "y-indexeddb": "^9.0.11"

View File

@@ -3,7 +3,7 @@
*/ */
import 'fake-indexeddb/auto'; import 'fake-indexeddb/auto';
import { initPage } from '@affine/env/blocksuite'; import { initEmptyPage } from '@affine/env/blocksuite';
import { __unstableSchemas, AffineSchemas } from '@blocksuite/blocks/models'; import { __unstableSchemas, AffineSchemas } from '@blocksuite/blocks/models';
import { assertExists, uuidv4, Workspace } from '@blocksuite/store'; import { assertExists, uuidv4, Workspace } from '@blocksuite/store';
import { openDB } from 'idb'; import { openDB } from 'idb';
@@ -375,7 +375,7 @@ describe('milestone', () => {
describe('utils', () => { describe('utils', () => {
test('download binary', async () => { test('download binary', async () => {
const page = workspace.createPage('page0'); const page = workspace.createPage('page0');
initPage(page); initEmptyPage(page);
const provider = createIndexedDBProvider( const provider = createIndexedDBProvider(
workspace.id, workspace.id,
workspace.doc, workspace.doc,

View File

@@ -1,8 +1,10 @@
import type { Page } from '@playwright/test'; import type { Page } from '@playwright/test';
import { expect } from '@playwright/test'; import { expect } from '@playwright/test';
export async function waitMarkdownImported(page: Page) { export async function waitEditorLoad(page: Page) {
await page.waitForSelector('v-line'); await page.waitForSelector('v-line', {
timeout: 10000,
});
} }
export async function newPage(page: Page) { export async function newPage(page: Page) {
@@ -10,7 +12,7 @@ export async function newPage(page: Page) {
await page.getByTestId('new-page-button').click({ await page.getByTestId('new-page-button').click({
delay: 100, delay: 100,
}); });
await page.waitForSelector('v-line'); await waitEditorLoad(page);
} }
export function getBlockSuiteEditorTitle(page: Page) { export function getBlockSuiteEditorTitle(page: Page) {

View File

@@ -2,7 +2,7 @@ import { test } from '@affine-test/kit/playwright';
import { expect } from '@playwright/test'; import { expect } from '@playwright/test';
import { openHomePage } from '../../libs/load-page'; import { openHomePage } from '../../libs/load-page';
import { waitMarkdownImported } from '../../libs/page-logic'; import { waitEditorLoad } from '../../libs/page-logic';
import { import {
clickNewPageButton, clickNewPageButton,
clickSideBarCurrentWorkspaceBanner, clickSideBarCurrentWorkspaceBanner,
@@ -11,7 +11,7 @@ import { getBuiltInUser, loginUser } from '../../libs/utils';
test('collaborative', async ({ page, browser }) => { test('collaborative', async ({ page, browser }) => {
await openHomePage(page); await openHomePage(page);
await waitMarkdownImported(page); await waitEditorLoad(page);
const [a, b] = await getBuiltInUser(); const [a, b] = await getBuiltInUser();
await loginUser(page, a); await loginUser(page, a);
await page.reload(); await page.reload();

View File

@@ -2,14 +2,14 @@ import { test } from '@affine-test/kit/playwright';
import { expect } from '@playwright/test'; import { expect } from '@playwright/test';
import { openHomePage } from '../../libs/load-page'; import { openHomePage } from '../../libs/load-page';
import { waitMarkdownImported } from '../../libs/page-logic'; import { waitEditorLoad } from '../../libs/page-logic';
import { clickSideBarAllPageButton } from '../../libs/sidebar'; import { clickSideBarAllPageButton } from '../../libs/sidebar';
import { createFakeUser, loginUser } from '../../libs/utils'; import { createFakeUser, loginUser } from '../../libs/utils';
import { enableAffineCloudWorkspace } from '../../libs/workspace'; import { enableAffineCloudWorkspace } from '../../libs/workspace';
test('authorization expired', async ({ page }) => { test('authorization expired', async ({ page }) => {
await openHomePage(page); await openHomePage(page);
await waitMarkdownImported(page); await waitEditorLoad(page);
const [a] = await createFakeUser(); const [a] = await createFakeUser();
await loginUser(page, a); await loginUser(page, a);
await enableAffineCloudWorkspace(page); await enableAffineCloudWorkspace(page);

View File

@@ -2,7 +2,7 @@ import { test } from '@affine-test/kit/playwright';
import { expect } from '@playwright/test'; import { expect } from '@playwright/test';
import { openHomePage } from '../../libs/load-page'; import { openHomePage } from '../../libs/load-page';
import { waitMarkdownImported } from '../../libs/page-logic'; import { waitEditorLoad } from '../../libs/page-logic';
import { clickNewPageButton } from '../../libs/sidebar'; import { clickNewPageButton } from '../../libs/sidebar';
import { createFakeUser, loginUser } from '../../libs/utils'; import { createFakeUser, loginUser } from '../../libs/utils';
import { createWorkspace } from '../../libs/workspace'; import { createWorkspace } from '../../libs/workspace';
@@ -13,7 +13,7 @@ test('public single page', async ({ page, browser }) => {
await loginUser(page, a); await loginUser(page, a);
const name = `test-${Date.now()}`; const name = `test-${Date.now()}`;
await createWorkspace({ name }, page); await createWorkspace({ name }, page);
await waitMarkdownImported(page); await waitEditorLoad(page);
await clickNewPageButton(page); await clickNewPageButton(page);
const page1Id = page.url().split('/').at(-1); const page1Id = page.url().split('/').at(-1);
await clickNewPageButton(page); await clickNewPageButton(page);

View File

@@ -2,7 +2,7 @@ import { test } from '@affine-test/kit/playwright';
import { expect } from '@playwright/test'; import { expect } from '@playwright/test';
import { openHomePage } from '../../libs/load-page'; import { openHomePage } from '../../libs/load-page';
import { waitMarkdownImported } from '../../libs/page-logic'; import { waitEditorLoad } from '../../libs/page-logic';
import { clickPublishPanel } from '../../libs/setting'; import { clickPublishPanel } from '../../libs/setting';
import { import {
clickSideBarAllPageButton, clickSideBarAllPageButton,
@@ -15,10 +15,10 @@ test('enable public workspace', async ({ page, context }) => {
await openHomePage(page); await openHomePage(page);
const [a] = await createFakeUser(); const [a] = await createFakeUser();
await loginUser(page, a); await loginUser(page, a);
await waitMarkdownImported(page); await waitEditorLoad(page);
const name = `test-${Date.now()}`; const name = `test-${Date.now()}`;
await createWorkspace({ name }, page); await createWorkspace({ name }, page);
await waitMarkdownImported(page); await waitEditorLoad(page);
await clickSideBarSettingButton(page); await clickSideBarSettingButton(page);
await page.waitForTimeout(50); await page.waitForTimeout(50);
await clickPublishPanel(page); await clickPublishPanel(page);
@@ -45,10 +45,10 @@ test('access public workspace page', async ({ page, browser }) => {
await openHomePage(page); await openHomePage(page);
const [a] = await createFakeUser(); const [a] = await createFakeUser();
await loginUser(page, a); await loginUser(page, a);
await waitMarkdownImported(page); await waitEditorLoad(page);
const name = `test-${Date.now()}`; const name = `test-${Date.now()}`;
await createWorkspace({ name }, page); await createWorkspace({ name }, page);
await waitMarkdownImported(page); await waitEditorLoad(page);
await clickSideBarSettingButton(page); await clickSideBarSettingButton(page);
await page.waitForTimeout(50); await page.waitForTimeout(50);
await clickPublishPanel(page); await clickPublishPanel(page);

View File

@@ -1,7 +1,7 @@
import { expect } from '@playwright/test'; import { expect } from '@playwright/test';
import { openHomePage } from '../../libs/load-page'; 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 // eslint-disable-next-line @typescript-eslint/no-var-requires
const userA = require('../../fixtures/userA.json'); const userA = require('../../fixtures/userA.json');
@@ -23,7 +23,7 @@ import {
test('should login with user A', async ({ page }) => { test('should login with user A', async ({ page }) => {
await openHomePage(page); await openHomePage(page);
await waitMarkdownImported(page); await waitEditorLoad(page);
const [a] = await createFakeUser(userA, userB); const [a] = await createFakeUser(userA, userB);
await loginUser(page, a); await loginUser(page, a);
await clickSideBarCurrentWorkspaceBanner(page); await clickSideBarCurrentWorkspaceBanner(page);
@@ -35,7 +35,7 @@ test('should login with user A', async ({ page }) => {
test('should enable affine workspace successfully', async ({ page }) => { test('should enable affine workspace successfully', async ({ page }) => {
await openHomePage(page); await openHomePage(page);
await waitMarkdownImported(page); await waitEditorLoad(page);
const [a] = await createFakeUser(); const [a] = await createFakeUser();
await loginUser(page, a); await loginUser(page, a);
const name = `test-${Date.now()}`; const name = `test-${Date.now()}`;
@@ -50,6 +50,6 @@ test('should enable affine workspace successfully', async ({ page }) => {
await assertCurrentWorkspaceFlavour('affine', page); await assertCurrentWorkspaceFlavour('affine', page);
await openWorkspaceListModal(page); await openWorkspaceListModal(page);
await page.getByTestId('workspace-list-modal-sign-out').click(); await page.getByTestId('workspace-list-modal-sign-out').click();
await waitMarkdownImported(page); await waitEditorLoad(page);
await assertCurrentWorkspaceFlavour('local', page); await assertCurrentWorkspaceFlavour('local', page);
}); });

View File

@@ -3,10 +3,7 @@ import type { Page } from '@playwright/test';
import { expect } from '@playwright/test'; import { expect } from '@playwright/test';
import { openHomePage } from '../libs/load-page'; import { openHomePage } from '../libs/load-page';
import { import { getBlockSuiteEditorTitle, waitEditorLoad } from '../libs/page-logic';
getBlockSuiteEditorTitle,
waitMarkdownImported,
} from '../libs/page-logic';
import { clickSideBarAllPageButton } from '../libs/sidebar'; import { clickSideBarAllPageButton } from '../libs/sidebar';
function getAllPage(page: Page) { function getAllPage(page: Page) {
@@ -29,14 +26,14 @@ function getAllPage(page: Page) {
test('all page', async ({ page }) => { test('all page', async ({ page }) => {
await openHomePage(page); await openHomePage(page);
await waitMarkdownImported(page); await waitEditorLoad(page);
await clickSideBarAllPageButton(page); await clickSideBarAllPageButton(page);
}); });
test('all page can create new page', async ({ page }) => { test('all page can create new page', async ({ page }) => {
const { clickNewPageButton } = getAllPage(page); const { clickNewPageButton } = getAllPage(page);
await openHomePage(page); await openHomePage(page);
await waitMarkdownImported(page); await waitEditorLoad(page);
await clickSideBarAllPageButton(page); await clickSideBarAllPageButton(page);
await clickNewPageButton(); await clickNewPageButton();
const title = getBlockSuiteEditorTitle(page); 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 }) => { test('all page can create new edgeless page', async ({ page }) => {
const { clickNewEdgelessDropdown } = getAllPage(page); const { clickNewEdgelessDropdown } = getAllPage(page);
await openHomePage(page); await openHomePage(page);
await waitMarkdownImported(page); await waitEditorLoad(page);
await clickSideBarAllPageButton(page); await clickSideBarAllPageButton(page);
await clickNewEdgelessDropdown(); await clickNewEdgelessDropdown();
await expect(page.locator('affine-edgeless-page')).toBeVisible(); 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 }) => { test('allow creation of filters by favorite', async ({ page }) => {
await openHomePage(page); await openHomePage(page);
await waitMarkdownImported(page); await waitEditorLoad(page);
await clickSideBarAllPageButton(page); await clickSideBarAllPageButton(page);
await closeDownloadTip(page); await closeDownloadTip(page);
await createFirstFilter(page, 'Is Favourited'); 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 }) => { test('allow creation of filters by created time', async ({ page }) => {
await openHomePage(page); await openHomePage(page);
await waitMarkdownImported(page); await waitEditorLoad(page);
await clickSideBarAllPageButton(page); await clickSideBarAllPageButton(page);
await closeDownloadTip(page); await closeDownloadTip(page);
await createFirstFilter(page, 'Created'); await createFirstFilter(page, 'Created');

View File

@@ -2,7 +2,7 @@ import { test } from '@affine-test/kit/playwright';
import { expect } from '@playwright/test'; import { expect } from '@playwright/test';
import { openHomePage } from '../libs/load-page'; 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 }) => { test('Switch to edgeless by switch edgeless item', async ({ page }) => {
async function getCount(): Promise<number> { async function getCount(): Promise<number> {
@@ -11,7 +11,7 @@ test('Switch to edgeless by switch edgeless item', async ({ page }) => {
}); });
} }
await openHomePage(page); await openHomePage(page);
await waitMarkdownImported(page); await waitEditorLoad(page);
const btn = await page.getByTestId('switch-edgeless-mode-button'); const btn = await page.getByTestId('switch-edgeless-mode-button');
await page.evaluate(() => { await page.evaluate(() => {
globalThis.__toastCount = 0; 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 }) => { test('Convert to edgeless by editor header items', async ({ page }) => {
await openHomePage(page); await openHomePage(page);
await waitMarkdownImported(page); await waitEditorLoad(page);
await clickPageMoreActions(page); await clickPageMoreActions(page);
const menusEdgelessItem = page.getByTestId('editor-option-menu-edgeless'); const menusEdgelessItem = page.getByTestId('editor-option-menu-edgeless');
await menusEdgelessItem.click({ delay: 100 }); await menusEdgelessItem.click({ delay: 100 });

View File

@@ -2,11 +2,11 @@ import { test } from '@affine-test/kit/playwright';
import { expect } from '@playwright/test'; import { expect } from '@playwright/test';
import { openHomePage } from '../libs/load-page'; 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 }) => { test('Click right-bottom corner contact icon', async ({ page }) => {
await openHomePage(page); await openHomePage(page);
await waitMarkdownImported(page); await waitEditorLoad(page);
await page.locator('[data-testid=help-island]').click(); await page.locator('[data-testid=help-island]').click();
const rightBottomContactUs = page.locator( const rightBottomContactUs = page.locator(
'[data-testid=right-bottom-contact-us-icon]' '[data-testid=right-bottom-contact-us-icon]'

View File

@@ -2,7 +2,7 @@ import { test } from '@affine-test/kit/playwright';
import { expect } from '@playwright/test'; import { expect } from '@playwright/test';
test('should have page0', async ({ page }) => { 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'); await page.waitForSelector('v-line');
const pageId = await page.evaluate(async () => { const pageId = await page.evaluate(async () => {
// @ts-ignore // @ts-ignore

View File

@@ -2,7 +2,7 @@ import { test } from '@affine-test/kit/playwright';
import { expect } from '@playwright/test'; import { expect } from '@playwright/test';
import { openHomePage } from '../libs/load-page'; 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 ({ test('drag a page from "All pages" list onto the "Trash" folder in the sidebar to move it to trash list', async ({
page, 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 // Init test db with known workspaces and open "All Pages" page via url directly
{ {
await openHomePage(page); await openHomePage(page);
await waitMarkdownImported(page); await waitEditorLoad(page);
await page.getByText('All Pages').click(); await page.getByText('All Pages').click();
} }

View File

@@ -5,7 +5,7 @@ import { openHomePage } from '../libs/load-page';
import { import {
getBlockSuiteEditorTitle, getBlockSuiteEditorTitle,
newPage, newPage,
waitMarkdownImported, waitEditorLoad,
} from '../libs/page-logic'; } from '../libs/page-logic';
async function importImage(page: Page, url: string) { async function importImage(page: Page, url: string) {
@@ -42,7 +42,7 @@ async function closeImagePreviewModal(page: Page) {
test('image preview should be shown', async ({ page }) => { test('image preview should be shown', async ({ page }) => {
await openHomePage(page); await openHomePage(page);
await waitMarkdownImported(page); await waitEditorLoad(page);
await newPage(page); await newPage(page);
const title = await getBlockSuiteEditorTitle(page); const title = await getBlockSuiteEditorTitle(page);
await title.click(); await title.click();
@@ -57,7 +57,7 @@ test('image preview should be shown', async ({ page }) => {
test('image go left and right', async ({ page }) => { test('image go left and right', async ({ page }) => {
await openHomePage(page); await openHomePage(page);
await waitMarkdownImported(page); await waitEditorLoad(page);
await newPage(page); await newPage(page);
let blobId: string; let blobId: string;
{ {

View File

@@ -2,11 +2,11 @@ import { test } from '@affine-test/kit/playwright';
import { expect } from '@playwright/test'; import { expect } from '@playwright/test';
import { openHomePage } from '../libs/load-page'; import { openHomePage } from '../libs/load-page';
import { waitMarkdownImported } from '../libs/page-logic'; import { waitEditorLoad } from '../libs/page-logic';
test('Collapse Sidebar', async ({ page }) => { test('Collapse Sidebar', async ({ page }) => {
await openHomePage(page); await openHomePage(page);
await waitMarkdownImported(page); await waitEditorLoad(page);
await page.getByTestId('app-sidebar-arrow-button-collapse').click(); await page.getByTestId('app-sidebar-arrow-button-collapse').click();
const sliderBarArea = page.getByTestId('app-sidebar'); const sliderBarArea = page.getByTestId('app-sidebar');
await expect(sliderBarArea).not.toBeInViewport(); await expect(sliderBarArea).not.toBeInViewport();
@@ -14,7 +14,7 @@ test('Collapse Sidebar', async ({ page }) => {
test('Expand Sidebar', async ({ page }) => { test('Expand Sidebar', async ({ page }) => {
await openHomePage(page); await openHomePage(page);
await waitMarkdownImported(page); await waitEditorLoad(page);
await page.getByTestId('app-sidebar-arrow-button-collapse').click(); await page.getByTestId('app-sidebar-arrow-button-collapse').click();
const sliderBarArea = page.getByTestId('sliderBar-inner'); const sliderBarArea = page.getByTestId('sliderBar-inner');
await expect(sliderBarArea).not.toBeInViewport(); await expect(sliderBarArea).not.toBeInViewport();
@@ -25,7 +25,7 @@ test('Expand Sidebar', async ({ page }) => {
test('Click resizer can close sidebar', async ({ page }) => { test('Click resizer can close sidebar', async ({ page }) => {
await openHomePage(page); await openHomePage(page);
await waitMarkdownImported(page); await waitEditorLoad(page);
const sliderBarArea = page.getByTestId('sliderBar-inner'); const sliderBarArea = page.getByTestId('sliderBar-inner');
await expect(sliderBarArea).toBeVisible(); await expect(sliderBarArea).toBeVisible();
@@ -35,7 +35,7 @@ test('Click resizer can close sidebar', async ({ page }) => {
test('Drag resizer can resize sidebar', async ({ page }) => { test('Drag resizer can resize sidebar', async ({ page }) => {
await openHomePage(page); await openHomePage(page);
await waitMarkdownImported(page); await waitEditorLoad(page);
const sliderBarArea = page.getByTestId('sliderBar-inner'); const sliderBarArea = page.getByTestId('sliderBar-inner');
await expect(sliderBarArea).toBeVisible(); 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 }) => { test('Sidebar in between sm & md breakpoint', async ({ page }) => {
await openHomePage(page); await openHomePage(page);
await waitMarkdownImported(page); await waitEditorLoad(page);
const sliderBarArea = page.getByTestId('sliderBar-inner'); const sliderBarArea = page.getByTestId('sliderBar-inner');
const sliderBarModalBackground = page.getByTestId('app-sidebar-float-mask'); const sliderBarModalBackground = page.getByTestId('app-sidebar-float-mask');
await expect(sliderBarArea).toBeInViewport(); await expect(sliderBarArea).toBeInViewport();

View File

@@ -2,12 +2,12 @@ import { test } from '@affine-test/kit/playwright';
import { expect } from '@playwright/test'; import { expect } from '@playwright/test';
import { openHomePage } from '../libs/load-page'; 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'; import { assertCurrentWorkspaceFlavour } from '../libs/workspace';
test('should create a page with a local first avatar', async ({ page }) => { test('should create a page with a local first avatar', async ({ page }) => {
await openHomePage(page); await openHomePage(page);
await waitMarkdownImported(page); await waitEditorLoad(page);
await newPage(page); await newPage(page);
await page.getByTestId('workspace-name').click(); await page.getByTestId('workspace-name').click();
await page.getByTestId('new-workspace').click({ delay: 50 }); await page.getByTestId('new-workspace').click({ delay: 50 });

View File

@@ -5,7 +5,7 @@ import { openHomePage } from '../libs/load-page';
import { import {
getBlockSuiteEditorTitle, getBlockSuiteEditorTitle,
newPage, newPage,
waitMarkdownImported, waitEditorLoad,
} from '../libs/page-logic'; } from '../libs/page-logic';
import { assertCurrentWorkspaceFlavour } from '../libs/workspace'; import { assertCurrentWorkspaceFlavour } from '../libs/workspace';
@@ -13,7 +13,7 @@ test('New a page , then delete it in all pages, permanently delete it', async ({
page, page,
}) => { }) => {
await openHomePage(page); await openHomePage(page);
await waitMarkdownImported(page); await waitEditorLoad(page);
await newPage(page); await newPage(page);
await getBlockSuiteEditorTitle(page).click(); await getBlockSuiteEditorTitle(page).click();
await getBlockSuiteEditorTitle(page).fill('this is a new page to restore'); await getBlockSuiteEditorTitle(page).fill('this is a new page to restore');

View File

@@ -2,7 +2,7 @@ import { test } from '@affine-test/kit/playwright';
import { expect } from '@playwright/test'; import { expect } from '@playwright/test';
import { openHomePage } from '../libs/load-page'; import { openHomePage } from '../libs/load-page';
import { waitMarkdownImported } from '../libs/page-logic'; import { waitEditorLoad } from '../libs/page-logic';
import { import {
clickSideBarCurrentWorkspaceBanner, clickSideBarCurrentWorkspaceBanner,
clickSideBarSettingButton, clickSideBarSettingButton,
@@ -11,7 +11,7 @@ import { assertCurrentWorkspaceFlavour } from '../libs/workspace';
test('Create new workspace, then delete it', async ({ page }) => { test('Create new workspace, then delete it', async ({ page }) => {
await openHomePage(page); await openHomePage(page);
await waitMarkdownImported(page); await waitEditorLoad(page);
await clickSideBarCurrentWorkspaceBanner(page); await clickSideBarCurrentWorkspaceBanner(page);
await page.getByTestId('new-workspace').click(); await page.getByTestId('new-workspace').click();
await page await page
@@ -49,7 +49,7 @@ test('Create new workspace, then delete it', async ({ page }) => {
test('Delete last workspace', async ({ page }) => { test('Delete last workspace', async ({ page }) => {
await openHomePage(page); await openHomePage(page);
await waitMarkdownImported(page); await waitEditorLoad(page);
await clickSideBarSettingButton(page); await clickSideBarSettingButton(page);
await page.getByTestId('delete-workspace-button').click(); await page.getByTestId('delete-workspace-button').click();
const workspaceNameDom = await page.getByTestId('workspace-name'); const workspaceNameDom = await page.getByTestId('workspace-name');

View File

@@ -6,13 +6,13 @@ import {
clickPageMoreActions, clickPageMoreActions,
getBlockSuiteEditorTitle, getBlockSuiteEditorTitle,
newPage, newPage,
waitMarkdownImported, waitEditorLoad,
} from '../libs/page-logic'; } from '../libs/page-logic';
import { assertCurrentWorkspaceFlavour } from '../libs/workspace'; import { assertCurrentWorkspaceFlavour } from '../libs/workspace';
test.skip('New a page ,then open it and export html', async ({ page }) => { test.skip('New a page ,then open it and export html', async ({ page }) => {
await openHomePage(page); await openHomePage(page);
await waitMarkdownImported(page); await waitEditorLoad(page);
await newPage(page); await newPage(page);
await getBlockSuiteEditorTitle(page).click(); await getBlockSuiteEditorTitle(page).click();
await page await page

View File

@@ -6,14 +6,14 @@ import {
clickPageMoreActions, clickPageMoreActions,
getBlockSuiteEditorTitle, getBlockSuiteEditorTitle,
newPage, newPage,
waitMarkdownImported, waitEditorLoad,
} from '../libs/page-logic'; } from '../libs/page-logic';
import { waitForLogMessage } from '../libs/utils'; import { waitForLogMessage } from '../libs/utils';
import { assertCurrentWorkspaceFlavour } from '../libs/workspace'; import { assertCurrentWorkspaceFlavour } from '../libs/workspace';
test('New a page and open it ,then favorite it', async ({ page }) => { test('New a page and open it ,then favorite it', async ({ page }) => {
await openHomePage(page); await openHomePage(page);
await waitMarkdownImported(page); await waitEditorLoad(page);
await newPage(page); await newPage(page);
await getBlockSuiteEditorTitle(page).click(); await getBlockSuiteEditorTitle(page).click();
await getBlockSuiteEditorTitle(page).fill('this is a new page to favorite'); 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 }) => { test('Export to html, markdown and png', async ({ page }) => {
await openHomePage(page); await openHomePage(page);
await waitMarkdownImported(page); await waitEditorLoad(page);
{ {
await clickPageMoreActions(page); await clickPageMoreActions(page);
await page.getByTestId('export-menu').click(); await page.getByTestId('export-menu').click();
@@ -66,7 +66,7 @@ test.skip('Export to pdf', async ({ page }) => {
}); });
}); });
await openHomePage(page); await openHomePage(page);
await waitMarkdownImported(page); await waitEditorLoad(page);
{ {
await clickPageMoreActions(page); await clickPageMoreActions(page);
await page.getByTestId('export-menu').click(); await page.getByTestId('export-menu').click();
@@ -77,7 +77,7 @@ test.skip('Export to pdf', async ({ page }) => {
test('Cancel favorite', async ({ page }) => { test('Cancel favorite', async ({ page }) => {
await openHomePage(page); await openHomePage(page);
await waitMarkdownImported(page); await waitEditorLoad(page);
await newPage(page); await newPage(page);
await getBlockSuiteEditorTitle(page).click(); await getBlockSuiteEditorTitle(page).click();
await getBlockSuiteEditorTitle(page).fill('this is a new page to favorite'); await getBlockSuiteEditorTitle(page).fill('this is a new page to favorite');

View File

@@ -7,12 +7,12 @@ import {
createLinkedPage, createLinkedPage,
getBlockSuiteEditorTitle, getBlockSuiteEditorTitle,
newPage, newPage,
waitMarkdownImported, waitEditorLoad,
} from '../libs/page-logic'; } from '../libs/page-logic';
test('Show favorite items in sidebar', async ({ page }) => { test('Show favorite items in sidebar', async ({ page }) => {
await openHomePage(page); await openHomePage(page);
await waitMarkdownImported(page); await waitEditorLoad(page);
await newPage(page); await newPage(page);
await getBlockSuiteEditorTitle(page).click(); await getBlockSuiteEditorTitle(page).click();
await getBlockSuiteEditorTitle(page).fill('this is a new page to favorite'); 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 }) => { test('Show favorite reference in sidebar', async ({ page }) => {
await openHomePage(page); await openHomePage(page);
await waitMarkdownImported(page); await waitEditorLoad(page);
await newPage(page); await newPage(page);
await getBlockSuiteEditorTitle(page).click(); await getBlockSuiteEditorTitle(page).click();
await getBlockSuiteEditorTitle(page).fill('this is a new page to favorite'); 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, page,
}) => { }) => {
await openHomePage(page); await openHomePage(page);
await waitMarkdownImported(page); await waitEditorLoad(page);
await newPage(page); await newPage(page);
await getBlockSuiteEditorTitle(page).click(); await getBlockSuiteEditorTitle(page).click();
await getBlockSuiteEditorTitle(page).fill('this is a new page to favorite'); await getBlockSuiteEditorTitle(page).fill('this is a new page to favorite');

View File

@@ -5,13 +5,13 @@ import { openHomePage } from '../libs/load-page';
import { import {
getBlockSuiteEditorTitle, getBlockSuiteEditorTitle,
newPage, newPage,
waitMarkdownImported, waitEditorLoad,
} from '../libs/page-logic'; } from '../libs/page-logic';
import { assertCurrentWorkspaceFlavour } from '../libs/workspace'; import { assertCurrentWorkspaceFlavour } from '../libs/workspace';
test('click btn new page', async ({ page }) => { test('click btn new page', async ({ page }) => {
await openHomePage(page); await openHomePage(page);
await waitMarkdownImported(page); await waitEditorLoad(page);
const originPageId = page.url().split('/').reverse()[0]; const originPageId = page.url().split('/').reverse()[0];
await newPage(page); await newPage(page);
const newPageId = page.url().split('/').reverse()[0]; 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 }) => { test('click btn bew page and find it in all pages', async ({ page }) => {
await openHomePage(page); await openHomePage(page);
await waitMarkdownImported(page); await waitEditorLoad(page);
await newPage(page); await newPage(page);
await getBlockSuiteEditorTitle(page).click(); await getBlockSuiteEditorTitle(page).click();
await getBlockSuiteEditorTitle(page).fill('this is a new page'); await getBlockSuiteEditorTitle(page).fill('this is a new page');

View File

@@ -5,13 +5,13 @@ import { openHomePage } from '../libs/load-page';
import { import {
getBlockSuiteEditorTitle, getBlockSuiteEditorTitle,
newPage, newPage,
waitMarkdownImported, waitEditorLoad,
} from '../libs/page-logic'; } from '../libs/page-logic';
import { assertCurrentWorkspaceFlavour } from '../libs/workspace'; import { assertCurrentWorkspaceFlavour } from '../libs/workspace';
test('click btn bew page and open in tab', async ({ page }) => { test('click btn bew page and open in tab', async ({ page }) => {
await openHomePage(page); await openHomePage(page);
await waitMarkdownImported(page); await waitEditorLoad(page);
await newPage(page); await newPage(page);
await getBlockSuiteEditorTitle(page).click(); await getBlockSuiteEditorTitle(page).click();
await getBlockSuiteEditorTitle(page).fill('this is a new page'); await getBlockSuiteEditorTitle(page).fill('this is a new page');

View File

@@ -5,7 +5,7 @@ import { openHomePage } from '../libs/load-page';
import { import {
getBlockSuiteEditorTitle, getBlockSuiteEditorTitle,
newPage, newPage,
waitMarkdownImported, waitEditorLoad,
} from '../libs/page-logic'; } from '../libs/page-logic';
import { assertCurrentWorkspaceFlavour } from '../libs/workspace'; import { assertCurrentWorkspaceFlavour } from '../libs/workspace';
@@ -13,7 +13,7 @@ test('New a page , then delete it in all pages, restore it', async ({
page, page,
}) => { }) => {
await openHomePage(page); await openHomePage(page);
await waitMarkdownImported(page); await waitEditorLoad(page);
await newPage(page); await newPage(page);
await getBlockSuiteEditorTitle(page).click(); await getBlockSuiteEditorTitle(page).click();
await getBlockSuiteEditorTitle(page).fill('this is a new page to restore'); await getBlockSuiteEditorTitle(page).fill('this is a new page to restore');

View File

@@ -4,14 +4,14 @@ import { test, testResultDir } from '@affine-test/kit/playwright';
import { expect } from '@playwright/test'; import { expect } from '@playwright/test';
import { openHomePage } from '../libs/load-page'; import { openHomePage } from '../libs/load-page';
import { waitMarkdownImported } from '../libs/page-logic'; import { waitEditorLoad } from '../libs/page-logic';
import { clickSideBarSettingButton } from '../libs/sidebar'; import { clickSideBarSettingButton } from '../libs/sidebar';
test('Should highlight the setting page menu when selected', async ({ test('Should highlight the setting page menu when selected', async ({
page, page,
}) => { }) => {
await openHomePage(page); await openHomePage(page);
await waitMarkdownImported(page); await waitEditorLoad(page);
const element = await page.getByTestId('slider-bar-workspace-setting-button'); const element = await page.getByTestId('slider-bar-workspace-setting-button');
const prev = await element.screenshot({ const prev = await element.screenshot({
path: resolve( path: resolve(

View File

@@ -6,13 +6,13 @@ import {
clickPageMoreActions, clickPageMoreActions,
getBlockSuiteEditorTitle, getBlockSuiteEditorTitle,
newPage, newPage,
waitMarkdownImported, waitEditorLoad,
} from '../libs/page-logic'; } from '../libs/page-logic';
import { assertCurrentWorkspaceFlavour } from '../libs/workspace'; import { assertCurrentWorkspaceFlavour } from '../libs/workspace';
test('New a page ,then open it and show delete modal', async ({ page }) => { test('New a page ,then open it and show delete modal', async ({ page }) => {
await openHomePage(page); await openHomePage(page);
await waitMarkdownImported(page); await waitEditorLoad(page);
await newPage(page); await newPage(page);
await getBlockSuiteEditorTitle(page).click(); await getBlockSuiteEditorTitle(page).click();
await getBlockSuiteEditorTitle(page).fill('this is a new page to delete'); 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, page,
}) => { }) => {
await openHomePage(page); await openHomePage(page);
await waitMarkdownImported(page); await waitEditorLoad(page);
await newPage(page); await newPage(page);
await getBlockSuiteEditorTitle(page).click(); await getBlockSuiteEditorTitle(page).click();
await getBlockSuiteEditorTitle(page).fill('this is a new page to delete'); await getBlockSuiteEditorTitle(page).fill('this is a new page to delete');

View File

@@ -5,7 +5,7 @@ import { openHomePage } from '../libs/load-page';
import { import {
getBlockSuiteEditorTitle, getBlockSuiteEditorTitle,
newPage, newPage,
waitMarkdownImported, waitEditorLoad,
} from '../libs/page-logic'; } from '../libs/page-logic';
import { assertCurrentWorkspaceFlavour } from '../libs/workspace'; 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, page,
}) => { }) => {
await openHomePage(page); await openHomePage(page);
await waitMarkdownImported(page); await waitEditorLoad(page);
await newPage(page); await newPage(page);
await getBlockSuiteEditorTitle(page).click(); await getBlockSuiteEditorTitle(page).click();
await getBlockSuiteEditorTitle(page).fill('this is a new page to delete'); await getBlockSuiteEditorTitle(page).fill('this is a new page to delete');

View File

@@ -2,13 +2,13 @@ import { test } from '@affine-test/kit/playwright';
import { expect } from '@playwright/test'; import { expect } from '@playwright/test';
import { openHomePage } from '../libs/load-page'; import { openHomePage } from '../libs/load-page';
import { waitMarkdownImported } from '../libs/page-logic'; import { waitEditorLoad } from '../libs/page-logic';
import { clickSideBarAllPageButton } from '../libs/sidebar'; import { clickSideBarAllPageButton } from '../libs/sidebar';
import { createWorkspace, openWorkspaceListModal } from '../libs/workspace'; import { createWorkspace, openWorkspaceListModal } from '../libs/workspace';
test('just one item in the workspace list at first', async ({ page }) => { test('just one item in the workspace list at first', async ({ page }) => {
await openHomePage(page); await openHomePage(page);
await waitMarkdownImported(page); await waitEditorLoad(page);
const workspaceName = page.getByTestId('workspace-name'); const workspaceName = page.getByTestId('workspace-name');
await workspaceName.click(); await workspaceName.click();
expect( 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 }) => { test('create one workspace in the workspace list', async ({ page }) => {
await openHomePage(page); await openHomePage(page);
await waitMarkdownImported(page); await waitEditorLoad(page);
const newWorkspaceNameStr = 'New Workspace'; const newWorkspaceNameStr = 'New Workspace';
await createWorkspace({ name: newWorkspaceNameStr }, page); 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 }) => { test('create multi workspace in the workspace list', async ({ page }) => {
await openHomePage(page); await openHomePage(page);
await waitMarkdownImported(page); await waitEditorLoad(page);
await createWorkspace({ name: 'New Workspace 2' }, page); await createWorkspace({ name: 'New Workspace 2' }, page);
await createWorkspace({ name: 'New Workspace 3' }, 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 page.reload();
await openWorkspaceListModal(page); await openWorkspaceListModal(page);
await page.getByTestId('draggable-item').nth(1).click(); await page.getByTestId('draggable-item').nth(1).click();
await page.waitForTimeout(50); await page.waitForTimeout(500);
// @ts-expect-error // @ts-expect-error
const currentId: string = await page.evaluate(() => currentWorkspace.id); const currentId: string = await page.evaluate(() => currentWorkspace.id);
await openWorkspaceListModal(page); await openWorkspaceListModal(page);
const sourceElement = await page.getByTestId('draggable-item').nth(2); const sourceElement = page.getByTestId('draggable-item').nth(2);
const targetElement = await page.getByTestId('draggable-item').nth(1); const targetElement = page.getByTestId('draggable-item').nth(1);
const sourceBox = await sourceElement.boundingBox(); const sourceBox = await sourceElement.boundingBox();
const targetBox = await targetElement.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.mouse.up();
await page.waitForTimeout(50); await page.waitForTimeout(100);
await page.reload(); await page.reload();
await openWorkspaceListModal(page); 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.getByTestId('draggable-item').nth(2).click();
await page.waitForTimeout(100);
// @ts-expect-error // @ts-expect-error
const nextId: string = await page.evaluate(() => currentWorkspace.id); const nextId: string = await page.evaluate(() => currentWorkspace.id);

View File

@@ -2,12 +2,12 @@ import { test } from '@affine-test/kit/playwright';
import { expect } from '@playwright/test'; import { expect } from '@playwright/test';
import { openHomePage } from '../libs/load-page'; import { openHomePage } from '../libs/load-page';
import { waitMarkdownImported } from '../libs/page-logic'; import { waitEditorLoad } from '../libs/page-logic';
import { assertCurrentWorkspaceFlavour } from '../libs/workspace'; import { assertCurrentWorkspaceFlavour } from '../libs/workspace';
test('preset workspace name', async ({ page }) => { test('preset workspace name', async ({ page }) => {
await openHomePage(page); await openHomePage(page);
await waitMarkdownImported(page); await waitEditorLoad(page);
const workspaceName = page.getByTestId('workspace-name'); const workspaceName = page.getByTestId('workspace-name');
await page.waitForTimeout(1000); await page.waitForTimeout(1000);
expect(await workspaceName.textContent()).toBe('Demo Workspace'); expect(await workspaceName.textContent()).toBe('Demo Workspace');
@@ -22,7 +22,7 @@ test('preset workspace name', async ({ page }) => {
// }); // });
test('Open language switch menu', async ({ page }) => { test('Open language switch menu', async ({ page }) => {
await openHomePage(page); await openHomePage(page);
await waitMarkdownImported(page); await waitEditorLoad(page);
const editorOptionMenuButton = page.getByTestId('editor-option-menu'); const editorOptionMenuButton = page.getByTestId('editor-option-menu');
await expect(editorOptionMenuButton).toBeVisible(); await expect(editorOptionMenuButton).toBeVisible();
await editorOptionMenuButton.click(); await editorOptionMenuButton.click();

View File

@@ -2,14 +2,14 @@ import { test } from '@affine-test/kit/playwright';
import { expect } from '@playwright/test'; import { expect } from '@playwright/test';
import { openHomePage } from '../libs/load-page'; import { openHomePage } from '../libs/load-page';
import { waitMarkdownImported } from '../libs/page-logic'; import { waitEditorLoad } from '../libs/page-logic';
import { createWorkspace } from '../libs/workspace'; import { createWorkspace } from '../libs/workspace';
test('Open last workspace when back to affine', async ({ page }) => { test('Open last workspace when back to affine', async ({ page }) => {
await openHomePage(page); await openHomePage(page);
await waitMarkdownImported(page); await waitEditorLoad(page);
await createWorkspace({ name: 'New Workspace 2' }, page); await createWorkspace({ name: 'New Workspace 2' }, page);
await waitMarkdownImported(page); await waitEditorLoad(page);
// show workspace list // show workspace list
await page.getByTestId('workspace-name').click(); 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 workspaceCards[1].click();
await openHomePage(page); await openHomePage(page);
const workspaceNameDom = await page.getByTestId('workspace-name'); const workspaceNameDom = page.getByTestId('workspace-name');
const currentWorkspaceName = await workspaceNameDom.evaluate( const currentWorkspaceName = await workspaceNameDom.evaluate(
node => node.textContent node => node.textContent
); );

View File

@@ -3,7 +3,7 @@ import { expect, type Page } from '@playwright/test';
import { withCtrlOrMeta } from '../libs/keyboard'; import { withCtrlOrMeta } from '../libs/keyboard';
import { openHomePage } from '../libs/load-page'; 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) => const openQuickSearchByShortcut = async (page: Page) =>
await withCtrlOrMeta(page, () => page.keyboard.press('k', { delay: 50 })); 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 }) => { test('Click slider bar button', async ({ page }) => {
await openHomePage(page); await openHomePage(page);
await waitMarkdownImported(page); await waitEditorLoad(page);
await newPage(page); await newPage(page);
const quickSearchButton = page.locator( const quickSearchButton = page.locator(
'[data-testid=slider-bar-quick-search-button]' '[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 }) => { test('Click arrowDown icon after title', async ({ page }) => {
await openHomePage(page); await openHomePage(page);
await waitMarkdownImported(page); await waitEditorLoad(page);
await newPage(page); await newPage(page);
const quickSearchButton = page.locator( const quickSearchButton = page.locator(
'[data-testid=slider-bar-quick-search-button]' '[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 }) => { test('Press the shortcut key cmd+k', async ({ page }) => {
await openHomePage(page); await openHomePage(page);
await waitMarkdownImported(page); await waitEditorLoad(page);
await newPage(page); await newPage(page);
await openQuickSearchByShortcut(page); await openQuickSearchByShortcut(page);
const quickSearch = page.locator('[data-testid=quickSearch]'); 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 }) => { test('Create a new page without keyword', async ({ page }) => {
await openHomePage(page); await openHomePage(page);
await waitMarkdownImported(page); await waitEditorLoad(page);
await newPage(page); await newPage(page);
await openQuickSearchByShortcut(page); await openQuickSearchByShortcut(page);
const addNewPage = page.locator('[data-testid=quick-search-add-new-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 }) => { test('Create a new page with keyword', async ({ page }) => {
await openHomePage(page); await openHomePage(page);
await waitMarkdownImported(page); await waitEditorLoad(page);
await newPage(page); await newPage(page);
await openQuickSearchByShortcut(page); await openQuickSearchByShortcut(page);
await page.keyboard.insertText('test123456'); 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 }) => { test('Enter a keyword to search for', async ({ page }) => {
await openHomePage(page); await openHomePage(page);
await waitMarkdownImported(page); await waitEditorLoad(page);
await newPage(page); await newPage(page);
await openQuickSearchByShortcut(page); await openQuickSearchByShortcut(page);
await page.keyboard.insertText('test123456'); 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 }) => { test('Create a new page and search this page', async ({ page }) => {
await openHomePage(page); await openHomePage(page);
await waitMarkdownImported(page); await waitEditorLoad(page);
await newPage(page); await newPage(page);
await openQuickSearchByShortcut(page); await openQuickSearchByShortcut(page);
// input title and create new 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 }) => { test('Open quick search on local page', async ({ page }) => {
await openHomePage(page); await openHomePage(page);
await waitMarkdownImported(page); await waitEditorLoad(page);
await newPage(page); await newPage(page);
await openQuickSearchByShortcut(page); await openQuickSearchByShortcut(page);
const publishedSearchResults = page.locator('[publishedSearchResults]'); 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 }) => { test('Autofocus input after opening quick search', async ({ page }) => {
await openHomePage(page); await openHomePage(page);
await waitMarkdownImported(page); await waitEditorLoad(page);
await newPage(page); await newPage(page);
await openQuickSearchByShortcut(page); await openQuickSearchByShortcut(page);
const locator = page.locator('[cmdk-input]'); 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 }) => { test('Autofocus input after select', async ({ page }) => {
await openHomePage(page); await openHomePage(page);
await waitMarkdownImported(page); await waitEditorLoad(page);
await newPage(page); await newPage(page);
await openQuickSearchByShortcut(page); await openQuickSearchByShortcut(page);
await page.keyboard.press('ArrowUp'); 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 }) => { test('Focus title after creating a new page', async ({ page }) => {
await openHomePage(page); await openHomePage(page);
await waitMarkdownImported(page); await waitEditorLoad(page);
await newPage(page); await newPage(page);
await openQuickSearchByShortcut(page); await openQuickSearchByShortcut(page);
const addNewPage = page.locator('[data-testid=quick-search-add-new-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, page,
}) => { }) => {
await openHomePage(page); await openHomePage(page);
await waitMarkdownImported(page); await waitEditorLoad(page);
await openQuickSearchByShortcut(page); await openQuickSearchByShortcut(page);
expect(await page.getByTestId('navigation-path').count()).toBe(0); expect(await page.getByTestId('navigation-path').count()).toBe(0);
}); });

View File

@@ -2,11 +2,11 @@ import { test } from '@affine-test/kit/playwright';
import { expect } from '@playwright/test'; import { expect } from '@playwright/test';
import { openHomePage, webUrl } from '../libs/load-page'; 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 }) => { test('goto not found page', async ({ page }) => {
await openHomePage(page); await openHomePage(page);
await waitMarkdownImported(page); await waitEditorLoad(page);
const currentUrl = page.url(); const currentUrl = page.url();
const invalidUrl = currentUrl.replace(/\/$/, '') + '/invalid'; const invalidUrl = currentUrl.replace(/\/$/, '') + '/invalid';
await page.goto(invalidUrl); await page.goto(invalidUrl);
@@ -15,9 +15,9 @@ test('goto not found page', async ({ page }) => {
test('goto not found workspace', async ({ page }) => { test('goto not found workspace', async ({ page }) => {
await openHomePage(page); await openHomePage(page);
await waitMarkdownImported(page); await waitEditorLoad(page);
const currentUrl = page.url(); const currentUrl = page.url();
await page.goto(new URL('/workspace/invalid/all', webUrl).toString()); await page.goto(new URL('/workspace/invalid/all', webUrl).toString());
await page.waitForSelector('v-line'); await waitEditorLoad(page);
expect(page.url()).toEqual(currentUrl); expect(page.url()).toEqual(currentUrl);
}); });

View File

@@ -2,11 +2,11 @@ import { test } from '@affine-test/kit/playwright';
import { expect } from '@playwright/test'; import { expect } from '@playwright/test';
import { openHomePage } from '../libs/load-page'; import { openHomePage } from '../libs/load-page';
import { waitMarkdownImported } from '../libs/page-logic'; import { waitEditorLoad } from '../libs/page-logic';
test('Open shortcuts modal', async ({ page }) => { test('Open shortcuts modal', async ({ page }) => {
await openHomePage(page); await openHomePage(page);
await waitMarkdownImported(page); await waitEditorLoad(page);
await page.locator('[data-testid=help-island]').click(); await page.locator('[data-testid=help-island]').click();
const shortcutsIcon = page.locator('[data-testid=shortcuts-icon]'); const shortcutsIcon = page.locator('[data-testid=shortcuts-icon]');

View File

@@ -2,11 +2,11 @@ import { test } from '@affine-test/kit/playwright';
import { expect } from '@playwright/test'; import { expect } from '@playwright/test';
import { openHomePage } from '../libs/load-page'; import { openHomePage } from '../libs/load-page';
import { waitMarkdownImported } from '../libs/page-logic'; import { waitEditorLoad } from '../libs/page-logic';
test('Create subpage', async ({ page }) => { test('Create subpage', async ({ page }) => {
await openHomePage(page); await openHomePage(page);
await waitMarkdownImported(page); await waitEditorLoad(page);
await page.getByTestId('app-sidebar-arrow-button-collapse').click(); await page.getByTestId('app-sidebar-arrow-button-collapse').click();
const sliderBarArea = page.getByTestId('sliderBar-inner'); const sliderBarArea = page.getByTestId('sliderBar-inner');
await expect(sliderBarArea).not.toBeInViewport(); await expect(sliderBarArea).not.toBeInViewport();

View File

@@ -4,7 +4,7 @@ import { test, testResultDir } from '@affine-test/kit/playwright';
import { expect } from '@playwright/test'; import { expect } from '@playwright/test';
import { openHomePage } from '../libs/load-page'; 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 // default could be anything, according to the system
test('default white', async ({ browser }) => { test('default white', async ({ browser }) => {
@@ -13,7 +13,7 @@ test('default white', async ({ browser }) => {
}); });
const page = await context.newPage(); const page = await context.newPage();
await openHomePage(page); await openHomePage(page);
await waitMarkdownImported(page); await waitEditorLoad(page);
const root = page.locator('html'); const root = page.locator('html');
const themeMode = await root.evaluate(element => const themeMode = await root.evaluate(element =>
element.getAttribute('data-theme') element.getAttribute('data-theme')

View File

@@ -24,7 +24,6 @@
"./packages/component/src/components/*/index", "./packages/component/src/components/*/index",
"./packages/component/src/components/*" "./packages/component/src/components/*"
], ],
"@affine/templates/*": ["./packages/templates/src/*"],
"@affine/i18n": ["./packages/i18n/src"], "@affine/i18n": ["./packages/i18n/src"],
"@affine/i18n/hooks": ["./packages/i18n/src/i18n-generated"], "@affine/i18n/hooks": ["./packages/i18n/src/i18n-generated"],
"@affine/debug": ["./packages/debug"], "@affine/debug": ["./packages/debug"],

242
yarn.lock
View File

@@ -64,12 +64,12 @@ __metadata:
"@affine/i18n": "workspace:*" "@affine/i18n": "workspace:*"
"@affine/jotai": "workspace:*" "@affine/jotai": "workspace:*"
"@affine/workspace": "workspace:*" "@affine/workspace": "workspace:*"
"@blocksuite/blocks": 0.0.0-20230601122821-16196c35-nightly "@blocksuite/blocks": 0.0.0-20230606130340-805f430b-nightly
"@blocksuite/editor": 0.0.0-20230601122821-16196c35-nightly "@blocksuite/editor": 0.0.0-20230606130340-805f430b-nightly
"@blocksuite/global": 0.0.0-20230601122821-16196c35-nightly "@blocksuite/global": 0.0.0-20230606130340-805f430b-nightly
"@blocksuite/icons": ^2.1.19 "@blocksuite/icons": ^2.1.19
"@blocksuite/lit": 0.0.0-20230601122821-16196c35-nightly "@blocksuite/lit": 0.0.0-20230606130340-805f430b-nightly
"@blocksuite/store": 0.0.0-20230601122821-16196c35-nightly "@blocksuite/store": 0.0.0-20230606130340-805f430b-nightly
"@dnd-kit/core": ^6.0.8 "@dnd-kit/core": ^6.0.8
"@dnd-kit/sortable": ^7.0.2 "@dnd-kit/sortable": ^7.0.2
"@emotion/cache": ^11.11.0 "@emotion/cache": ^11.11.0
@@ -189,7 +189,7 @@ __metadata:
resolution: "@affine/env@workspace:packages/env" resolution: "@affine/env@workspace:packages/env"
dependencies: dependencies:
"@affine/templates": "workspace:*" "@affine/templates": "workspace:*"
"@blocksuite/global": 0.0.0-20230601122821-16196c35-nightly "@blocksuite/global": 0.0.0-20230606130340-805f430b-nightly
lit: ^2.7.5 lit: ^2.7.5
next: =13.4.2 next: =13.4.2
react: 18.3.0-canary-16d053d59-20230506 react: 18.3.0-canary-16d053d59-20230506
@@ -235,11 +235,11 @@ __metadata:
resolution: "@affine/jotai@workspace:packages/jotai" resolution: "@affine/jotai@workspace:packages/jotai"
dependencies: dependencies:
"@affine/env": "workspace:*" "@affine/env": "workspace:*"
"@blocksuite/blocks": 0.0.0-20230601101714-0d24ba91-nightly "@blocksuite/blocks": 0.0.0-20230606130340-805f430b-nightly
"@blocksuite/editor": 0.0.0-20230601101714-0d24ba91-nightly "@blocksuite/editor": 0.0.0-20230606130340-805f430b-nightly
"@blocksuite/global": 0.0.0-20230601101714-0d24ba91-nightly "@blocksuite/global": 0.0.0-20230606130340-805f430b-nightly
"@blocksuite/lit": 0.0.0-20230601101714-0d24ba91-nightly "@blocksuite/lit": 0.0.0-20230606130340-805f430b-nightly
"@blocksuite/store": 0.0.0-20230601101714-0d24ba91-nightly "@blocksuite/store": 0.0.0-20230606130340-805f430b-nightly
jotai: ^2.1.1 jotai: ^2.1.1
lottie-web: ^5.12.0 lottie-web: ^5.12.0
peerDependencies: peerDependencies:
@@ -368,12 +368,12 @@ __metadata:
"@affine/jotai": "workspace:*" "@affine/jotai": "workspace:*"
"@affine/templates": "workspace:*" "@affine/templates": "workspace:*"
"@affine/workspace": "workspace:*" "@affine/workspace": "workspace:*"
"@blocksuite/blocks": 0.0.0-20230601101714-0d24ba91-nightly "@blocksuite/blocks": 0.0.0-20230606130340-805f430b-nightly
"@blocksuite/editor": 0.0.0-20230601101714-0d24ba91-nightly "@blocksuite/editor": 0.0.0-20230606130340-805f430b-nightly
"@blocksuite/global": 0.0.0-20230601101714-0d24ba91-nightly "@blocksuite/global": 0.0.0-20230606130340-805f430b-nightly
"@blocksuite/icons": ^2.1.19 "@blocksuite/icons": ^2.1.19
"@blocksuite/lit": 0.0.0-20230601101714-0d24ba91-nightly "@blocksuite/lit": 0.0.0-20230606130340-805f430b-nightly
"@blocksuite/store": 0.0.0-20230601101714-0d24ba91-nightly "@blocksuite/store": 0.0.0-20230606130340-805f430b-nightly
"@dnd-kit/core": ^6.0.8 "@dnd-kit/core": ^6.0.8
"@dnd-kit/sortable": ^7.0.2 "@dnd-kit/sortable": ^7.0.2
"@emotion/cache": ^11.11.0 "@emotion/cache": ^11.11.0
@@ -2616,31 +2616,6 @@ __metadata:
languageName: node languageName: node
linkType: hard 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": "@blocksuite/blocks@npm:0.0.0-20230601122821-16196c35-nightly":
version: 0.0.0-20230601122821-16196c35-nightly version: 0.0.0-20230601122821-16196c35-nightly
resolution: "@blocksuite/blocks@npm:0.0.0-20230601122821-16196c35-nightly" resolution: "@blocksuite/blocks@npm:0.0.0-20230601122821-16196c35-nightly"
@@ -2666,10 +2641,28 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"@blocksuite/connector@npm:0.0.0-20230601101714-0d24ba91-nightly": "@blocksuite/blocks@npm:0.0.0-20230606130340-805f430b-nightly":
version: 0.0.0-20230601101714-0d24ba91-nightly version: 0.0.0-20230606130340-805f430b-nightly
resolution: "@blocksuite/connector@npm:0.0.0-20230601101714-0d24ba91-nightly" resolution: "@blocksuite/blocks@npm:0.0.0-20230606130340-805f430b-nightly"
checksum: 277b76c713286c264855bf13138462c5dd0533631c1985a2bb87e8c4a3ca05a27313b41598cc905ed73ea600fa6d6a52462df0cdc17e250e07bdfa74606c9e38 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 languageName: node
linkType: hard linkType: hard
@@ -2680,20 +2673,10 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"@blocksuite/editor@npm:0.0.0-20230601101714-0d24ba91-nightly": "@blocksuite/connector@npm:0.0.0-20230606130340-805f430b-nightly":
version: 0.0.0-20230601101714-0d24ba91-nightly version: 0.0.0-20230606130340-805f430b-nightly
resolution: "@blocksuite/editor@npm:0.0.0-20230601101714-0d24ba91-nightly" resolution: "@blocksuite/connector@npm:0.0.0-20230606130340-805f430b-nightly"
dependencies: checksum: 704695aff71d307e4a1c8ca4df0c4e91f0b6bb3bfe080e192469ed8f3a6ac22c7fb2987331ec444ceaf3a3dd0bca48d515a2d0ec5b6c2e3670033d8c2c07fa06
"@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
languageName: node languageName: node
linkType: hard linkType: hard
@@ -2714,18 +2697,20 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"@blocksuite/global@npm:0.0.0-20230601101714-0d24ba91-nightly": "@blocksuite/editor@npm:0.0.0-20230606130340-805f430b-nightly":
version: 0.0.0-20230601101714-0d24ba91-nightly version: 0.0.0-20230606130340-805f430b-nightly
resolution: "@blocksuite/global@npm:0.0.0-20230601101714-0d24ba91-nightly" resolution: "@blocksuite/editor@npm:0.0.0-20230606130340-805f430b-nightly"
dependencies: dependencies:
ansi-colors: ^4.1.3 "@blocksuite/global": 0.0.0-20230606130340-805f430b-nightly
zod: ^3.21.4 "@toeverything/theme": 0.0.0-20230530064828-8cd3bf6
lit: ^2.7.3
marked: ^4.2.12
turndown: ^7.1.1
peerDependencies: peerDependencies:
lit: ^2.7 "@blocksuite/blocks": 0.0.0-20230606130340-805f430b-nightly
peerDependenciesMeta: "@blocksuite/lit": 0.0.0-20230606130340-805f430b-nightly
lit: "@blocksuite/store": 0.0.0-20230606130340-805f430b-nightly
optional: true checksum: f506a2b932b88d8115303efd598a35cef5375910a462e550c1b4754ebadef22cb54c6165e9e756cdc3055290a5f2aeb55226fc5372c7f6fa737614e3f6704239
checksum: f6f4ff778293ea02cb553544c0445c46d09b4483d698aafed59aea1c4da76747d9241c7793a88458da1d189196c9b07ade6b6fbdfd1706d63afc8d5797b3f32b
languageName: node languageName: node
linkType: hard linkType: hard
@@ -2744,6 +2729,21 @@ __metadata:
languageName: node languageName: node
linkType: hard 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": "@blocksuite/icons@npm:^2.1.19":
version: 2.1.19 version: 2.1.19
resolution: "@blocksuite/icons@npm:2.1.19" resolution: "@blocksuite/icons@npm:2.1.19"
@@ -2754,18 +2754,6 @@ __metadata:
languageName: node languageName: node
linkType: hard 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": "@blocksuite/lit@npm:0.0.0-20230601122821-16196c35-nightly":
version: 0.0.0-20230601122821-16196c35-nightly version: 0.0.0-20230601122821-16196c35-nightly
resolution: "@blocksuite/lit@npm:0.0.0-20230601122821-16196c35-nightly" resolution: "@blocksuite/lit@npm:0.0.0-20230601122821-16196c35-nightly"
@@ -2778,17 +2766,15 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"@blocksuite/phasor@npm:0.0.0-20230601101714-0d24ba91-nightly": "@blocksuite/lit@npm:0.0.0-20230606130340-805f430b-nightly":
version: 0.0.0-20230601101714-0d24ba91-nightly version: 0.0.0-20230606130340-805f430b-nightly
resolution: "@blocksuite/phasor@npm:0.0.0-20230601101714-0d24ba91-nightly" resolution: "@blocksuite/lit@npm:0.0.0-20230606130340-805f430b-nightly"
dependencies: dependencies:
"@blocksuite/global": 0.0.0-20230601101714-0d24ba91-nightly "@blocksuite/global": 0.0.0-20230606130340-805f430b-nightly
fractional-indexing: ^3.2.0 lit: ^2.7.3
roughjs: ^4.5.2
peerDependencies: peerDependencies:
nanoid: ^4 "@blocksuite/store": 0.0.0-20230606130340-805f430b-nightly
yjs: ^13 checksum: 167c53dca2e00b8f091f47830000983f0fd8cae5af941c938735446490f0e7b9759e7366be84c6f5ccd502029caaad555b5af705338981ec93fc874e4da3b0dc
checksum: bfda9f99c8a6070f59a961235ca645640eaefaf208228c975d2a0fe8525178dc7baa69693bce9fb37406c9ccbca2e3721820d923f813c8f94875adc7aad33e7f
languageName: node languageName: node
linkType: hard linkType: hard
@@ -2806,27 +2792,17 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"@blocksuite/store@npm:0.0.0-20230601101714-0d24ba91-nightly": "@blocksuite/phasor@npm:0.0.0-20230606130340-805f430b-nightly":
version: 0.0.0-20230601101714-0d24ba91-nightly version: 0.0.0-20230606130340-805f430b-nightly
resolution: "@blocksuite/store@npm:0.0.0-20230601101714-0d24ba91-nightly" resolution: "@blocksuite/phasor@npm:0.0.0-20230606130340-805f430b-nightly"
dependencies: dependencies:
"@blocksuite/global": 0.0.0-20230601101714-0d24ba91-nightly "@blocksuite/global": 0.0.0-20230606130340-805f430b-nightly
"@blocksuite/virgo": 0.0.0-20230601101714-0d24ba91-nightly fractional-indexing: ^3.2.0
"@types/flexsearch": ^0.7.3 roughjs: ^4.5.2
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: peerDependencies:
nanoid: ^4
yjs: ^13 yjs: ^13
checksum: 8375f3924f4bd2a2ee59c461d2dcc3b543da322182a01450699d62e19a244f277a67e523019bdc450fae436bd32493f5524d4d95d3a8ffc2376d42d39c5cf47f checksum: c4280e5aaec0b5f94728717c4c857bf14184c9f575bb78a56dbd18ed4b83a33c6d9b76f1513a740dd4d3188c7bfad3fdc286ff7192f81be750dc14bfdba02657
languageName: node languageName: node
linkType: hard linkType: hard
@@ -2854,16 +2830,27 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"@blocksuite/virgo@npm:0.0.0-20230601101714-0d24ba91-nightly": "@blocksuite/store@npm:0.0.0-20230606130340-805f430b-nightly":
version: 0.0.0-20230601101714-0d24ba91-nightly version: 0.0.0-20230606130340-805f430b-nightly
resolution: "@blocksuite/virgo@npm:0.0.0-20230601101714-0d24ba91-nightly" resolution: "@blocksuite/store@npm:0.0.0-20230606130340-805f430b-nightly"
dependencies: 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 zod: ^3.21.4
peerDependencies: peerDependencies:
lit: ^2.7
yjs: ^13 yjs: ^13
checksum: 4751fc567378360043e7bb80a1f1ddce69cf9d426f42237eeca3cd2aeaef48289e921548e60ce5c4090ad844a51917e23b7e7b5de1925cb8c15e19695f0f5436 checksum: 2a7dd01b8e0793242fdac06c95d3982a7270296f6f03fce00d3e86f6a312ce583d20eff632312a05cd7749d18e947f184967a075c97384af5c3354430c1c4d7e
languageName: node languageName: node
linkType: hard linkType: hard
@@ -2880,6 +2867,19 @@ __metadata:
languageName: node languageName: node
linkType: hard 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": "@clack/core@npm:^0.3.2":
version: 0.3.2 version: 0.3.2
resolution: "@clack/core@npm:0.3.2" resolution: "@clack/core@npm:0.3.2"
@@ -9212,11 +9212,11 @@ __metadata:
"@affine/component": "workspace:*" "@affine/component": "workspace:*"
"@affine/env": "workspace:*" "@affine/env": "workspace:*"
"@affine/workspace": "workspace:*" "@affine/workspace": "workspace:*"
"@blocksuite/blocks": 0.0.0-20230601101714-0d24ba91-nightly "@blocksuite/blocks": 0.0.0-20230606130340-805f430b-nightly
"@blocksuite/editor": 0.0.0-20230601101714-0d24ba91-nightly "@blocksuite/editor": 0.0.0-20230606130340-805f430b-nightly
"@blocksuite/global": 0.0.0-20230601101714-0d24ba91-nightly "@blocksuite/global": 0.0.0-20230606130340-805f430b-nightly
"@blocksuite/lit": 0.0.0-20230601101714-0d24ba91-nightly "@blocksuite/lit": 0.0.0-20230606130340-805f430b-nightly
"@blocksuite/store": 0.0.0-20230601101714-0d24ba91-nightly "@blocksuite/store": 0.0.0-20230606130340-805f430b-nightly
jotai: ^2.1.1 jotai: ^2.1.1
peerDependencies: peerDependencies:
"@blocksuite/blocks": "*" "@blocksuite/blocks": "*"
@@ -9248,8 +9248,8 @@ __metadata:
version: 0.0.0-use.local version: 0.0.0-use.local
resolution: "@toeverything/y-indexeddb@workspace:packages/y-indexeddb" resolution: "@toeverything/y-indexeddb@workspace:packages/y-indexeddb"
dependencies: dependencies:
"@blocksuite/blocks": 0.0.0-20230601101714-0d24ba91-nightly "@blocksuite/blocks": 0.0.0-20230606130340-805f430b-nightly
"@blocksuite/store": 0.0.0-20230601101714-0d24ba91-nightly "@blocksuite/store": 0.0.0-20230606130340-805f430b-nightly
idb: ^7.1.1 idb: ^7.1.1
vite: ^4.3.9 vite: ^4.3.9
vite-plugin-dts: ^2.3.0 vite-plugin-dts: ^2.3.0