@blocknote/core 0.11.2 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -17
- package/dist/blocknote.js +1600 -1403
- package/dist/blocknote.js.map +1 -1
- package/dist/blocknote.umd.cjs +6 -6
- package/dist/blocknote.umd.cjs.map +1 -1
- package/dist/style.css +1 -1
- package/dist/webpack-stats.json +1 -1
- package/package.json +7 -3
- package/src/api/blockManipulation/blockManipulation.test.ts +19 -15
- package/src/api/blockManipulation/blockManipulation.ts +107 -17
- package/src/api/exporters/html/externalHTMLExporter.ts +3 -7
- package/src/api/exporters/html/htmlConversion.test.ts +6 -3
- package/src/api/exporters/html/internalHTMLSerializer.ts +3 -7
- package/src/api/exporters/html/util/sharedHTMLConversion.ts +3 -3
- package/src/api/exporters/markdown/markdownExporter.test.ts +7 -3
- package/src/api/exporters/markdown/markdownExporter.ts +2 -6
- package/src/api/nodeConversions/nodeConversions.test.ts +14 -7
- package/src/api/nodeConversions/nodeConversions.ts +1 -2
- package/src/api/parsers/html/parseHTML.test.ts +5 -1
- package/src/api/parsers/html/parseHTML.ts +2 -6
- package/src/api/parsers/html/util/nestedLists.ts +11 -1
- package/src/api/parsers/markdown/parseMarkdown.test.ts +3 -0
- package/src/api/parsers/markdown/parseMarkdown.ts +2 -6
- package/src/api/testUtil/cases/customBlocks.ts +18 -16
- package/src/api/testUtil/cases/customInlineContent.ts +12 -13
- package/src/api/testUtil/cases/customStyles.ts +12 -10
- package/src/api/testUtil/index.ts +4 -2
- package/src/api/testUtil/partialBlockTestUtil.ts +2 -6
- package/src/blocks/ImageBlockContent/ImageBlockContent.ts +1 -2
- package/src/blocks/ImageBlockContent/uploadToTmpFilesDotOrg_DEV_ONLY.ts +8 -1
- package/src/blocks/defaultBlockHelpers.ts +3 -3
- package/src/blocks/defaultBlockTypeGuards.ts +84 -0
- package/src/blocks/defaultBlocks.ts +29 -3
- package/src/editor/Block.css +2 -31
- package/src/editor/BlockNoteEditor.ts +218 -262
- package/src/editor/BlockNoteExtensions.ts +5 -2
- package/src/editor/BlockNoteSchema.ts +98 -0
- package/src/editor/BlockNoteTipTapEditor.ts +162 -0
- package/src/editor/cursorPositionTypes.ts +2 -6
- package/src/editor/editor.css +0 -1
- package/src/editor/selectionTypes.ts +2 -6
- package/src/extensions/FormattingToolbar/FormattingToolbarPlugin.ts +22 -29
- package/src/extensions/HyperlinkToolbar/HyperlinkToolbarPlugin.ts +26 -27
- package/src/extensions/ImageToolbar/ImageToolbarPlugin.ts +45 -51
- package/src/extensions/Placeholder/PlaceholderExtension.ts +81 -88
- package/src/extensions/SideMenu/SideMenuPlugin.ts +55 -56
- package/src/extensions/SuggestionMenu/DefaultSuggestionItem.ts +8 -0
- package/src/extensions/SuggestionMenu/SuggestionPlugin.ts +353 -0
- package/src/extensions/{SlashMenu/defaultSlashMenuItems.ts → SuggestionMenu/getDefaultSlashMenuItems.ts} +119 -89
- package/src/extensions/TableHandles/TableHandlesPlugin.ts +62 -45
- package/src/extensions-shared/UiElementPosition.ts +4 -0
- package/src/index.ts +6 -6
- package/src/pm-nodes/BlockContainer.ts +5 -5
- package/src/schema/blocks/types.ts +15 -15
- package/src/schema/inlineContent/createSpec.ts +2 -2
- package/src/schema/inlineContent/types.ts +1 -1
- package/src/util/browser.ts +6 -4
- package/src/util/typescript.ts +7 -4
- package/types/src/api/blockManipulation/blockManipulation.d.ts +6 -1
- package/types/src/api/exporters/html/externalHTMLExporter.d.ts +2 -1
- package/types/src/api/exporters/html/internalHTMLSerializer.d.ts +2 -1
- package/types/src/api/exporters/markdown/markdownExporter.d.ts +2 -1
- package/types/src/api/nodeConversions/nodeConversions.d.ts +2 -1
- package/types/src/api/parsers/html/parseHTML.d.ts +2 -1
- package/types/src/api/parsers/markdown/parseMarkdown.d.ts +2 -1
- package/types/src/api/testUtil/cases/customBlocks.d.ts +72 -13
- package/types/src/api/testUtil/cases/customInlineContent.d.ts +281 -6
- package/types/src/api/testUtil/cases/customStyles.d.ts +247 -13
- package/types/src/api/testUtil/index.d.ts +4 -2
- package/types/src/api/testUtil/partialBlockTestUtil.d.ts +2 -1
- package/types/src/blocks/ImageBlockContent/uploadToTmpFilesDotOrg_DEV_ONLY.d.ts +6 -1
- package/types/src/blocks/defaultBlockHelpers.d.ts +2 -2
- package/types/src/blocks/defaultBlockTypeGuards.d.ts +24 -0
- package/types/src/blocks/defaultBlocks.d.ts +21 -15
- package/types/src/editor/BlockNoteEditor.d.ts +48 -53
- package/types/src/editor/BlockNoteExtensions.d.ts +1 -0
- package/types/src/editor/BlockNoteSchema.d.ts +34 -0
- package/types/src/editor/BlockNoteTipTapEditor.d.ts +28 -0
- package/types/src/editor/cursorPositionTypes.d.ts +2 -1
- package/types/src/editor/selectionTypes.d.ts +2 -1
- package/types/src/extensions/FormattingToolbar/FormattingToolbarPlugin.d.ts +5 -6
- package/types/src/extensions/HyperlinkToolbar/HyperlinkToolbarPlugin.d.ts +2 -2
- package/types/src/extensions/ImageToolbar/ImageToolbarPlugin.d.ts +15 -14
- package/types/src/extensions/Placeholder/PlaceholderExtension.d.ts +2 -15
- package/types/src/extensions/SideMenu/SideMenuPlugin.d.ts +8 -7
- package/types/src/extensions/SuggestionMenu/DefaultSuggestionItem.d.ts +8 -0
- package/types/src/extensions/SuggestionMenu/SuggestionPlugin.d.ts +31 -0
- package/types/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.d.ts +10 -0
- package/types/src/extensions/TableHandles/TableHandlesPlugin.d.ts +7 -7
- package/types/src/extensions-shared/UiElementPosition.d.ts +4 -0
- package/types/src/index.d.ts +6 -6
- package/types/src/pm-nodes/BlockContainer.d.ts +3 -2
- package/types/src/pm-nodes/BlockGroup.d.ts +1 -1
- package/types/src/schema/blocks/types.d.ts +15 -15
- package/types/src/schema/inlineContent/types.d.ts +1 -1
- package/types/src/util/browser.d.ts +1 -0
- package/types/src/util/typescript.d.ts +1 -0
- package/src/extensions/SlashMenu/BaseSlashMenuItem.ts +0 -12
- package/src/extensions/SlashMenu/SlashMenuPlugin.ts +0 -53
- package/src/extensions-shared/BaseUiElementTypes.ts +0 -8
- package/src/extensions-shared/README.md +0 -3
- package/src/extensions-shared/suggestion/SuggestionItem.ts +0 -3
- package/src/extensions-shared/suggestion/SuggestionPlugin.ts +0 -448
- package/types/src/extensions/SlashMenu/BaseSlashMenuItem.d.ts +0 -7
- package/types/src/extensions/SlashMenu/SlashMenuPlugin.d.ts +0 -13
- package/types/src/extensions/SlashMenu/defaultSlashMenuItems.d.ts +0 -3
- package/types/src/extensions-shared/BaseUiElementTypes.d.ts +0 -7
- package/types/src/extensions-shared/suggestion/SuggestionItem.d.ts +0 -3
- package/types/src/extensions-shared/suggestion/SuggestionPlugin.d.ts +0 -36
- /package/src/{assets → fonts}/inter-v12-latin/inter-v12-latin-100.woff +0 -0
- /package/src/{assets → fonts}/inter-v12-latin/inter-v12-latin-100.woff2 +0 -0
- /package/src/{assets → fonts}/inter-v12-latin/inter-v12-latin-200.woff +0 -0
- /package/src/{assets → fonts}/inter-v12-latin/inter-v12-latin-200.woff2 +0 -0
- /package/src/{assets → fonts}/inter-v12-latin/inter-v12-latin-300.woff +0 -0
- /package/src/{assets → fonts}/inter-v12-latin/inter-v12-latin-300.woff2 +0 -0
- /package/src/{assets → fonts}/inter-v12-latin/inter-v12-latin-500.woff +0 -0
- /package/src/{assets → fonts}/inter-v12-latin/inter-v12-latin-500.woff2 +0 -0
- /package/src/{assets → fonts}/inter-v12-latin/inter-v12-latin-600.woff +0 -0
- /package/src/{assets → fonts}/inter-v12-latin/inter-v12-latin-600.woff2 +0 -0
- /package/src/{assets → fonts}/inter-v12-latin/inter-v12-latin-700.woff +0 -0
- /package/src/{assets → fonts}/inter-v12-latin/inter-v12-latin-700.woff2 +0 -0
- /package/src/{assets → fonts}/inter-v12-latin/inter-v12-latin-800.woff +0 -0
- /package/src/{assets → fonts}/inter-v12-latin/inter-v12-latin-800.woff2 +0 -0
- /package/src/{assets → fonts}/inter-v12-latin/inter-v12-latin-900.woff +0 -0
- /package/src/{assets → fonts}/inter-v12-latin/inter-v12-latin-900.woff2 +0 -0
- /package/src/{assets → fonts}/inter-v12-latin/inter-v12-latin-regular.woff +0 -0
- /package/src/{assets → fonts}/inter-v12-latin/inter-v12-latin-regular.woff2 +0 -0
- /package/src/{assets/fonts-inter.css → fonts/inter.css} +0 -0
|
@@ -1,12 +1,246 @@
|
|
|
1
1
|
import { EditorTestCases } from "../index";
|
|
2
2
|
import { DefaultBlockSchema, DefaultInlineContentSchema } from "../../../blocks/defaultBlocks";
|
|
3
|
-
import {
|
|
4
|
-
declare const
|
|
5
|
-
|
|
3
|
+
import { BlockNoteSchema } from "../../../editor/BlockNoteSchema";
|
|
4
|
+
declare const schema: BlockNoteSchema<import("../../..").BlockSchemaFromSpecs<{
|
|
5
|
+
paragraph: {
|
|
6
|
+
config: {
|
|
7
|
+
type: "paragraph";
|
|
8
|
+
content: "inline";
|
|
9
|
+
propSchema: {
|
|
10
|
+
backgroundColor: {
|
|
11
|
+
default: "default";
|
|
12
|
+
};
|
|
13
|
+
textColor: {
|
|
14
|
+
default: "default";
|
|
15
|
+
};
|
|
16
|
+
textAlignment: {
|
|
17
|
+
default: "left";
|
|
18
|
+
values: readonly ["left", "center", "right", "justify"];
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
implementation: import("../../..").TiptapBlockImplementation<{
|
|
23
|
+
type: "paragraph";
|
|
24
|
+
content: "inline";
|
|
25
|
+
propSchema: {
|
|
26
|
+
backgroundColor: {
|
|
27
|
+
default: "default";
|
|
28
|
+
};
|
|
29
|
+
textColor: {
|
|
30
|
+
default: "default";
|
|
31
|
+
};
|
|
32
|
+
textAlignment: {
|
|
33
|
+
default: "left";
|
|
34
|
+
values: readonly ["left", "center", "right", "justify"];
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
}, any, import("../../..").InlineContentSchema, import("../../..").StyleSchema>;
|
|
38
|
+
};
|
|
39
|
+
heading: {
|
|
40
|
+
config: {
|
|
41
|
+
type: "heading";
|
|
42
|
+
content: "inline";
|
|
43
|
+
propSchema: {
|
|
44
|
+
level: {
|
|
45
|
+
default: number;
|
|
46
|
+
values: readonly [1, 2, 3];
|
|
47
|
+
};
|
|
48
|
+
backgroundColor: {
|
|
49
|
+
default: "default";
|
|
50
|
+
};
|
|
51
|
+
textColor: {
|
|
52
|
+
default: "default";
|
|
53
|
+
};
|
|
54
|
+
textAlignment: {
|
|
55
|
+
default: "left";
|
|
56
|
+
values: readonly ["left", "center", "right", "justify"];
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
implementation: import("../../..").TiptapBlockImplementation<{
|
|
61
|
+
type: "heading";
|
|
62
|
+
content: "inline";
|
|
63
|
+
propSchema: {
|
|
64
|
+
level: {
|
|
65
|
+
default: number;
|
|
66
|
+
values: readonly [1, 2, 3];
|
|
67
|
+
};
|
|
68
|
+
backgroundColor: {
|
|
69
|
+
default: "default";
|
|
70
|
+
};
|
|
71
|
+
textColor: {
|
|
72
|
+
default: "default";
|
|
73
|
+
};
|
|
74
|
+
textAlignment: {
|
|
75
|
+
default: "left";
|
|
76
|
+
values: readonly ["left", "center", "right", "justify"];
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
}, any, import("../../..").InlineContentSchema, import("../../..").StyleSchema>;
|
|
80
|
+
};
|
|
81
|
+
bulletListItem: {
|
|
82
|
+
config: {
|
|
83
|
+
type: "bulletListItem";
|
|
84
|
+
content: "inline";
|
|
85
|
+
propSchema: {
|
|
86
|
+
backgroundColor: {
|
|
87
|
+
default: "default";
|
|
88
|
+
};
|
|
89
|
+
textColor: {
|
|
90
|
+
default: "default";
|
|
91
|
+
};
|
|
92
|
+
textAlignment: {
|
|
93
|
+
default: "left";
|
|
94
|
+
values: readonly ["left", "center", "right", "justify"];
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
implementation: import("../../..").TiptapBlockImplementation<{
|
|
99
|
+
type: "bulletListItem";
|
|
100
|
+
content: "inline";
|
|
101
|
+
propSchema: {
|
|
102
|
+
backgroundColor: {
|
|
103
|
+
default: "default";
|
|
104
|
+
};
|
|
105
|
+
textColor: {
|
|
106
|
+
default: "default";
|
|
107
|
+
};
|
|
108
|
+
textAlignment: {
|
|
109
|
+
default: "left";
|
|
110
|
+
values: readonly ["left", "center", "right", "justify"];
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
}, any, import("../../..").InlineContentSchema, import("../../..").StyleSchema>;
|
|
114
|
+
};
|
|
115
|
+
numberedListItem: {
|
|
116
|
+
config: {
|
|
117
|
+
type: "numberedListItem";
|
|
118
|
+
content: "inline";
|
|
119
|
+
propSchema: {
|
|
120
|
+
backgroundColor: {
|
|
121
|
+
default: "default";
|
|
122
|
+
};
|
|
123
|
+
textColor: {
|
|
124
|
+
default: "default";
|
|
125
|
+
};
|
|
126
|
+
textAlignment: {
|
|
127
|
+
default: "left";
|
|
128
|
+
values: readonly ["left", "center", "right", "justify"];
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
implementation: import("../../..").TiptapBlockImplementation<{
|
|
133
|
+
type: "numberedListItem";
|
|
134
|
+
content: "inline";
|
|
135
|
+
propSchema: {
|
|
136
|
+
backgroundColor: {
|
|
137
|
+
default: "default";
|
|
138
|
+
};
|
|
139
|
+
textColor: {
|
|
140
|
+
default: "default";
|
|
141
|
+
};
|
|
142
|
+
textAlignment: {
|
|
143
|
+
default: "left";
|
|
144
|
+
values: readonly ["left", "center", "right", "justify"];
|
|
145
|
+
};
|
|
146
|
+
};
|
|
147
|
+
}, any, import("../../..").InlineContentSchema, import("../../..").StyleSchema>;
|
|
148
|
+
};
|
|
149
|
+
image: {
|
|
150
|
+
config: {
|
|
151
|
+
type: "image";
|
|
152
|
+
propSchema: {
|
|
153
|
+
textAlignment: {
|
|
154
|
+
default: "left";
|
|
155
|
+
values: readonly ["left", "center", "right", "justify"];
|
|
156
|
+
};
|
|
157
|
+
backgroundColor: {
|
|
158
|
+
default: "default";
|
|
159
|
+
};
|
|
160
|
+
url: {
|
|
161
|
+
default: "";
|
|
162
|
+
};
|
|
163
|
+
caption: {
|
|
164
|
+
default: "";
|
|
165
|
+
};
|
|
166
|
+
width: {
|
|
167
|
+
default: 512;
|
|
168
|
+
};
|
|
169
|
+
};
|
|
170
|
+
content: "none";
|
|
171
|
+
};
|
|
172
|
+
implementation: import("../../..").TiptapBlockImplementation<{
|
|
173
|
+
type: "image";
|
|
174
|
+
propSchema: {
|
|
175
|
+
textAlignment: {
|
|
176
|
+
default: "left";
|
|
177
|
+
values: readonly ["left", "center", "right", "justify"];
|
|
178
|
+
};
|
|
179
|
+
backgroundColor: {
|
|
180
|
+
default: "default";
|
|
181
|
+
};
|
|
182
|
+
url: {
|
|
183
|
+
default: "";
|
|
184
|
+
};
|
|
185
|
+
caption: {
|
|
186
|
+
default: "";
|
|
187
|
+
};
|
|
188
|
+
width: {
|
|
189
|
+
default: 512;
|
|
190
|
+
};
|
|
191
|
+
};
|
|
192
|
+
content: "none";
|
|
193
|
+
}, any, import("../../..").InlineContentSchema, import("../../..").StyleSchema>;
|
|
194
|
+
};
|
|
195
|
+
table: {
|
|
196
|
+
config: {
|
|
197
|
+
type: "table";
|
|
198
|
+
content: "table";
|
|
199
|
+
propSchema: {
|
|
200
|
+
backgroundColor: {
|
|
201
|
+
default: "default";
|
|
202
|
+
};
|
|
203
|
+
textColor: {
|
|
204
|
+
default: "default";
|
|
205
|
+
};
|
|
206
|
+
textAlignment: {
|
|
207
|
+
default: "left";
|
|
208
|
+
values: readonly ["left", "center", "right", "justify"];
|
|
209
|
+
};
|
|
210
|
+
};
|
|
211
|
+
};
|
|
212
|
+
implementation: import("../../..").TiptapBlockImplementation<{
|
|
213
|
+
type: "table";
|
|
214
|
+
content: "table";
|
|
215
|
+
propSchema: {
|
|
216
|
+
backgroundColor: {
|
|
217
|
+
default: "default";
|
|
218
|
+
};
|
|
219
|
+
textColor: {
|
|
220
|
+
default: "default";
|
|
221
|
+
};
|
|
222
|
+
textAlignment: {
|
|
223
|
+
default: "left";
|
|
224
|
+
values: readonly ["left", "center", "right", "justify"];
|
|
225
|
+
};
|
|
226
|
+
};
|
|
227
|
+
}, any, import("../../..").InlineContentSchema, import("../../..").StyleSchema>;
|
|
228
|
+
};
|
|
229
|
+
}>, import("../../..").InlineContentSchemaFromSpecs<{
|
|
230
|
+
text: {
|
|
231
|
+
config: "text";
|
|
232
|
+
implementation: any;
|
|
233
|
+
};
|
|
234
|
+
link: {
|
|
235
|
+
config: "link";
|
|
236
|
+
implementation: any;
|
|
237
|
+
};
|
|
238
|
+
}>, import("../../..").StyleSchemaFromSpecs<{
|
|
239
|
+
small: import("../../..").StyleSpec<{
|
|
6
240
|
type: string;
|
|
7
241
|
propSchema: "boolean";
|
|
8
242
|
}>;
|
|
9
|
-
fontSize: import("
|
|
243
|
+
fontSize: import("../../..").StyleSpec<{
|
|
10
244
|
type: string;
|
|
11
245
|
propSchema: "string";
|
|
12
246
|
}>;
|
|
@@ -15,50 +249,50 @@ declare const customStyles: {
|
|
|
15
249
|
type: string;
|
|
16
250
|
propSchema: "boolean";
|
|
17
251
|
};
|
|
18
|
-
implementation: import("
|
|
252
|
+
implementation: import("../../..").StyleImplementation;
|
|
19
253
|
};
|
|
20
254
|
italic: {
|
|
21
255
|
config: {
|
|
22
256
|
type: string;
|
|
23
257
|
propSchema: "boolean";
|
|
24
258
|
};
|
|
25
|
-
implementation: import("
|
|
259
|
+
implementation: import("../../..").StyleImplementation;
|
|
26
260
|
};
|
|
27
261
|
underline: {
|
|
28
262
|
config: {
|
|
29
263
|
type: string;
|
|
30
264
|
propSchema: "boolean";
|
|
31
265
|
};
|
|
32
|
-
implementation: import("
|
|
266
|
+
implementation: import("../../..").StyleImplementation;
|
|
33
267
|
};
|
|
34
268
|
strike: {
|
|
35
269
|
config: {
|
|
36
270
|
type: string;
|
|
37
271
|
propSchema: "boolean";
|
|
38
272
|
};
|
|
39
|
-
implementation: import("
|
|
273
|
+
implementation: import("../../..").StyleImplementation;
|
|
40
274
|
};
|
|
41
275
|
code: {
|
|
42
276
|
config: {
|
|
43
277
|
type: string;
|
|
44
278
|
propSchema: "boolean";
|
|
45
279
|
};
|
|
46
|
-
implementation: import("
|
|
280
|
+
implementation: import("../../..").StyleImplementation;
|
|
47
281
|
};
|
|
48
282
|
textColor: {
|
|
49
283
|
config: {
|
|
50
284
|
type: string;
|
|
51
285
|
propSchema: "string";
|
|
52
286
|
};
|
|
53
|
-
implementation: import("
|
|
287
|
+
implementation: import("../../..").StyleImplementation;
|
|
54
288
|
};
|
|
55
289
|
backgroundColor: {
|
|
56
290
|
config: {
|
|
57
291
|
type: string;
|
|
58
292
|
propSchema: "string";
|
|
59
293
|
};
|
|
60
|
-
implementation: import("
|
|
294
|
+
implementation: import("../../..").StyleImplementation;
|
|
61
295
|
};
|
|
62
|
-
}
|
|
63
|
-
export declare const customStylesTestCases: EditorTestCases<DefaultBlockSchema, DefaultInlineContentSchema,
|
|
296
|
+
}>>;
|
|
297
|
+
export declare const customStylesTestCases: EditorTestCases<DefaultBlockSchema, DefaultInlineContentSchema, typeof schema.styleSchema>;
|
|
64
298
|
export {};
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
+
import { PartialBlock } from "../../blocks/defaultBlocks";
|
|
1
2
|
import { BlockNoteEditor } from "../../editor/BlockNoteEditor";
|
|
2
|
-
import { BlockSchema
|
|
3
|
+
import { BlockSchema } from "../../schema/blocks/types";
|
|
3
4
|
import { InlineContentSchema } from "../../schema/inlineContent/types";
|
|
4
5
|
import { StyleSchema } from "../../schema/styles/types";
|
|
6
|
+
import { NoInfer } from "../../util/typescript";
|
|
5
7
|
export type EditorTestCases<B extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema> = {
|
|
6
8
|
name: string;
|
|
7
9
|
createEditor: () => BlockNoteEditor<B, I, S>;
|
|
8
10
|
documents: Array<{
|
|
9
11
|
name: string;
|
|
10
|
-
blocks: PartialBlock<B
|
|
12
|
+
blocks: PartialBlock<NoInfer<B>, NoInfer<I>, NoInfer<S>>[];
|
|
11
13
|
}>;
|
|
12
14
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Block,
|
|
1
|
+
import { Block, PartialBlock } from "../../blocks/defaultBlocks";
|
|
2
|
+
import { BlockSchema } from "../../schema/blocks/types";
|
|
2
3
|
import { InlineContentSchema } from "../../schema/inlineContent/types";
|
|
3
4
|
import { StyleSchema } from "../../schema/styles/types";
|
|
4
5
|
export declare function partialBlocksToBlocksForTesting<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema>(schema: BSchema, partialBlocks: Array<PartialBlock<BSchema, I, S>>): Array<Block<BSchema, I, S>>;
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Uploads a file to tmpfiles.org and returns the URL to the uploaded file.
|
|
3
|
+
*
|
|
4
|
+
* @warning This function should only be used for development purposes, replace with your own backend!
|
|
5
|
+
*/
|
|
6
|
+
export declare const uploadToTmpFilesDotOrg_DEV_ONLY: (file: File) => Promise<string>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { BlockNoteEditor } from "../editor/BlockNoteEditor";
|
|
2
|
-
import type {
|
|
2
|
+
import type { BlockNoDefaults, InlineContentSchema, StyleSchema } from "../schema";
|
|
3
3
|
export declare function createDefaultBlockDOMOutputSpec(blockName: string, htmlTag: string, blockContentHTMLAttributes: Record<string, string>, inlineContentHTMLAttributes: Record<string, string>): {
|
|
4
4
|
dom: HTMLDivElement;
|
|
5
5
|
contentDOM: HTMLElement;
|
|
6
6
|
};
|
|
7
|
-
export declare const defaultBlockToHTML: <BSchema extends Record<string, import("../schema").BlockConfig>, I extends InlineContentSchema, S extends StyleSchema>(block:
|
|
7
|
+
export declare const defaultBlockToHTML: <BSchema extends Record<string, import("../schema").BlockConfig>, I extends InlineContentSchema, S extends StyleSchema>(block: BlockNoDefaults<BSchema, I, S>, editor: BlockNoteEditor<BSchema, I, S>) => {
|
|
8
8
|
dom: HTMLElement;
|
|
9
9
|
contentDOM?: HTMLElement;
|
|
10
10
|
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { BlockNoteEditor } from "../editor/BlockNoteEditor";
|
|
2
|
+
import { BlockFromConfig, InlineContentSchema, StyleSchema } from "../schema";
|
|
3
|
+
import { Block, DefaultBlockSchema } from "./defaultBlocks";
|
|
4
|
+
import { defaultProps } from "./defaultProps";
|
|
5
|
+
export declare function checkDefaultBlockTypeInSchema<BlockType extends keyof DefaultBlockSchema, I extends InlineContentSchema, S extends StyleSchema>(blockType: BlockType, editor: BlockNoteEditor<any, I, S>): editor is BlockNoteEditor<{
|
|
6
|
+
Type: DefaultBlockSchema[BlockType];
|
|
7
|
+
}, I, S>;
|
|
8
|
+
export declare function checkBlockIsDefaultType<BlockType extends keyof DefaultBlockSchema, I extends InlineContentSchema, S extends StyleSchema>(blockType: BlockType, block: Block<any, I, S>, editor: BlockNoteEditor<any, I, S>): block is BlockFromConfig<DefaultBlockSchema[BlockType], I, S>;
|
|
9
|
+
export declare function checkBlockTypeHasDefaultProp<Prop extends keyof typeof defaultProps, I extends InlineContentSchema, S extends StyleSchema>(prop: Prop, blockType: string, editor: BlockNoteEditor<any, I, S>): editor is BlockNoteEditor<{
|
|
10
|
+
[BT in string]: {
|
|
11
|
+
type: BT;
|
|
12
|
+
propSchema: {
|
|
13
|
+
[P in Prop]: (typeof defaultProps)[P];
|
|
14
|
+
};
|
|
15
|
+
content: "table" | "inline" | "none";
|
|
16
|
+
};
|
|
17
|
+
}, I, S>;
|
|
18
|
+
export declare function checkBlockHasDefaultProp<Prop extends keyof typeof defaultProps, I extends InlineContentSchema, S extends StyleSchema>(prop: Prop, block: Block<any, I, S>, editor: BlockNoteEditor<any, I, S>): block is BlockFromConfig<{
|
|
19
|
+
type: string;
|
|
20
|
+
propSchema: {
|
|
21
|
+
[P in Prop]: (typeof defaultProps)[P];
|
|
22
|
+
};
|
|
23
|
+
content: "table" | "inline" | "none";
|
|
24
|
+
}, I, S>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BlockNoDefaults, BlockSchema, InlineContentSchema, PartialBlockNoDefaults, StyleSchema } from "../schema";
|
|
1
2
|
export declare const defaultBlockSpecs: {
|
|
2
3
|
paragraph: {
|
|
3
4
|
config: {
|
|
@@ -31,7 +32,7 @@ export declare const defaultBlockSpecs: {
|
|
|
31
32
|
values: readonly ["left", "center", "right", "justify"];
|
|
32
33
|
};
|
|
33
34
|
};
|
|
34
|
-
}, any,
|
|
35
|
+
}, any, InlineContentSchema, StyleSchema>;
|
|
35
36
|
};
|
|
36
37
|
heading: {
|
|
37
38
|
config: {
|
|
@@ -73,7 +74,7 @@ export declare const defaultBlockSpecs: {
|
|
|
73
74
|
values: readonly ["left", "center", "right", "justify"];
|
|
74
75
|
};
|
|
75
76
|
};
|
|
76
|
-
}, any,
|
|
77
|
+
}, any, InlineContentSchema, StyleSchema>;
|
|
77
78
|
};
|
|
78
79
|
bulletListItem: {
|
|
79
80
|
config: {
|
|
@@ -107,7 +108,7 @@ export declare const defaultBlockSpecs: {
|
|
|
107
108
|
values: readonly ["left", "center", "right", "justify"];
|
|
108
109
|
};
|
|
109
110
|
};
|
|
110
|
-
}, any,
|
|
111
|
+
}, any, InlineContentSchema, StyleSchema>;
|
|
111
112
|
};
|
|
112
113
|
numberedListItem: {
|
|
113
114
|
config: {
|
|
@@ -141,7 +142,7 @@ export declare const defaultBlockSpecs: {
|
|
|
141
142
|
values: readonly ["left", "center", "right", "justify"];
|
|
142
143
|
};
|
|
143
144
|
};
|
|
144
|
-
}, any,
|
|
145
|
+
}, any, InlineContentSchema, StyleSchema>;
|
|
145
146
|
};
|
|
146
147
|
image: {
|
|
147
148
|
config: {
|
|
@@ -187,7 +188,7 @@ export declare const defaultBlockSpecs: {
|
|
|
187
188
|
};
|
|
188
189
|
};
|
|
189
190
|
content: "none";
|
|
190
|
-
}, any,
|
|
191
|
+
}, any, InlineContentSchema, StyleSchema>;
|
|
191
192
|
};
|
|
192
193
|
table: {
|
|
193
194
|
config: {
|
|
@@ -221,7 +222,7 @@ export declare const defaultBlockSpecs: {
|
|
|
221
222
|
values: readonly ["left", "center", "right", "justify"];
|
|
222
223
|
};
|
|
223
224
|
};
|
|
224
|
-
}, any,
|
|
225
|
+
}, any, InlineContentSchema, StyleSchema>;
|
|
225
226
|
};
|
|
226
227
|
};
|
|
227
228
|
export declare const defaultBlockSchema: import("../schema").BlockSchemaFromSpecs<{
|
|
@@ -257,7 +258,7 @@ export declare const defaultBlockSchema: import("../schema").BlockSchemaFromSpec
|
|
|
257
258
|
values: readonly ["left", "center", "right", "justify"];
|
|
258
259
|
};
|
|
259
260
|
};
|
|
260
|
-
}, any,
|
|
261
|
+
}, any, InlineContentSchema, StyleSchema>;
|
|
261
262
|
};
|
|
262
263
|
heading: {
|
|
263
264
|
config: {
|
|
@@ -299,7 +300,7 @@ export declare const defaultBlockSchema: import("../schema").BlockSchemaFromSpec
|
|
|
299
300
|
values: readonly ["left", "center", "right", "justify"];
|
|
300
301
|
};
|
|
301
302
|
};
|
|
302
|
-
}, any,
|
|
303
|
+
}, any, InlineContentSchema, StyleSchema>;
|
|
303
304
|
};
|
|
304
305
|
bulletListItem: {
|
|
305
306
|
config: {
|
|
@@ -333,7 +334,7 @@ export declare const defaultBlockSchema: import("../schema").BlockSchemaFromSpec
|
|
|
333
334
|
values: readonly ["left", "center", "right", "justify"];
|
|
334
335
|
};
|
|
335
336
|
};
|
|
336
|
-
}, any,
|
|
337
|
+
}, any, InlineContentSchema, StyleSchema>;
|
|
337
338
|
};
|
|
338
339
|
numberedListItem: {
|
|
339
340
|
config: {
|
|
@@ -367,7 +368,7 @@ export declare const defaultBlockSchema: import("../schema").BlockSchemaFromSpec
|
|
|
367
368
|
values: readonly ["left", "center", "right", "justify"];
|
|
368
369
|
};
|
|
369
370
|
};
|
|
370
|
-
}, any,
|
|
371
|
+
}, any, InlineContentSchema, StyleSchema>;
|
|
371
372
|
};
|
|
372
373
|
image: {
|
|
373
374
|
config: {
|
|
@@ -413,7 +414,7 @@ export declare const defaultBlockSchema: import("../schema").BlockSchemaFromSpec
|
|
|
413
414
|
};
|
|
414
415
|
};
|
|
415
416
|
content: "none";
|
|
416
|
-
}, any,
|
|
417
|
+
}, any, InlineContentSchema, StyleSchema>;
|
|
417
418
|
};
|
|
418
419
|
table: {
|
|
419
420
|
config: {
|
|
@@ -447,10 +448,11 @@ export declare const defaultBlockSchema: import("../schema").BlockSchemaFromSpec
|
|
|
447
448
|
values: readonly ["left", "center", "right", "justify"];
|
|
448
449
|
};
|
|
449
450
|
};
|
|
450
|
-
}, any,
|
|
451
|
+
}, any, InlineContentSchema, StyleSchema>;
|
|
451
452
|
};
|
|
452
453
|
}>;
|
|
453
|
-
export type
|
|
454
|
+
export type _DefaultBlockSchema = typeof defaultBlockSchema;
|
|
455
|
+
export type DefaultBlockSchema = _DefaultBlockSchema;
|
|
454
456
|
export declare const defaultStyleSpecs: {
|
|
455
457
|
bold: {
|
|
456
458
|
config: {
|
|
@@ -553,7 +555,8 @@ export declare const defaultStyleSchema: import("../schema").StyleSchemaFromSpec
|
|
|
553
555
|
implementation: import("../schema").StyleImplementation;
|
|
554
556
|
};
|
|
555
557
|
}>;
|
|
556
|
-
export type
|
|
558
|
+
export type _DefaultStyleSchema = typeof defaultStyleSchema;
|
|
559
|
+
export type DefaultStyleSchema = _DefaultStyleSchema;
|
|
557
560
|
export declare const defaultInlineContentSpecs: {
|
|
558
561
|
text: {
|
|
559
562
|
config: "text";
|
|
@@ -574,4 +577,7 @@ export declare const defaultInlineContentSchema: import("../schema").InlineConte
|
|
|
574
577
|
implementation: any;
|
|
575
578
|
};
|
|
576
579
|
}>;
|
|
577
|
-
export type
|
|
580
|
+
export type _DefaultInlineContentSchema = typeof defaultInlineContentSchema;
|
|
581
|
+
export type DefaultInlineContentSchema = _DefaultInlineContentSchema;
|
|
582
|
+
export type PartialBlock<BSchema extends BlockSchema = DefaultBlockSchema, I extends InlineContentSchema = DefaultInlineContentSchema, S extends StyleSchema = DefaultStyleSchema> = PartialBlockNoDefaults<BSchema, I, S>;
|
|
583
|
+
export type Block<BSchema extends BlockSchema = DefaultBlockSchema, I extends InlineContentSchema = DefaultInlineContentSchema, S extends StyleSchema = DefaultStyleSchema> = BlockNoDefaults<BSchema, I, S>;
|