fix: title behavior on BlockSuite editor (#1264)

This commit is contained in:
Himself65 2023-03-02 11:38:17 -06:00 committed by GitHub
parent 32a1b7b8a3
commit eeb636e81c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 155 additions and 126 deletions

View File

@ -14,10 +14,10 @@
"build:app": "tauri build"
},
"dependencies": {
"@blocksuite/blocks": "0.5.0-20230302104138-788dae4",
"@blocksuite/editor": "0.5.0-20230302104138-788dae4",
"@blocksuite/blocks": "0.5.0-20230302142916-8e090d3",
"@blocksuite/editor": "0.5.0-20230302142916-8e090d3",
"@blocksuite/icons": "2.0.17",
"@blocksuite/store": "0.5.0-20230302104138-788dae4",
"@blocksuite/store": "0.5.0-20230302142916-8e090d3",
"@emotion/react": "^11.10.6",
"@emotion/styled": "^11.10.6",
"@tauri-apps/api": "^1.2.0",

View File

@ -14,11 +14,11 @@
"@affine/debug": "workspace:*",
"@affine/env": "workspace:*",
"@affine/i18n": "workspace:*",
"@blocksuite/blocks": "0.5.0-20230302104138-788dae4",
"@blocksuite/editor": "0.5.0-20230302104138-788dae4",
"@blocksuite/blocks": "0.5.0-20230302142916-8e090d3",
"@blocksuite/editor": "0.5.0-20230302142916-8e090d3",
"@blocksuite/icons": "^2.0.17",
"@blocksuite/react": "0.5.0-20230302104138-788dae4",
"@blocksuite/store": "0.5.0-20230302104138-788dae4",
"@blocksuite/react": "0.5.0-20230302142916-8e090d3",
"@blocksuite/store": "0.5.0-20230302142916-8e090d3",
"@emotion/cache": "^11.10.5",
"@emotion/css": "^11.10.6",
"@emotion/react": "^11.10.6",

View File

@ -68,7 +68,7 @@ export const BlockSuiteEditor = (props: EditorProps) => {
const title =
localStorage.getItem(kFirstPage) === null ? exampleTitle : undefined;
const pageBlockId = page.addBlockByFlavour('affine:page', {
title,
title: new page.Text(title),
});
page.addBlockByFlavour('affine:surface', {}, null);
const frameId = page.addBlockByFlavour('affine:frame', {}, pageBlockId);
@ -113,5 +113,12 @@ export const BlockSuiteEditor = (props: EditorProps) => {
container.removeChild(editor);
};
}, [page]);
return <div className="editor-wrapper" style={props.style} ref={ref} />;
return (
<div
data-testid={`editor-${props.blockSuiteWorkspace.room}-${props.page.id}`}
className="editor-wrapper"
style={props.style}
ref={ref}
/>
);
};

View File

