Skip to content

Commit 823c6b4

Browse files
chore: sync affine blocksuite to packages (#9097)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 4c1e4be commit 823c6b4

File tree

981 files changed

+2862
-1683
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

981 files changed

+2862
-1683
lines changed

Diff for: packages/affine/all/package.json

+2
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
"@blocksuite/affine-widget-edgeless-auto-connect": "workspace:*",
5656
"@blocksuite/affine-widget-edgeless-toolbar": "workspace:*",
5757
"@blocksuite/affine-widget-frame-title": "workspace:*",
58+
"@blocksuite/affine-widget-linked-doc": "workspace:*",
5859
"@blocksuite/affine-widget-remote-selection": "workspace:*",
5960
"@blocksuite/affine-widget-scroll-anchoring": "workspace:*",
6061
"@blocksuite/affine-widget-slash-menu": "workspace:*",
@@ -115,6 +116,7 @@
115116
"./widgets/edgeless-auto-connect": "./src/widgets/edgeless-auto-connect.ts",
116117
"./widgets/edgeless-toolbar": "./src/widgets/edgeless-toolbar.ts",
117118
"./widgets/frame-title": "./src/widgets/frame-title.ts",
119+
"./widgets/linked-doc": "./src/widgets/linked-doc.ts",
118120
"./widgets/remote-selection": "./src/widgets/remote-selection.ts",
119121
"./widgets/scroll-anchoring": "./src/widgets/scroll-anchoring.ts",
120122
"./widgets/slash-menu": "./src/widgets/slash-menu.ts",

Diff for: packages/affine/all/src/__tests__/adapters/markdown.unit.spec.ts

+42
Original file line numberDiff line numberDiff line change
@@ -3769,6 +3769,48 @@ bbb
37693769
});
37703770
expect(nanoidReplacement(rawBlockSnapshot)).toEqual(blockSnapshot);
37713771
});
3772+
3773+
test('escapes dollar signs followed by a digit or space and digit', async () => {
3774+
const markdown =
3775+
'The price of the T-shirt is $9.15 and the price of the hat is $ 8\n';
3776+
const blockSnapshot: BlockSnapshot = {
3777+
type: 'block',
3778+
id: 'matchesReplaceMap[0]',
3779+
flavour: 'affine:note',
3780+
props: {
3781+
xywh: '[0,0,800,95]',
3782+
background: DefaultTheme.noteBackgrounColor,
3783+
index: 'a0',
3784+
hidden: false,
3785+
displayMode: NoteDisplayMode.DocAndEdgeless,
3786+
},
3787+
children: [
3788+
{
3789+
type: 'block',
3790+
id: 'matchesReplaceMap[1]',
3791+
flavour: 'affine:paragraph',
3792+
props: {
3793+
type: 'text',
3794+
text: {
3795+
'$blocksuite:internal:text$': true,
3796+
delta: [
3797+
{
3798+
insert:
3799+
'The price of the T-shirt is $9.15 and the price of the hat is $ 8',
3800+
},
3801+
],
3802+
},
3803+
},
3804+
children: [],
3805+
},
3806+
],
3807+
};
3808+
const mdAdapter = new MarkdownAdapter(createJob(), provider);
3809+
const rawBlockSnapshot = await mdAdapter.toBlockSnapshot({
3810+
file: markdown,
3811+
});
3812+
expect(nanoidReplacement(rawBlockSnapshot)).toEqual(blockSnapshot);
3813+
});
37723814
});
37733815

