mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-02 18:09:58 +08:00
chore: bump version (#1618)
This commit is contained in:
@@ -14,15 +14,15 @@
|
|||||||
"build:app": "tauri build"
|
"build:app": "tauri build"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@blocksuite/blocks": "0.5.0-20230317014705-a881b9c",
|
"@blocksuite/blocks": "0.5.0-20230320034723-8dfc65e",
|
||||||
"@blocksuite/editor": "0.5.0-20230317014705-a881b9c",
|
"@blocksuite/editor": "0.5.0-20230320034723-8dfc65e",
|
||||||
"@blocksuite/icons": "2.0.17",
|
"@blocksuite/icons": "2.0.17",
|
||||||
"@blocksuite/store": "0.5.0-20230317014705-a881b9c",
|
"@blocksuite/store": "0.5.0-20230320034723-8dfc65e",
|
||||||
"@emotion/react": "^11.10.6",
|
"@emotion/react": "^11.10.6",
|
||||||
"@emotion/styled": "^11.10.6",
|
"@emotion/styled": "^11.10.6",
|
||||||
"@tauri-apps/api": "^1.2.0",
|
"@tauri-apps/api": "^1.2.0",
|
||||||
"json-schema-to-typescript": "^11.0.5",
|
"json-schema-to-typescript": "^11.0.5",
|
||||||
"lib0": "^0.2.68",
|
"lib0": "^0.2.69",
|
||||||
"next": "=13.2.3",
|
"next": "=13.2.3",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"react-dom": "^18.2.0",
|
"react-dom": "^18.2.0",
|
||||||
|
|||||||
@@ -14,11 +14,11 @@
|
|||||||
"@affine/debug": "workspace:*",
|
"@affine/debug": "workspace:*",
|
||||||
"@affine/env": "workspace:*",
|
"@affine/env": "workspace:*",
|
||||||
"@affine/i18n": "workspace:*",
|
"@affine/i18n": "workspace:*",
|
||||||
"@blocksuite/blocks": "0.5.0-20230317014705-a881b9c",
|
"@blocksuite/blocks": "0.5.0-20230320034723-8dfc65e",
|
||||||
"@blocksuite/editor": "0.5.0-20230317014705-a881b9c",
|
"@blocksuite/editor": "0.5.0-20230320034723-8dfc65e",
|
||||||
"@blocksuite/icons": "2.0.23",
|
"@blocksuite/icons": "2.0.23",
|
||||||
"@blocksuite/react": "0.5.0-20230317014705-a881b9c",
|
"@blocksuite/react": "0.5.0-20230320034723-8dfc65e",
|
||||||
"@blocksuite/store": "0.5.0-20230317014705-a881b9c",
|
"@blocksuite/store": "0.5.0-20230320034723-8dfc65e",
|
||||||
"@emotion/cache": "^11.10.5",
|
"@emotion/cache": "^11.10.5",
|
||||||
"@emotion/react": "^11.10.6",
|
"@emotion/react": "^11.10.6",
|
||||||
"@emotion/server": "^11.10.0",
|
"@emotion/server": "^11.10.0",
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
'use client';
|
'use client';
|
||||||
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 { assertEquals, assertExists, Generator } from '@blocksuite/store';
|
import { Generator } from '@blocksuite/store';
|
||||||
import type React from 'react';
|
import type React from 'react';
|
||||||
import { useCallback, useEffect, useRef, useState } from 'react';
|
import { useCallback, useRef } from 'react';
|
||||||
|
|
||||||
import { createEmptyBlockSuiteWorkspace } from '../../../utils';
|
import { createEmptyBlockSuiteWorkspace } from '../../../utils';
|
||||||
import { BlockSuiteEditor } from '../../blocksuite/block-suite-editor';
|
import { BlockSuiteEditor } from '../../blocksuite/block-suite-editor';
|
||||||
@@ -14,41 +14,21 @@ const blockSuiteWorkspace = createEmptyBlockSuiteWorkspace(
|
|||||||
Generator.AutoIncrement
|
Generator.AutoIncrement
|
||||||
);
|
);
|
||||||
|
|
||||||
blockSuiteWorkspace.createPage('page0');
|
const page = blockSuiteWorkspace.createPage('page0');
|
||||||
|
|
||||||
const Editor: React.FC<{
|
const Editor: React.FC<{
|
||||||
onInit: (page: Page, editor: Readonly<EditorContainer>) => void;
|
onInit: (page: Page, editor: Readonly<EditorContainer>) => void;
|
||||||
testType: 'empty' | 'importMarkdown';
|
testType: 'empty' | 'importMarkdown';
|
||||||
}> = ({ onInit, testType }) => {
|
}> = ({ onInit, testType }) => {
|
||||||
const page = blockSuiteWorkspace.getPage('page0');
|
|
||||||
const [, rerender] = useState(false);
|
|
||||||
const onceRef = useRef(false);
|
const onceRef = useRef(false);
|
||||||
if (!onceRef.current) {
|
if (!onceRef.current) {
|
||||||
if (testType === 'importMarkdown') {
|
if (testType === 'importMarkdown') {
|
||||||
if (page) {
|
page.workspace.meta.setPageMeta(page.id, {
|
||||||
page.workspace.meta.setPageMeta(page.id, {
|
init: true,
|
||||||
init: true,
|
});
|
||||||
});
|
|
||||||
} else {
|
|
||||||
blockSuiteWorkspace.slots.pageAdded.on(id => {
|
|
||||||
const page = blockSuiteWorkspace.getPage(id);
|
|
||||||
assertExists(page);
|
|
||||||
assertEquals(id, 'page0');
|
|
||||||
page.workspace.meta.setPageMeta(page.id, {
|
|
||||||
init: true,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
const cb = () => rerender(v => !v);
|
|
||||||
const dispose = blockSuiteWorkspace.slots.pageAdded.on(cb);
|
|
||||||
return () => {
|
|
||||||
dispose.dispose();
|
|
||||||
};
|
|
||||||
}, []);
|
|
||||||
const onLoad = useCallback((page: Page, editor: EditorContainer) => {
|
const onLoad = useCallback((page: Page, editor: EditorContainer) => {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
globalThis.page = page;
|
globalThis.page = page;
|
||||||
|
|||||||
@@ -5,7 +5,8 @@ import 'fake-indexeddb/auto';
|
|||||||
|
|
||||||
import assert from 'node:assert';
|
import assert from 'node:assert';
|
||||||
|
|
||||||
import { __unstableSchemas, builtInSchemas } from '@blocksuite/blocks/models';
|
import { __unstableSchemas, AffineSchemas } from '@blocksuite/blocks/models';
|
||||||
|
import type { Page } from '@blocksuite/store';
|
||||||
import { assertExists } from '@blocksuite/store';
|
import { assertExists } from '@blocksuite/store';
|
||||||
import { render, renderHook } from '@testing-library/react';
|
import { render, renderHook } from '@testing-library/react';
|
||||||
import { createStore, Provider } from 'jotai';
|
import { createStore, Provider } from 'jotai';
|
||||||
@@ -74,29 +75,21 @@ async function getJotaiContext() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
return new Promise<void>(resolve => {
|
blockSuiteWorkspace = new BlockSuiteWorkspace({ id: 'test' })
|
||||||
blockSuiteWorkspace = new BlockSuiteWorkspace({ id: 'test' })
|
.register(AffineSchemas)
|
||||||
.register(builtInSchemas)
|
.register(__unstableSchemas);
|
||||||
.register(__unstableSchemas);
|
const initPage = (page: Page) => {
|
||||||
blockSuiteWorkspace.slots.pageAdded.on(pageId => {
|
expect(page).not.toBeNull();
|
||||||
setTimeout(() => {
|
assertExists(page);
|
||||||
const page = blockSuiteWorkspace.getPage(pageId);
|
const pageBlockId = page.addBlock('affine:page', {
|
||||||
expect(page).not.toBeNull();
|
title: new page.Text(''),
|
||||||
assertExists(page);
|
|
||||||
const pageBlockId = page.addBlockByFlavour('affine:page', {
|
|
||||||
title: new page.Text(''),
|
|
||||||
});
|
|
||||||
const frameId = page.addBlockByFlavour('affine:frame', {}, pageBlockId);
|
|
||||||
page.addBlockByFlavour('affine:paragraph', {}, frameId);
|
|
||||||
if (pageId === 'page2') {
|
|
||||||
resolve();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
blockSuiteWorkspace.createPage('page0');
|
const frameId = page.addBlock('affine:frame', {}, pageBlockId);
|
||||||
blockSuiteWorkspace.createPage('page1');
|
page.addBlock('affine:paragraph', {}, frameId);
|
||||||
blockSuiteWorkspace.createPage('page2');
|
};
|
||||||
});
|
initPage(blockSuiteWorkspace.createPage('page0'));
|
||||||
|
initPage(blockSuiteWorkspace.createPage('page1'));
|
||||||
|
initPage(blockSuiteWorkspace.createPage('page2'));
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('usePageMetas', async () => {
|
describe('usePageMetas', async () => {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
*/
|
*/
|
||||||
import 'fake-indexeddb/auto';
|
import 'fake-indexeddb/auto';
|
||||||
|
|
||||||
import { __unstableSchemas, builtInSchemas } from '@blocksuite/blocks/models';
|
import { __unstableSchemas, AffineSchemas } from '@blocksuite/blocks/models';
|
||||||
import type { Page } from '@blocksuite/store';
|
import type { Page } from '@blocksuite/store';
|
||||||
import { renderHook } from '@testing-library/react';
|
import { renderHook } from '@testing-library/react';
|
||||||
import { beforeEach, describe, expect, test, vi } from 'vitest';
|
import { beforeEach, describe, expect, test, vi } from 'vitest';
|
||||||
@@ -18,13 +18,13 @@ beforeEach(() => {
|
|||||||
blockSuiteWorkspace = new BlockSuiteWorkspace({
|
blockSuiteWorkspace = new BlockSuiteWorkspace({
|
||||||
id: 'test',
|
id: 'test',
|
||||||
})
|
})
|
||||||
.register(builtInSchemas)
|
.register(AffineSchemas)
|
||||||
.register(__unstableSchemas);
|
.register(__unstableSchemas);
|
||||||
blockSuiteWorkspace.slots.pageAdded.on(pageId => {
|
blockSuiteWorkspace.slots.pageAdded.on(pageId => {
|
||||||
const page = blockSuiteWorkspace.getPage(pageId) as Page;
|
const page = blockSuiteWorkspace.getPage(pageId) as Page;
|
||||||
const pageBlockId = page.addBlockByFlavour('affine:page', { title: '' });
|
const pageBlockId = page.addBlock('affine:page', { title: '' });
|
||||||
const frameId = page.addBlockByFlavour('affine:frame', {}, pageBlockId);
|
const frameId = page.addBlock('affine:frame', {}, pageBlockId);
|
||||||
page.addBlockByFlavour('affine:paragraph', {}, frameId);
|
page.addBlock('affine:paragraph', {}, frameId);
|
||||||
});
|
});
|
||||||
blockSuiteWorkspace.createPage('page0');
|
blockSuiteWorkspace.createPage('page0');
|
||||||
blockSuiteWorkspace.createPage('page1');
|
blockSuiteWorkspace.createPage('page1');
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ export function useBlockSuiteWorkspacePageTitle(
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const page = blockSuiteWorkspace.getPage(pageId);
|
const page = blockSuiteWorkspace.getPage(pageId);
|
||||||
setTitle(page?.meta.title || 'AFFiNE');
|
setTitle(page?.meta.title || 'AFFiNE');
|
||||||
const dispose = blockSuiteWorkspace.meta.pagesUpdated.on(() => {
|
const dispose = blockSuiteWorkspace.meta.pageMetasUpdated.on(() => {
|
||||||
const page = blockSuiteWorkspace.getPage(pageId);
|
const page = blockSuiteWorkspace.getPage(pageId);
|
||||||
assertExists(page);
|
assertExists(page);
|
||||||
setTitle(page?.meta.title || 'AFFiNE');
|
setTitle(page?.meta.title || 'AFFiNE');
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ export function usePageMeta(
|
|||||||
}
|
}
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (blockSuiteWorkspace) {
|
if (blockSuiteWorkspace) {
|
||||||
const dispose = blockSuiteWorkspace.meta.pagesUpdated.on(() => {
|
const dispose = blockSuiteWorkspace.meta.pageMetasUpdated.on(() => {
|
||||||
setPageMeta(blockSuiteWorkspace.meta.pageMetas);
|
setPageMeta(blockSuiteWorkspace.meta.pageMetas);
|
||||||
});
|
});
|
||||||
return () => {
|
return () => {
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { ContentParser } from '@blocksuite/blocks/content-parser';
|
||||||
import type {
|
import type {
|
||||||
GetStaticPaths,
|
GetStaticPaths,
|
||||||
GetStaticProps,
|
GetStaticProps,
|
||||||
@@ -61,22 +62,16 @@ const PreviewPage: NextPage<PreviewPageProps> = ({
|
|||||||
pageId="preview"
|
pageId="preview"
|
||||||
onInit={(page, editor) => {
|
onInit={(page, editor) => {
|
||||||
blockSuiteWorkspace.setPageMeta(page.id, { title });
|
blockSuiteWorkspace.setPageMeta(page.id, { title });
|
||||||
const pageBlockId = page.addBlockByFlavour('affine:page', {
|
const pageBlockId = page.addBlock('affine:page', {
|
||||||
title: new page.Text(title),
|
title: new page.Text(title),
|
||||||
});
|
});
|
||||||
page.addBlockByFlavour('affine:surface', {}, null);
|
page.addBlock('affine:surface', {}, null);
|
||||||
const frameId = page.addBlockByFlavour(
|
const frameId = page.addBlock('affine:frame', {}, pageBlockId);
|
||||||
'affine:frame',
|
page.addBlock('affine:paragraph', {}, frameId);
|
||||||
{},
|
const contentParser = new ContentParser(page);
|
||||||
pageBlockId
|
contentParser.importMarkdown(text, frameId).then(() => {
|
||||||
);
|
page.resetHistory();
|
||||||
page.addBlockByFlavour('affine:paragraph', {}, frameId);
|
});
|
||||||
setTimeout(() => {
|
|
||||||
// hotfix: contentParser.importMarkdown is not working in the first render
|
|
||||||
editor.contentParser.importMarkdown(text, frameId).then(() => {
|
|
||||||
page.resetHistory();
|
|
||||||
});
|
|
||||||
}, 0);
|
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<StyledToolWrapper>
|
<StyledToolWrapper>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { useTranslation } from '@affine/i18n';
|
import { useTranslation } from '@affine/i18n';
|
||||||
import { FolderIcon } from '@blocksuite/icons';
|
import { FolderIcon } from '@blocksuite/icons';
|
||||||
import { assertExists, nanoid } from '@blocksuite/store';
|
import { assertEquals, assertExists, nanoid } from '@blocksuite/store';
|
||||||
import Head from 'next/head';
|
import Head from 'next/head';
|
||||||
import { useRouter } from 'next/router';
|
import { useRouter } from 'next/router';
|
||||||
import React, { useCallback, useEffect } from 'react';
|
import React, { useCallback, useEffect } from 'react';
|
||||||
@@ -44,14 +44,12 @@ const AllPage: NextPageWithLayout = () => {
|
|||||||
if (currentWorkspace.blockSuiteWorkspace.isEmpty) {
|
if (currentWorkspace.blockSuiteWorkspace.isEmpty) {
|
||||||
// this is a new workspace, so we should redirect to the new page
|
// this is a new workspace, so we should redirect to the new page
|
||||||
const pageId = nanoid();
|
const pageId = nanoid();
|
||||||
currentWorkspace.blockSuiteWorkspace.slots.pageAdded.once(id => {
|
const page = currentWorkspace.blockSuiteWorkspace.createPage(pageId);
|
||||||
currentWorkspace.blockSuiteWorkspace.setPageMeta(id, {
|
assertEquals(page.id, pageId);
|
||||||
init: true,
|
currentWorkspace.blockSuiteWorkspace.setPageMeta(page.id, {
|
||||||
});
|
init: true,
|
||||||
assertExists(pageId, id);
|
|
||||||
jumpToPage(currentWorkspace.id, pageId);
|
|
||||||
});
|
});
|
||||||
currentWorkspace.blockSuiteWorkspace.createPage(pageId);
|
jumpToPage(currentWorkspace.id, pageId);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
provider.callbacks.add(callback);
|
provider.callbacks.add(callback);
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { DebugLogger } from '@affine/debug';
|
import { DebugLogger } from '@affine/debug';
|
||||||
import markdown from '@affine/templates/Welcome-to-AFFiNE.md';
|
import markdown from '@affine/templates/Welcome-to-AFFiNE.md';
|
||||||
|
import { ContentParser } from '@blocksuite/blocks/content-parser';
|
||||||
import type { EditorContainer } from '@blocksuite/editor';
|
import type { EditorContainer } from '@blocksuite/editor';
|
||||||
import type { Page } from '@blocksuite/store';
|
import type { Page } from '@blocksuite/store';
|
||||||
|
|
||||||
@@ -30,12 +31,12 @@ export function initPage(page: Page, editor: Readonly<EditorContainer>): void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function _initEmptyPage(page: Page, _: Readonly<EditorContainer>) {
|
export function _initEmptyPage(page: Page, _: Readonly<EditorContainer>) {
|
||||||
const pageBlockId = page.addBlockByFlavour('affine:page', {
|
const pageBlockId = page.addBlock('affine:page', {
|
||||||
title: new page.Text(''),
|
title: new page.Text(''),
|
||||||
});
|
});
|
||||||
page.addBlockByFlavour('affine:surface', {}, null);
|
page.addBlock('affine:surface', {}, null);
|
||||||
const frameId = page.addBlockByFlavour('affine:frame', {}, pageBlockId);
|
const frameId = page.addBlock('affine:frame', {}, pageBlockId);
|
||||||
page.addBlockByFlavour('affine:paragraph', {}, frameId);
|
page.addBlock('affine:paragraph', {}, frameId);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function _initPageWithDemoMarkdown(
|
export function _initPageWithDemoMarkdown(
|
||||||
@@ -43,15 +44,13 @@ export function _initPageWithDemoMarkdown(
|
|||||||
editor: Readonly<EditorContainer>
|
editor: Readonly<EditorContainer>
|
||||||
): void {
|
): void {
|
||||||
logger.debug('initPageWithDefaultMarkdown', page.id);
|
logger.debug('initPageWithDefaultMarkdown', page.id);
|
||||||
const pageBlockId = page.addBlockByFlavour('affine:page', {
|
const pageBlockId = page.addBlock('affine:page', {
|
||||||
title: new page.Text(demoTitle),
|
title: new page.Text(demoTitle),
|
||||||
});
|
});
|
||||||
page.addBlockByFlavour('affine:surface', {}, null);
|
page.addBlock('affine:surface', {}, null);
|
||||||
const frameId = page.addBlockByFlavour('affine:frame', {}, pageBlockId);
|
const frameId = page.addBlock('affine:frame', {}, pageBlockId);
|
||||||
page.addBlockByFlavour('affine:paragraph', {}, frameId);
|
page.addBlock('affine:paragraph', {}, frameId);
|
||||||
setTimeout(() => {
|
const contentParser = new ContentParser(page);
|
||||||
// hotfix: contentParser.importMarkdown is not working in the first render
|
contentParser.importMarkdown(demoText, frameId);
|
||||||
editor.contentParser.importMarkdown(demoText, frameId);
|
|
||||||
}, 0);
|
|
||||||
page.workspace.setPageMeta(page.id, { demoTitle });
|
page.workspace.setPageMeta(page.id, { demoTitle });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { __unstableSchemas, builtInSchemas } from '@blocksuite/blocks/models';
|
import { __unstableSchemas, AffineSchemas } from '@blocksuite/blocks/models';
|
||||||
import type { BlobOptionsGetter, Generator } from '@blocksuite/store';
|
import type { BlobOptionsGetter, Generator } from '@blocksuite/store';
|
||||||
|
|
||||||
import { BlockSuiteWorkspace } from '../shared';
|
import { BlockSuiteWorkspace } from '../shared';
|
||||||
@@ -39,7 +39,7 @@ export const createEmptyBlockSuiteWorkspace = (
|
|||||||
blobOptionsGetter,
|
blobOptionsGetter,
|
||||||
idGenerator,
|
idGenerator,
|
||||||
})
|
})
|
||||||
.register(builtInSchemas)
|
.register(AffineSchemas)
|
||||||
.register(__unstableSchemas);
|
.register(__unstableSchemas);
|
||||||
hashMap.set(id, workspace);
|
hashMap.set(id, workspace);
|
||||||
return workspace;
|
return workspace;
|
||||||
|
|||||||
+1
-1
@@ -33,7 +33,7 @@
|
|||||||
"@perfsee/sdk": "^1.5.1",
|
"@perfsee/sdk": "^1.5.1",
|
||||||
"@playwright/test": "^1.31.2",
|
"@playwright/test": "^1.31.2",
|
||||||
"@testing-library/react": "^14.0.0",
|
"@testing-library/react": "^14.0.0",
|
||||||
"@types/eslint": "^8.21.2",
|
"@types/eslint": "^8.21.3",
|
||||||
"@types/node": "^18.15.3",
|
"@types/node": "^18.15.3",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.55.0",
|
"@typescript-eslint/eslint-plugin": "^5.55.0",
|
||||||
"@typescript-eslint/parser": "^5.55.0",
|
"@typescript-eslint/parser": "^5.55.0",
|
||||||
|
|||||||
@@ -15,12 +15,12 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@affine/debug": "workspace:*",
|
"@affine/debug": "workspace:*",
|
||||||
"@affine/i18n": "workspace:*",
|
"@affine/i18n": "workspace:*",
|
||||||
"@blocksuite/blocks": "0.5.0-20230317014705-a881b9c",
|
"@blocksuite/blocks": "0.5.0-20230320034723-8dfc65e",
|
||||||
"@blocksuite/editor": "0.5.0-20230317014705-a881b9c",
|
"@blocksuite/editor": "0.5.0-20230320034723-8dfc65e",
|
||||||
"@blocksuite/global": "0.5.0-20230317014705-a881b9c",
|
"@blocksuite/global": "0.5.0-20230320034723-8dfc65e",
|
||||||
"@blocksuite/icons": "2.0.23",
|
"@blocksuite/icons": "2.0.23",
|
||||||
"@blocksuite/react": "0.5.0-20230317014705-a881b9c",
|
"@blocksuite/react": "0.5.0-20230320034723-8dfc65e",
|
||||||
"@blocksuite/store": "0.5.0-20230317014705-a881b9c",
|
"@blocksuite/store": "0.5.0-20230320034723-8dfc65e",
|
||||||
"@emotion/cache": "^11.10.5",
|
"@emotion/cache": "^11.10.5",
|
||||||
"@emotion/react": "^11.10.6",
|
"@emotion/react": "^11.10.6",
|
||||||
"@emotion/server": "^11.10.0",
|
"@emotion/server": "^11.10.0",
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* deepscan-disable USELESS_ARROW_FUNC_BIND */
|
/* deepscan-disable USELESS_ARROW_FUNC_BIND */
|
||||||
import { __unstableSchemas, builtInSchemas } from '@blocksuite/blocks/models';
|
import { __unstableSchemas, AffineSchemas } from '@blocksuite/blocks/models';
|
||||||
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 { Workspace } from '@blocksuite/store';
|
import { Workspace } from '@blocksuite/store';
|
||||||
@@ -12,12 +12,12 @@ import { BlockSuiteEditor } from '.';
|
|||||||
|
|
||||||
function initPage(page: Page, editor: Readonly<EditorContainer>): void {
|
function initPage(page: Page, editor: Readonly<EditorContainer>): void {
|
||||||
// Add page block and surface block at root level
|
// Add page block and surface block at root level
|
||||||
const pageBlockId = page.addBlockByFlavour('affine:page', {
|
const pageBlockId = page.addBlock('affine:page', {
|
||||||
title: new page.Text(''),
|
title: new page.Text(''),
|
||||||
});
|
});
|
||||||
page.addBlockByFlavour('affine:surface', {}, null);
|
page.addBlock('affine:surface', {}, null);
|
||||||
const frameId = page.addBlockByFlavour('affine:frame', {}, pageBlockId);
|
const frameId = page.addBlock('affine:frame', {}, pageBlockId);
|
||||||
page.addBlockByFlavour('affine:paragraph', {}, frameId);
|
page.addBlock('affine:paragraph', {}, frameId);
|
||||||
page.resetHistory();
|
page.resetHistory();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -25,7 +25,7 @@ const blockSuiteWorkspace = new Workspace({
|
|||||||
id: 'test',
|
id: 'test',
|
||||||
blobOptionsGetter: () => void 0,
|
blobOptionsGetter: () => void 0,
|
||||||
});
|
});
|
||||||
blockSuiteWorkspace.register(builtInSchemas).register(__unstableSchemas);
|
blockSuiteWorkspace.register(AffineSchemas).register(__unstableSchemas);
|
||||||
const promise = new Promise<void>(resolve => {
|
const promise = new Promise<void>(resolve => {
|
||||||
blockSuiteWorkspace.slots.pageAdded.once(() => {
|
blockSuiteWorkspace.slots.pageAdded.once(() => {
|
||||||
resolve();
|
resolve();
|
||||||
|
|||||||
@@ -14,8 +14,8 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@affine/debug": "workspace:*",
|
"@affine/debug": "workspace:*",
|
||||||
"@blocksuite/blocks": "0.5.0-20230317014705-a881b9c",
|
"@blocksuite/blocks": "0.5.0-20230320034723-8dfc65e",
|
||||||
"@blocksuite/store": "0.5.0-20230317014705-a881b9c",
|
"@blocksuite/store": "0.5.0-20230320034723-8dfc65e",
|
||||||
"@tauri-apps/api": "^1.2.0",
|
"@tauri-apps/api": "^1.2.0",
|
||||||
"encoding": "^0.1.13",
|
"encoding": "^0.1.13",
|
||||||
"firebase": "^9.18.0",
|
"firebase": "^9.18.0",
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
"js-base64": "^3.7.5",
|
"js-base64": "^3.7.5",
|
||||||
"ky": "^0.33.3",
|
"ky": "^0.33.3",
|
||||||
"ky-universal": "^0.11.0",
|
"ky-universal": "^0.11.0",
|
||||||
"lib0": "^0.2.68",
|
"lib0": "^0.2.69",
|
||||||
"lit": "^2.6.1",
|
"lit": "^2.6.1",
|
||||||
"y-protocols": "^1.0.5",
|
"y-protocols": "^1.0.5",
|
||||||
"yjs": "^13.5.50"
|
"yjs": "^13.5.50"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { __unstableSchemas, builtInSchemas } from '@blocksuite/blocks/models';
|
import { __unstableSchemas, AffineSchemas } from '@blocksuite/blocks/models';
|
||||||
import type { StoreOptions } from '@blocksuite/store';
|
import type { StoreOptions } from '@blocksuite/store';
|
||||||
import { Workspace as BlocksuiteWorkspace } from '@blocksuite/store';
|
import { Workspace as BlocksuiteWorkspace } from '@blocksuite/store';
|
||||||
|
|
||||||
@@ -8,7 +8,7 @@ export const createBlocksuiteWorkspace = (options: StoreOptions) => {
|
|||||||
isSSR: typeof window === 'undefined',
|
isSSR: typeof window === 'undefined',
|
||||||
...options,
|
...options,
|
||||||
})
|
})
|
||||||
.register(builtInSchemas)
|
.register(AffineSchemas)
|
||||||
.register(__unstableSchemas);
|
.register(__unstableSchemas);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Vendored
+1
-1
@@ -9,7 +9,7 @@
|
|||||||
"zod": "^3.21.3"
|
"zod": "^3.21.3"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@blocksuite/global": "0.5.0-20230317014705-a881b9c",
|
"@blocksuite/global": "0.5.0-20230320034723-8dfc65e",
|
||||||
"lit": "^2.6.1"
|
"lit": "^2.6.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@affine/debug": "workspace:*",
|
"@affine/debug": "workspace:*",
|
||||||
"i18next": "^22.4.11",
|
"i18next": "^22.4.12",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"react-i18next": "^12.2.0"
|
"react-i18next": "^12.2.0"
|
||||||
},
|
},
|
||||||
|
|||||||
Generated
+114
-713
File diff suppressed because it is too large
Load Diff
@@ -99,7 +99,7 @@ test.describe('Search and select', () => {
|
|||||||
await openQuickSearchByShortcut(page);
|
await openQuickSearchByShortcut(page);
|
||||||
await page.keyboard.insertText('test123456');
|
await page.keyboard.insertText('test123456');
|
||||||
await page.waitForTimeout(50);
|
await page.waitForTimeout(50);
|
||||||
await assertResultList(page, ['test123456']);
|
await assertResultList(page, ["New 'test123456' page"]);
|
||||||
await page.keyboard.press('Enter');
|
await page.keyboard.press('Enter');
|
||||||
await page.waitForTimeout(300);
|
await page.waitForTimeout(300);
|
||||||
await assertTitle(page, 'test123456');
|
await assertTitle(page, 'test123456');
|
||||||
|
|||||||
Reference in New Issue
Block a user