@ -57,6 +57,7 @@ export const PageDetailEditor: React.FC<PageDetailEditorProps> = ({
style={{
height: 'calc(100% - 60px)',
}}
key={pageId}
blockSuiteWorkspace={blockSuiteWorkspace}
mode={meta.mode ?? 'page'}
page={page}

View File

@ -46,7 +46,7 @@ beforeEach(async () => {
expect(page).not.toBeNull();
assertExists(page);
const pageBlockId = page.addBlockByFlavour('affine:page', {
title: '',
title: new page.Text(''),
});
const frameId = page.addBlockByFlavour('affine:frame', {}, pageBlockId);
page.addBlockByFlavour('affine:paragraph', {}, frameId);

View File

@ -54,7 +54,7 @@ const PreviewPage: NextPage<PreviewPageProps> = ({
onInit={(page, editor) => {
blockSuiteWorkspace.setPageMeta(page.id, { title });
const pageBlockId = page.addBlockByFlavour('affine:page', {
title,
title: new page.Text(title),
});
page.addBlockByFlavour('affine:surface', {}, null);
const frameId = page.addBlockByFlavour(

View File

@ -10,12 +10,12 @@
"dependencies": {
"@affine/debug": "workspace:*",
"@affine/i18n": "workspace:*",
"@blocksuite/blocks": "0.5.0-20230302104138-788dae4",
"@blocksuite/editor": "0.5.0-20230302104138-788dae4",
"@blocksuite/global": "0.5.0-20230302104138-788dae4",
"@blocksuite/blocks": "0.5.0-20230302142916-8e090d3",
"@blocksuite/editor": "0.5.0-20230302142916-8e090d3",
"@blocksuite/global": "0.5.0-20230302142916-8e090d3",
"@blocksuite/icons": "2.0.17",
"@blocksuite/react": "0.5.0-20230302104138-788dae4",
"@blocksuite/store": "0.5.0-20230302104138-788dae4",
"@blocksuite/react": "0.5.0-20230302142916-8e090d3",
"@blocksuite/store": "0.5.0-20230302142916-8e090d3",
"@emotion/react": "^11.10.6",
"@emotion/styled": "^11.10.6",
"@mui/base": "5.0.0-alpha.118",

View File

@ -14,8 +14,8 @@
},
"dependencies": {
"@affine/debug": "workspace:*",
"@blocksuite/blocks": "0.5.0-20230302104138-788dae4",
"@blocksuite/store": "0.5.0-20230302104138-788dae4",
"@blocksuite/blocks": "0.5.0-20230302142916-8e090d3",
"@blocksuite/store": "0.5.0-20230302142916-8e090d3",
"@tauri-apps/api": "^1.2.0",
"encoding": "^0.1.13",
"firebase": "^9.17.1",

View File

@ -7,6 +7,6 @@
"zod": "^3.20.6"
},
"dependencies": {
"@blocksuite/global": "0.5.0-20230302104138-788dae4"
"@blocksuite/global": "0.5.0-20230302142916-8e090d3"
}
}

View File

@ -75,10 +75,10 @@ importers:
apps/desktop:
specifiers:
'@blocksuite/blocks': 0.5.0-20230302104138-788dae4
'@blocksuite/editor': 0.5.0-20230302104138-788dae4
'@blocksuite/blocks': 0.5.0-20230302142916-8e090d3
'@blocksuite/editor': 0.5.0-20230302142916-8e090d3
'@blocksuite/icons': 2.0.17
'@blocksuite/store': 0.5.0-20230302104138-788dae4
'@blocksuite/store': 0.5.0-20230302142916-8e090d3
'@emotion/react': ^11.10.6
'@emotion/styled': ^11.10.6
'@tauri-apps/api': ^1.2.0
@ -107,10 +107,10 @@ importers:
yjs: ^13.5.47
zx: ^7.1.1
dependencies:
'@blocksuite/blocks': 0.5.0-20230302104138-788dae4_kzudlbcskrxephs677hovcqfne
'@blocksuite/editor': 0.5.0-20230302104138-788dae4_o5qglmdhphu42y4ndsiih7p7na
'@blocksuite/blocks': 0.5.0-20230302142916-8e090d3_phpkg7jy7j3nechr5lvhpbhgmm
'@blocksuite/editor': 0.5.0-20230302142916-8e090d3_krrkzvqq6n3hgerivgrbgivaye
'@blocksuite/icons': 2.0.17_pmekkgnqduwlme35zpnqhenc34
'@blocksuite/store': 0.5.0-20230302104138-788dae4_lit@2.6.1+yjs@13.5.47
'@blocksuite/store': 0.5.0-20230302142916-8e090d3_lit@2.6.1+yjs@13.5.47
'@emotion/react': 11.10.6_pmekkgnqduwlme35zpnqhenc34
'@emotion/styled': 11.10.6_oouaibmszuch5k64ms7uxp2aia
'@tauri-apps/api': 1.2.0_nb4isgkwd3sres4g7j7rgtldsu
@ -147,11 +147,11 @@ importers:
'@affine/debug': workspace:*
'@affine/env': workspace:*
'@affine/i18n': workspace:*
'@blocksuite/blocks': 0.5.0-20230302104138-788dae4
'@blocksuite/editor': 0.5.0-20230302104138-788dae4
'@blocksuite/blocks': 0.5.0-20230302142916-8e090d3
'@blocksuite/editor': 0.5.0-20230302142916-8e090d3
'@blocksuite/icons': ^2.0.17
'@blocksuite/react': 0.5.0-20230302104138-788dae4
'@blocksuite/store': 0.5.0-20230302104138-788dae4
'@blocksuite/react': 0.5.0-20230302142916-8e090d3
'@blocksuite/store': 0.5.0-20230302142916-8e090d3
'@emotion/cache': ^11.10.5
'@emotion/css': ^11.10.6
'@emotion/react': ^11.10.6
@ -191,11 +191,11 @@ importers:
'@affine/debug': link:../../packages/debug
'@affine/env': link:../../packages/env
'@affine/i18n': link:../../packages/i18n
'@blocksuite/blocks': 0.5.0-20230302104138-788dae4_kzudlbcskrxephs677hovcqfne
'@blocksuite/editor': 0.5.0-20230302104138-788dae4_o5qglmdhphu42y4ndsiih7p7na
'@blocksuite/blocks': 0.5.0-20230302142916-8e090d3_phpkg7jy7j3nechr5lvhpbhgmm
'@blocksuite/editor': 0.5.0-20230302142916-8e090d3_krrkzvqq6n3hgerivgrbgivaye
'@blocksuite/icons': 2.0.17_pmekkgnqduwlme35zpnqhenc34
'@blocksuite/react': 0.5.0-20230302104138-788dae4_kwp5rhbsjxjct5jxet2wisdqpu
'@blocksuite/store': 0.5.0-20230302104138-788dae4_lit@2.6.1+yjs@13.5.47
'@blocksuite/react': 0.5.0-20230302142916-8e090d3_ytjx4xsbs4ttwf455ikecdcuu4
'@blocksuite/store': 0.5.0-20230302142916-8e090d3_lit@2.6.1+yjs@13.5.47
'@emotion/cache': 11.10.5
'@emotion/css': 11.10.6
'@emotion/react': 11.10.6_pmekkgnqduwlme35zpnqhenc34
@ -235,12 +235,12 @@ importers:
specifiers:
'@affine/debug': workspace:*
'@affine/i18n': workspace:*
'@blocksuite/blocks': 0.5.0-20230302104138-788dae4
'@blocksuite/editor': 0.5.0-20230302104138-788dae4
'@blocksuite/global': 0.5.0-20230302104138-788dae4
'@blocksuite/blocks': 0.5.0-20230302142916-8e090d3
'@blocksuite/editor': 0.5.0-20230302142916-8e090d3
'@blocksuite/global': 0.5.0-20230302142916-8e090d3
'@blocksuite/icons': 2.0.17
'@blocksuite/react': 0.5.0-20230302104138-788dae4
'@blocksuite/store': 0.5.0-20230302104138-788dae4
'@blocksuite/react': 0.5.0-20230302142916-8e090d3
'@blocksuite/store': 0.5.0-20230302142916-8e090d3
'@emotion/react': ^11.10.6
'@emotion/styled': ^11.10.6
'@mui/base': 5.0.0-alpha.118
@ -269,12 +269,12 @@ importers:
dependencies:
'@affine/debug': link:../debug
'@affine/i18n': link:../i18n
'@blocksuite/blocks': 0.5.0-20230302104138-788dae4_kzudlbcskrxephs677hovcqfne
'@blocksuite/editor': 0.5.0-20230302104138-788dae4_o5qglmdhphu42y4ndsiih7p7na
'@blocksuite/global': 0.5.0-20230302104138-788dae4_lit@2.6.1
'@blocksuite/blocks': 0.5.0-20230302142916-8e090d3_phpkg7jy7j3nechr5lvhpbhgmm
'@blocksuite/editor': 0.5.0-20230302142916-8e090d3_krrkzvqq6n3hgerivgrbgivaye
'@blocksuite/global': 0.5.0-20230302142916-8e090d3_lit@2.6.1
'@blocksuite/icons': 2.0.17_pmekkgnqduwlme35zpnqhenc34
'@blocksuite/react': 0.5.0-20230302104138-788dae4_kwp5rhbsjxjct5jxet2wisdqpu
'@blocksuite/store': 0.5.0-20230302104138-788dae4_lit@2.6.1+yjs@13.5.47
'@blocksuite/react': 0.5.0-20230302142916-8e090d3_ytjx4xsbs4ttwf455ikecdcuu4
'@blocksuite/store': 0.5.0-20230302142916-8e090d3_lit@2.6.1+yjs@13.5.47
'@emotion/react': 11.10.6_pmekkgnqduwlme35zpnqhenc34
'@emotion/styled': 11.10.6_oouaibmszuch5k64ms7uxp2aia
'@mui/base': 5.0.0-alpha.118_zula6vjvt3wdocc4mwcxqa6nzi
@ -305,8 +305,8 @@ importers:
packages/data-center:
specifiers:
'@affine/debug': workspace:*
'@blocksuite/blocks': 0.5.0-20230302104138-788dae4
'@blocksuite/store': 0.5.0-20230302104138-788dae4
'@blocksuite/blocks': 0.5.0-20230302142916-8e090d3
'@blocksuite/store': 0.5.0-20230302142916-8e090d3
'@tauri-apps/api': ^1.2.0
encoding: ^0.1.13
fake-indexeddb: 4.0.1
@ -322,8 +322,8 @@ importers:
yjs: ^13.5.47
dependencies:
'@affine/debug': link:../debug
'@blocksuite/blocks': 0.5.0-20230302104138-788dae4_kzudlbcskrxephs677hovcqfne
'@blocksuite/store': 0.5.0-20230302104138-788dae4_lit@2.6.1+yjs@13.5.47
'@blocksuite/blocks': 0.5.0-20230302142916-8e090d3_phpkg7jy7j3nechr5lvhpbhgmm
'@blocksuite/store': 0.5.0-20230302142916-8e090d3_lit@2.6.1+yjs@13.5.47
'@tauri-apps/api': 1.2.0_nb4isgkwd3sres4g7j7rgtldsu
encoding: 0.1.13
firebase: 9.17.1_encoding@0.1.13
@ -352,11 +352,11 @@ importers:
packages/env:
specifiers:
'@blocksuite/global': 0.5.0-20230302104138-788dae4
'@blocksuite/global': 0.5.0-20230302142916-8e090d3
next: ^13.2.3
zod: ^3.20.6
dependencies:
'@blocksuite/global': 0.5.0-20230302104138-788dae4
'@blocksuite/global': 0.5.0-20230302142916-8e090d3
devDependencies:
next: 13.2.3
zod: 3.20.6
@ -1689,15 +1689,15 @@ packages:
resolution: {integrity: sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==}
dev: true
/@blocksuite/blocks/0.5.0-20230302104138-788dae4_kzudlbcskrxephs677hovcqfne:
resolution: {integrity: sha512-ckUR+Nt9pnwR8lr8dUpuXW4pYybNMxok7+Nihh7Hvop2zlFOpZp7bwkexu3bgDJZn0JkggSAvZZpVcJlZ9AR7A==}
/@blocksuite/blocks/0.5.0-20230302142916-8e090d3_phpkg7jy7j3nechr5lvhpbhgmm:
resolution: {integrity: sha512-ZkCfh9mItwq4zbEFRHJGw7et48uVNRL4kvP73HhnKJwnuUjTrlK6hwIhQrc0v7Q5nUfe4dnpjrSw3qkMcamrLA==}
peerDependencies:
'@blocksuite/store': 0.5.0-20230302104138-788dae4
'@blocksuite/store': 0.5.0-20230302142916-8e090d3
dependencies:
'@blocksuite/global': 0.5.0-20230302104138-788dae4_lit@2.6.1
'@blocksuite/phasor': 0.5.0-20230302104138-788dae4_lit@2.6.1+yjs@13.5.47
'@blocksuite/store': 0.5.0-20230302104138-788dae4_lit@2.6.1+yjs@13.5.47
'@blocksuite/virgo': 0.5.0-20230302104138-788dae4_lit@2.6.1+yjs@13.5.47
'@blocksuite/global': 0.5.0-20230302142916-8e090d3_lit@2.6.1
'@blocksuite/phasor': 0.5.0-20230302142916-8e090d3_lit@2.6.1+yjs@13.5.47
'@blocksuite/store': 0.5.0-20230302142916-8e090d3_lit@2.6.1+yjs@13.5.47
'@blocksuite/virgo': 0.5.0-20230302142916-8e090d3_lit@2.6.1+yjs@13.5.47
'@popperjs/core': 2.11.6
highlight.js: 11.7.0
hotkeys-js: 3.10.1
@ -1708,22 +1708,22 @@ packages:
- yjs
dev: false
/@blocksuite/editor/0.5.0-20230302104138-788dae4_o5qglmdhphu42y4ndsiih7p7na:
resolution: {integrity: sha512-6BP5bgErDATIMHWHSIZHYIIAxg3vPjuuZZ1q3sm+fPoZozNR+c8f8ztrWOK9KrjznVHuMLry8yRyh/8f78gIAA==}
/@blocksuite/editor/0.5.0-20230302142916-8e090d3_krrkzvqq6n3hgerivgrbgivaye:
resolution: {integrity: sha512-xMYkzf8uGGn7IpMoGeaD+SrKfwMWT+Igk3j5QHRfH6zlShN2MF9TLf18yzphUnxlGVnk161bx7veeoNtFVgg5w==}
peerDependencies:
'@blocksuite/blocks': 0.5.0-20230302104138-788dae4
'@blocksuite/store': 0.5.0-20230302104138-788dae4
'@blocksuite/blocks': 0.5.0-20230302142916-8e090d3
'@blocksuite/store': 0.5.0-20230302142916-8e090d3
dependencies:
'@blocksuite/blocks': 0.5.0-20230302104138-788dae4_kzudlbcskrxephs677hovcqfne
'@blocksuite/global': 0.5.0-20230302104138-788dae4_lit@2.6.1
'@blocksuite/store': 0.5.0-20230302104138-788dae4_lit@2.6.1+yjs@13.5.47
'@blocksuite/blocks': 0.5.0-20230302142916-8e090d3_phpkg7jy7j3nechr5lvhpbhgmm
'@blocksuite/global': 0.5.0-20230302142916-8e090d3_lit@2.6.1
'@blocksuite/store': 0.5.0-20230302142916-8e090d3_lit@2.6.1+yjs@13.5.47
lit: 2.6.1
marked: 4.2.12
turndown: 7.1.1
dev: false
/@blocksuite/global/0.5.0-20230302104138-788dae4:
resolution: {integrity: sha512-TSLHojKb0qzU1FKTjFZxDpuboZ/8XcwPyt2IBrwz+mUdXUD6z2+bLmm0yX3bLXGt71iEYQzUXCtlZxj0sKU9nQ==}
/@blocksuite/global/0.5.0-20230302142916-8e090d3:
resolution: {integrity: sha512-6pPsaPtij0+80U05S68S+JPY84Z5qVIit5js5oycMo5TOnrjoBJ7se//qryoS/BbwCQlNuiuABLB3u14/YjgcA==}
peerDependencies:
lit: ^2.6
peerDependenciesMeta:
@ -1734,8 +1734,8 @@ packages:
zod: 3.20.6
dev: false
/@blocksuite/global/0.5.0-20230302104138-788dae4_lit@2.6.1:
resolution: {integrity: sha512-TSLHojKb0qzU1FKTjFZxDpuboZ/8XcwPyt2IBrwz+mUdXUD6z2+bLmm0yX3bLXGt71iEYQzUXCtlZxj0sKU9nQ==}
/@blocksuite/global/0.5.0-20230302142916-8e090d3_lit@2.6.1:
resolution: {integrity: sha512-6pPsaPtij0+80U05S68S+JPY84Z5qVIit5js5oycMo5TOnrjoBJ7se//qryoS/BbwCQlNuiuABLB3u14/YjgcA==}
peerDependencies:
lit: ^2.6
peerDependenciesMeta:
@ -1757,12 +1757,12 @@ packages:
react: 18.2.0
dev: false
/@blocksuite/phasor/0.5.0-20230302104138-788dae4_lit@2.6.1+yjs@13.5.47:
resolution: {integrity: sha512-1lUi3PGNrpMYgbZ5ghY54eOi/jrkg9QDsI19DrkPpC4p7L8UZNZ3iL092VCFpb6G0baSbNSNL0ddESGN1qNxVA==}
/@blocksuite/phasor/0.5.0-20230302142916-8e090d3_lit@2.6.1+yjs@13.5.47:
resolution: {integrity: sha512-nJ21MA7BxPd5N6720h/MNAWuUGeS5r7XBdDCsJ/ARs/d2U6YAs4moKoXnJQLw+O3JPfjDHs2tTKvuz2HcKh6KQ==}
peerDependencies:
yjs: ^13
dependencies:
'@blocksuite/global': 0.5.0-20230302104138-788dae4_lit@2.6.1
'@blocksuite/global': 0.5.0-20230302142916-8e090d3_lit@2.6.1
fractional-indexing: 3.2.0
nanoid: 4.0.1
perfect-freehand: 1.2.0
@ -1771,19 +1771,19 @@ packages:
- lit
dev: false
/@blocksuite/react/0.5.0-20230302104138-788dae4_kwp5rhbsjxjct5jxet2wisdqpu:
resolution: {integrity: sha512-YGluPKmDlkjmM94bu5480uAa/l6GTdC4gc7q3pYDP6rOz5rkQcH7zPdwLpZUg9u45pFQxmlPZyAeT99ZravoeQ==}
/@blocksuite/react/0.5.0-20230302142916-8e090d3_ytjx4xsbs4ttwf455ikecdcuu4:
resolution: {integrity: sha512-CvFiF7UFyJqooLtKlOcbkQUXds9+GhRpCwVpErbA+CuEZOJhtSg75rN+LemCzjr0RDbrEpHLKjmAH9H4QmFTFg==}
peerDependencies:
'@blocksuite/blocks': 0.5.0-20230302104138-788dae4
'@blocksuite/editor': 0.5.0-20230302104138-788dae4
'@blocksuite/store': 0.5.0-20230302104138-788dae4
'@blocksuite/blocks': 0.5.0-20230302142916-8e090d3
'@blocksuite/editor': 0.5.0-20230302142916-8e090d3
'@blocksuite/store': 0.5.0-20230302142916-8e090d3
react: '>=18.0.0'
react-dom: '>=18.0.0'
dependencies:
'@blocksuite/blocks': 0.5.0-20230302104138-788dae4_kzudlbcskrxephs677hovcqfne
'@blocksuite/editor': 0.5.0-20230302104138-788dae4_o5qglmdhphu42y4ndsiih7p7na
'@blocksuite/global': 0.5.0-20230302104138-788dae4_lit@2.6.1
'@blocksuite/store': 0.5.0-20230302104138-788dae4_lit@2.6.1+yjs@13.5.47
'@blocksuite/blocks': 0.5.0-20230302142916-8e090d3_phpkg7jy7j3nechr5lvhpbhgmm
'@blocksuite/editor': 0.5.0-20230302142916-8e090d3_krrkzvqq6n3hgerivgrbgivaye
'@blocksuite/global': 0.5.0-20230302142916-8e090d3_lit@2.6.1
'@blocksuite/store': 0.5.0-20230302142916-8e090d3_lit@2.6.1+yjs@13.5.47
react: 18.2.0
react-dom: 18.2.0_react@18.2.0
zustand: 4.3.5_react@18.2.0
@ -1792,19 +1792,19 @@ packages:
- lit
dev: false
/@blocksuite/store/0.5.0-20230302104138-788dae4_lit@2.6.1+yjs@13.5.47:
resolution: {integrity: sha512-6wcb8lOLNiNh1QyUAkKDaDXg45MhpEJ3/dtTYTiONG585bx3ZS2xkyBCBYXs6Fszpp00FAeiOONIt+2UmK3j7A==}
/@blocksuite/store/0.5.0-20230302142916-8e090d3_lit@2.6.1+yjs@13.5.47:
resolution: {integrity: sha512-folnQEkinxotk3KGQJFQ6yhToVW7PoD/zRX0CCpfC6sWN5iNfbEAfw0GpVnH9ngP4CDK7kDFHfI8F58uCYg4vw==}
peerDependencies:
yjs: ^13
dependencies:
'@blocksuite/global': 0.5.0-20230302104138-788dae4_lit@2.6.1
'@blocksuite/virgo': 0.5.0-20230302104138-788dae4_lit@2.6.1+yjs@13.5.47
'@blocksuite/global': 0.5.0-20230302142916-8e090d3_lit@2.6.1
'@blocksuite/virgo': 0.5.0-20230302142916-8e090d3_lit@2.6.1+yjs@13.5.47
'@types/flexsearch': 0.7.3
buffer: 6.0.3
flexsearch: 0.7.21
idb-keyval: 6.2.0
ky: 0.33.2
lib0: 0.2.63
lib0: 0.2.62
merge: 2.1.1
nanoid: 4.0.1
y-protocols: 1.0.5
@ -1818,13 +1818,13 @@ packages:
- utf-8-validate
dev: false
/@blocksuite/virgo/0.5.0-20230302104138-788dae4_lit@2.6.1+yjs@13.5.47:
resolution: {integrity: sha512-tDWYtnAQZXa5ZT1Mqw31kgK4GLyOil7i5kd6wFfGIF6LvJNqg0BdwIdenH16+Cym/3p7tSB3xufeQE3gf64Y4Q==}
/@blocksuite/virgo/0.5.0-20230302142916-8e090d3_lit@2.6.1+yjs@13.5.47:
resolution: {integrity: sha512-doQas2VwFjvPq9zuqdwDqa6kpX+/PVeGRY0gZzkZCWG6Bnw1MFORRWqZ6DEibjNtT0cBdWtjz83W9fYMqBFjMg==}
peerDependencies:
lit: ^2
yjs: ^13
dependencies:
'@blocksuite/global': 0.5.0-20230302104138-788dae4_lit@2.6.1
'@blocksuite/global': 0.5.0-20230302142916-8e090d3_lit@2.6.1
lit: 2.6.1
yjs: 13.5.47
zod: 3.20.6
@ -7444,7 +7444,7 @@ packages:
dependencies:
call-bind: 1.0.2
es-get-iterator: 1.1.3
get-intrinsic: 1.1.3
get-intrinsic: 1.2.0
is-arguments: 1.1.1
is-array-buffer: 3.0.1
is-date-object: 1.0.5
@ -7808,7 +7808,7 @@ packages:
resolution: {integrity: sha512-sPZmqHBe6JIiTfN5q2pEi//TwxmAFHwj/XEuYjTuse78i8KxaqMTTzxPoFKuzRpDpTJ+0NAbpfenkmH2rePtuw==}
dependencies:
call-bind: 1.0.2
get-intrinsic: 1.1.3
get-intrinsic: 1.2.0
has-symbols: 1.0.3
is-arguments: 1.1.1
is-map: 2.0.2
@ -9633,7 +9633,7 @@ packages:
resolution: {integrity: sha512-ASfLknmY8Xa2XtB4wmbz13Wu202baeA18cJBCeCy0wXUHZF0IPyVEXqKEcd+t2fNSLLL1vC6k7lxZEojNbISXQ==}
dependencies:
call-bind: 1.0.2
get-intrinsic: 1.1.3
get-intrinsic: 1.2.0
is-typed-array: 1.1.10
dev: true
@ -9868,7 +9868,7 @@ packages:
resolution: {integrity: sha512-t2yVvttHkQktwnNNmBQ98AhENLdPUTDTE21uPqAQ0ARwQfGeQKRVS0NNurH7bTf7RrvcVn1OOge45CnBeHCSmg==}
dependencies:
call-bind: 1.0.2
get-intrinsic: 1.1.3
get-intrinsic: 1.2.0
dev: true
/is-windows/1.0.2:
@ -14330,7 +14330,7 @@ packages:
engines: {node: '>=12'}
hasBin: true
dependencies:
lib0: 0.2.63
lib0: 0.2.62
simple-peer: 9.11.1
y-protocols: 1.0.5
optionalDependencies:

View File

@ -1,11 +1,16 @@
import type { Page } from '@playwright/test';
export async function newPage(page: Page) {
await page.waitForSelector('virgo-line');
// fixme(himself65): if too fast, the page will crash
await page.getByTestId('sliderBar').getByText('New Page').click({
delay: 100,
});
await page.waitForTimeout(100);
await page.waitForSelector('virgo-line');
}
export function getBlockSuiteEditorTitle(page: Page) {
return page.locator('virgo-line').nth(0);
}
export async function clickPageMoreActions(page: Page) {

View File

@ -1,7 +1,7 @@
import { expect } from '@playwright/test';
import { loadPage } from './libs/load-page';
import { newPage } from './libs/page-logic';
import { getBlockSuiteEditorTitle, newPage } from './libs/page-logic';
import { test } from './libs/playwright';
loadPage();
@ -11,8 +11,8 @@ test.describe('Local first delete page', () => {
page,
}) => {
await newPage(page);
await page.getByPlaceholder('Title').click();
await page.getByPlaceholder('Title').fill('this is a new page to restore');
await getBlockSuiteEditorTitle(page).click();
await getBlockSuiteEditorTitle(page).fill('this is a new page to restore');
const newPageId = page.url().split('/').reverse()[0];
await page.getByRole('link', { name: 'All pages' }).click();
const cell = page.getByRole('cell', {

View File

@ -1,14 +1,18 @@
import { expect } from '@playwright/test';
import { loadPage } from './libs/load-page';
import { clickPageMoreActions, newPage } from './libs/page-logic';
import {
clickPageMoreActions,
getBlockSuiteEditorTitle,
newPage,
} from './libs/page-logic';
import { test } from './libs/playwright';
loadPage();
test.describe('Local first export page', () => {
test.skip('New a page ,then open it and export html', async ({ page }) => {
await newPage(page);
await page.getByPlaceholder('Title').click();
await getBlockSuiteEditorTitle(page).click();
await page
.getByPlaceholder('Title')
.fill('this is a new page to export html content');
@ -38,7 +42,7 @@ test.describe('Local first export page', () => {
page,
}) => {
await newPage(page);
await page.getByPlaceholder('Title').click();
await getBlockSuiteEditorTitle(page).click();
await page
.getByPlaceholder('Title')
.fill('this is a new page to export markdown content');

View File

@ -1,15 +1,19 @@
import { expect } from '@playwright/test';
import { loadPage } from './libs/load-page';
import { clickPageMoreActions, newPage } from './libs/page-logic';
import {
clickPageMoreActions,
getBlockSuiteEditorTitle,
newPage,
} from './libs/page-logic';
import { test } from './libs/playwright';
loadPage();
test.describe('Local first favorite and cancel favorite page', () => {
test('New a page and open it ,then favorite it', async ({ page }) => {
await newPage(page);
await page.getByPlaceholder('Title').click();
await page.getByPlaceholder('Title').fill('this is a new page to favorite');
await getBlockSuiteEditorTitle(page).click();
await getBlockSuiteEditorTitle(page).fill('this is a new page to favorite');
await page.getByRole('link', { name: 'All pages' }).click();
const cell = page.getByRole('cell', {
name: 'this is a new page to favorite',
@ -23,8 +27,8 @@ test.describe('Local first favorite and cancel favorite page', () => {
});
test('Cancel favorite', async ({ page }) => {
await newPage(page);
await page.getByPlaceholder('Title').click();
await page.getByPlaceholder('Title').fill('this is a new page to favorite');
await getBlockSuiteEditorTitle(page).click();
await getBlockSuiteEditorTitle(page).fill('this is a new page to favorite');
await page.getByRole('link', { name: 'All pages' }).click();
const cell = page.getByRole('cell', {
name: 'this is a new page to favorite',

View File

@ -1,15 +1,19 @@
import { expect } from '@playwright/test';
import { loadPage } from './libs/load-page';
import { clickPageMoreActions, newPage } from './libs/page-logic';
import {
clickPageMoreActions,
getBlockSuiteEditorTitle,
newPage,
} from './libs/page-logic';
import { test } from './libs/playwright';
loadPage();
test.describe('Local first favorite items ui', () => {
test('Show favorite items in sidebar', async ({ page }) => {
await newPage(page);
await page.getByPlaceholder('Title').click();
await page.getByPlaceholder('Title').fill('this is a new page to favorite');
await getBlockSuiteEditorTitle(page).click();
await getBlockSuiteEditorTitle(page).fill('this is a new page to favorite');
const newPageId = page.url().split('/').reverse()[0];
await page.getByRole('link', { name: 'All pages' }).click();
const cell = page.getByRole('cell', {
@ -31,8 +35,8 @@ test.describe('Local first favorite items ui', () => {
test('Show favorite items in favorite list', async ({ page }) => {
await newPage(page);
await page.getByPlaceholder('Title').click();
await page.getByPlaceholder('Title').fill('this is a new page to favorite');
await getBlockSuiteEditorTitle(page).click();
await getBlockSuiteEditorTitle(page).fill('this is a new page to favorite');
await page.getByRole('link', { name: 'All pages' }).click();
const cell = page.getByRole('cell', {
name: 'this is a new page to favorite',

View File

@ -1,7 +1,7 @@
import { expect } from '@playwright/test';
import { loadPage } from './libs/load-page';
import { newPage } from './libs/page-logic';
import { getBlockSuiteEditorTitle, newPage } from './libs/page-logic';
import { test } from './libs/playwright';
loadPage();
@ -15,8 +15,8 @@ test.describe('local first new page', () => {
test('click btn bew page and find it in all pages', async ({ page }) => {
await newPage(page);
await page.getByPlaceholder('Title').click();
await page.getByPlaceholder('Title').fill('this is a new page');
await getBlockSuiteEditorTitle(page).click();
await getBlockSuiteEditorTitle(page).fill('this is a new page');
await page.getByRole('link', { name: 'All pages' }).click();
const cell = page.getByRole('cell', { name: 'this is a new page' });
expect(cell).not.toBeUndefined();

View File

@ -1,15 +1,15 @@
import { expect } from '@playwright/test';
import { loadPage } from './libs/load-page';
import { newPage } from './libs/page-logic';
import { getBlockSuiteEditorTitle, newPage } from './libs/page-logic';
import { test } from './libs/playwright';
loadPage();
test.describe('local first new page', () => {
test('click btn bew page and open in tab', async ({ page }) => {
await newPage(page);
await page.getByPlaceholder('Title').click();
await page.getByPlaceholder('Title').fill('this is a new page');
await getBlockSuiteEditorTitle(page).click();
await getBlockSuiteEditorTitle(page).fill('this is a new page');
const newPageUrl = page.url();
const newPageId = page.url().split('/').reverse()[0];

View File

@ -1,7 +1,7 @@
import { expect } from '@playwright/test';
import { loadPage } from './libs/load-page';
import { newPage } from './libs/page-logic';
import { getBlockSuiteEditorTitle, newPage } from './libs/page-logic';
import { test } from './libs/playwright';
loadPage();
@ -10,8 +10,8 @@ test.describe('Local first delete page', () => {
page,
}) => {
await newPage(page);
await page.getByPlaceholder('Title').click();
await page.getByPlaceholder('Title').fill('this is a new page to restore');
await getBlockSuiteEditorTitle(page).click();
await getBlockSuiteEditorTitle(page).fill('this is a new page to restore');
const originPageUrl = page.url();
const newPageId = page.url().split('/').reverse()[0];
await page.getByRole('link', { name: 'All pages' }).click();

View File

@ -1,15 +1,19 @@
import { expect } from '@playwright/test';
import { loadPage } from './libs/load-page';
import { clickPageMoreActions, newPage } from './libs/page-logic';
import {
clickPageMoreActions,
getBlockSuiteEditorTitle,
newPage,
} from './libs/page-logic';
import { test } from './libs/playwright';
loadPage();
test.describe('Local first delete page', () => {
test('New a page ,then open it and show delete modal', async ({ page }) => {
await newPage(page);
await page.getByPlaceholder('Title').click();
await page.getByPlaceholder('Title').fill('this is a new page to delete');
await getBlockSuiteEditorTitle(page).click();
await getBlockSuiteEditorTitle(page).fill('this is a new page to delete');
await page.getByRole('link', { name: 'All pages' }).click();
const cell = page.getByRole('cell', {
name: 'this is a new page to delete',
@ -28,8 +32,8 @@ test.describe('Local first delete page', () => {
page,
}) => {
await newPage(page);
await page.getByPlaceholder('Title').click();
await page.getByPlaceholder('Title').fill('this is a new page to delete');
await getBlockSuiteEditorTitle(page).click();
await getBlockSuiteEditorTitle(page).fill('this is a new page to delete');
const newPageId = page.url().split('/').reverse()[0];
await page.getByRole('link', { name: 'All pages' }).click();
const cell = page.getByRole('cell', {

View File

@ -1,7 +1,7 @@
import { expect } from '@playwright/test';
import { loadPage } from './libs/load-page';
import { newPage } from './libs/page-logic';
import { getBlockSuiteEditorTitle, newPage } from './libs/page-logic';
import { test } from './libs/playwright';
loadPage();
@ -10,8 +10,8 @@ test.describe('Local first trash page', () => {
page,
}) => {
await newPage(page);
await page.getByPlaceholder('Title').click();
await page.getByPlaceholder('Title').fill('this is a new page to delete');
await getBlockSuiteEditorTitle(page).click();
await getBlockSuiteEditorTitle(page).fill('this is a new page to delete');
const newPageId = page.url().split('/').reverse()[0];
await page.getByRole('link', { name: 'All pages' }).click();
const cell = page.getByRole('cell', {