37743816
test('reference', async () => {

Diff for: packages/affine/all/src/adapters/extension.ts

+39-29
Original file line numberDiff line numberDiff line change
@@ -24,36 +24,46 @@ import { defaultMarkdownPreprocessors } from './markdown/preprocessor';
2424
import { defaultBlockNotionHtmlAdapterMatchers } from './notion-html/block-matcher';
2525
import { defaultBlockPlainTextAdapterMatchers } from './plain-text/block-matcher';
2626

27-
export const AdapterFactoryExtensions: ExtensionType[] = [
28-
AttachmentAdapterFactoryExtension,
29-
ImageAdapterFactoryExtension,
30-
MarkdownAdapterFactoryExtension,
31-
PlainTextAdapterFactoryExtension,
32-
HtmlAdapterFactoryExtension,
33-
NotionTextAdapterFactoryExtension,
34-
NotionHtmlAdapterFactoryExtension,
35-
MixTextAdapterFactoryExtension,
36-
];
27+
export function getAdapterFactoryExtensions(): ExtensionType[] {
28+
return [
29+
AttachmentAdapterFactoryExtension,
30+
ImageAdapterFactoryExtension,
31+
MarkdownAdapterFactoryExtension,
32+
PlainTextAdapterFactoryExtension,
33+
HtmlAdapterFactoryExtension,
34+
NotionTextAdapterFactoryExtension,
35+
NotionHtmlAdapterFactoryExtension,
36+
MixTextAdapterFactoryExtension,
37+
];
38+
}
3739

38-
export const HtmlAdapterExtension: ExtensionType[] = [
39-
...HtmlInlineToDeltaAdapterExtensions,
40-
...defaultBlockHtmlAdapterMatchers,
41-
...InlineDeltaToHtmlAdapterExtensions,
42-
];
40+
export function getHtmlAdapterExtensions(): ExtensionType[] {
41+
return [
42+
...HtmlInlineToDeltaAdapterExtensions,
43+
...defaultBlockHtmlAdapterMatchers,
44+
...InlineDeltaToHtmlAdapterExtensions,
45+
];
46+
}
4347

44-
export const MarkdownAdapterExtension: ExtensionType[] = [
45-
...MarkdownInlineToDeltaAdapterExtensions,
46-
...defaultBlockMarkdownAdapterMatchers,
47-
...InlineDeltaToMarkdownAdapterExtensions,
48-
...defaultMarkdownPreprocessors,
49-
];
48+
export function getMarkdownAdapterExtensions(): ExtensionType[] {
49+
return [
50+
...MarkdownInlineToDeltaAdapterExtensions,
51+
...defaultBlockMarkdownAdapterMatchers,
52+
...InlineDeltaToMarkdownAdapterExtensions,
53+
...defaultMarkdownPreprocessors,
54+
];
55+
}
5056

51-
export const NotionHtmlAdapterExtension: ExtensionType[] = [
52-
...NotionHtmlInlineToDeltaAdapterExtensions,
53-
...defaultBlockNotionHtmlAdapterMatchers,
54-
];
57+
export function getNotionHtmlAdapterExtensions(): ExtensionType[] {
58+
return [
59+
...NotionHtmlInlineToDeltaAdapterExtensions,
60+
...defaultBlockNotionHtmlAdapterMatchers,
61+
];
62+
}
5563

56-
export const PlainTextAdapterExtension: ExtensionType[] = [
57-
...defaultBlockPlainTextAdapterMatchers,
58-
...InlineDeltaToPlainTextAdapterExtensions,
59-
];
64+
export function getPlainTextAdapterExtensions(): ExtensionType[] {
65+
return [
66+
...defaultBlockPlainTextAdapterMatchers,
67+
...InlineDeltaToPlainTextAdapterExtensions,
68+
];
69+
}

Diff for: packages/affine/all/src/extensions/store.ts

+10-10
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@ import {
5151
import type { ExtensionType } from '@blocksuite/store';
5252

5353
import {
54-
AdapterFactoryExtensions,
55-
HtmlAdapterExtension,
56-
MarkdownAdapterExtension,
57-
NotionHtmlAdapterExtension,
58-
PlainTextAdapterExtension,
54+
getAdapterFactoryExtensions,
55+
getHtmlAdapterExtensions,
56+
getMarkdownAdapterExtensions,
57+
getNotionHtmlAdapterExtensions,
58+
getPlainTextAdapterExtensions,
5959
} from '../adapters/extension.js';
6060

6161
export const StoreExtensions: ExtensionType[] = [
@@ -96,11 +96,11 @@ export const StoreExtensions: ExtensionType[] = [
9696
DatabaseSelectionExtension,
9797
TableSelectionExtension,
9898

99-
HtmlAdapterExtension,
100-
MarkdownAdapterExtension,
101-
NotionHtmlAdapterExtension,
102-
PlainTextAdapterExtension,
103-
AdapterFactoryExtensions,
99+
getHtmlAdapterExtensions(),
100+
getMarkdownAdapterExtensions(),
101+
getNotionHtmlAdapterExtensions(),
102+
getPlainTextAdapterExtensions(),
103+
getAdapterFactoryExtensions(),
104104

105105
FeatureFlagService,
106106
LinkPreviewerService,

Diff for: packages/affine/all/src/widgets/linked-doc.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from '@blocksuite/affine-widget-linked-doc';

Diff for: packages/affine/all/tsconfig.json

+31-30
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,29 @@
77
},
88
"include": ["./src"],
99
"references": [
10-
{ "path": "../blocks/block-attachment" },
11-
{ "path": "../blocks/block-bookmark" },
12-
{ "path": "../blocks/block-callout" },
13-
{ "path": "../blocks/block-code" },
14-
{ "path": "../blocks/block-data-view" },
15-
{ "path": "../blocks/block-database" },
16-
{ "path": "../blocks/block-divider" },
17-
{ "path": "../blocks/block-edgeless-text" },
18-
{ "path": "../blocks/block-embed" },
19-
{ "path": "../blocks/block-frame" },
20-
{ "path": "../blocks/block-image" },
21-
{ "path": "../blocks/block-latex" },
22-
{ "path": "../blocks/block-list" },
23-
{ "path": "../blocks/block-note" },
24-
{ "path": "../blocks/block-paragraph" },
25-
{ "path": "../blocks/block-root" },
26-
{ "path": "../blocks/block-surface" },
27-
{ "path": "../blocks/block-surface-ref" },
28-
{ "path": "../blocks/block-table" },
10+
{ "path": "../blocks/attachment" },
11+
{ "path": "../blocks/bookmark" },
12+
{ "path": "../blocks/callout" },
13+
{ "path": "../blocks/code" },
14+
{ "path": "../blocks/data-view" },
15+
{ "path": "../blocks/database" },
16+
{ "path": "../blocks/divider" },
17+
{ "path": "../blocks/edgeless-text" },
18+
{ "path": "../blocks/embed" },
19+
{ "path": "../blocks/frame" },
20+
{ "path": "../blocks/image" },
21+
{ "path": "../blocks/latex" },
22+
{ "path": "../blocks/list" },
23+
{ "path": "../blocks/note" },
24+
{ "path": "../blocks/paragraph" },
25+
{ "path": "../blocks/root" },
26+
{ "path": "../blocks/surface" },
27+
{ "path": "../blocks/surface-ref" },
28+
{ "path": "../blocks/table" },
2929
{ "path": "../components" },
30-
{ "path": "../fragments/fragment-doc-title" },
31-
{ "path": "../fragments/fragment-frame-panel" },
32-
{ "path": "../fragments/fragment-outline" },
30+
{ "path": "../fragments/doc-title" },
31+
{ "path": "../fragments/frame-panel" },
32+
{ "path": "../fragments/outline" },
3333
{ "path": "../gfx/brush" },
3434
{ "path": "../gfx/connector" },
3535
{ "path": "../gfx/group" },
@@ -48,14 +48,15 @@
4848
{ "path": "../model" },
4949
{ "path": "../rich-text" },
5050
{ "path": "../shared" },
51-
{ "path": "../widgets/widget-drag-handle" },
52-
{ "path": "../widgets/widget-edgeless-auto-connect" },
53-
{ "path": "../widgets/widget-edgeless-toolbar" },
54-
{ "path": "../widgets/widget-frame-title" },
55-
{ "path": "../widgets/widget-remote-selection" },
56-
{ "path": "../widgets/widget-scroll-anchoring" },
57-
{ "path": "../widgets/widget-slash-menu" },
58-
{ "path": "../widgets/widget-toolbar" },
51+
{ "path": "../widgets/drag-handle" },
52+
{ "path": "../widgets/edgeless-auto-connect" },
53+
{ "path": "../widgets/edgeless-toolbar" },
54+
{ "path": "../widgets/frame-title" },
55+
{ "path": "../widgets/linked-doc" },
56+
{ "path": "../widgets/remote-selection" },
57+
{ "path": "../widgets/scroll-anchoring" },
58+
{ "path": "../widgets/slash-menu" },
59+
{ "path": "../widgets/toolbar" },
5960
{ "path": "../data-view" },
6061
{ "path": "../../framework/global" },
6162
{ "path": "../../framework/std" },

Diff for: packages/affine/blocks/block-image/tsconfig.json renamed to packages/affine/blocks/attachment/tsconfig.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
},
88
"include": ["./src"],
99
"references": [
10-
{ "path": "../block-note" },
11-
{ "path": "../block-surface" },
10+
{ "path": "../embed" },
11+
{ "path": "../surface" },
1212
{ "path": "../../components" },
1313
{ "path": "../../model" },
1414
{ "path": "../../shared" },
15-
{ "path": "../../widgets/widget-slash-menu" },
15+
{ "path": "../../widgets/slash-menu" },
1616
{ "path": "../../../framework/global" },
1717
{ "path": "../../../framework/std" },
1818
{ "path": "../../../framework/store" }

Diff for: packages/affine/blocks/block-frame/tsconfig.json

-20
This file was deleted.

Diff for: packages/affine/blocks/block-latex/src/adapters/markdown/preprocessor.ts

-25
This file was deleted.

Diff for: packages/affine/blocks/block-root/src/edgeless/gfx-tool/template-tool.ts

-11
This file was deleted.

Diff for: packages/affine/blocks/block-root/src/types.ts

-44
This file was deleted.

0 commit comments

Comments
 (0)