@blocknote/core 0.13.2 → 0.13.4
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/dist/blocknote.js +5730 -2891
- package/dist/blocknote.js.map +1 -1
- package/dist/blocknote.umd.cjs +7 -7
- package/dist/blocknote.umd.cjs.map +1 -1
- package/dist/style.css +1 -1
- package/dist/webpack-stats.json +1 -1
- package/package.json +2 -2
- package/src/api/exporters/html/__snapshots__/file/basic/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/file/basic/internal.html +1 -0
- package/src/api/exporters/html/__snapshots__/file/button/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/file/button/internal.html +1 -0
- package/src/api/exporters/html/__snapshots__/file/nested/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/file/nested/internal.html +1 -0
- package/src/api/exporters/html/__snapshots__/file/noCaption/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/file/noCaption/internal.html +1 -0
- package/src/api/exporters/html/__snapshots__/file/noName/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/file/noName/internal.html +1 -0
- package/src/api/exporters/html/__snapshots__/image/basic/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/image/basic/internal.html +1 -1
- package/src/api/exporters/html/__snapshots__/image/button/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/image/button/internal.html +1 -1
- package/src/api/exporters/html/__snapshots__/image/nested/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/image/nested/internal.html +1 -1
- package/src/api/exporters/html/__snapshots__/image/noCaption/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/image/noCaption/internal.html +1 -0
- package/src/api/exporters/html/__snapshots__/image/noName/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/image/noName/internal.html +1 -0
- package/src/api/exporters/html/__snapshots__/image/noPreview/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/image/noPreview/internal.html +1 -0
- package/src/api/exporters/html/__snapshots__/lists/basic/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/lists/basic/internal.html +1 -0
- package/src/api/exporters/html/__snapshots__/lists/nested/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/lists/nested/internal.html +1 -0
- package/src/api/exporters/html/__snapshots__/simpleFile/basic/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/simpleFile/basic/internal.html +1 -0
- package/src/api/exporters/html/__snapshots__/simpleFile/button/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/simpleFile/button/internal.html +1 -0
- package/src/api/exporters/html/__snapshots__/simpleFile/nested/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/simpleFile/nested/internal.html +1 -0
- package/src/api/exporters/html/__snapshots__/simpleImage/basic/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/simpleImage/basic/internal.html +1 -1
- package/src/api/exporters/html/__snapshots__/simpleImage/button/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/simpleImage/button/internal.html +1 -1
- package/src/api/exporters/html/__snapshots__/simpleImage/nested/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/simpleImage/nested/internal.html +1 -1
- package/src/api/exporters/html/__snapshots__/simpleImage/noCaption/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/simpleImage/noCaption/internal.html +1 -0
- package/src/api/exporters/html/__snapshots__/simpleImage/noName/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/simpleImage/noName/internal.html +1 -0
- package/src/api/exporters/html/__snapshots__/simpleImage/noPreview/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/simpleImage/noPreview/internal.html +1 -0
- package/src/api/exporters/html/externalHTMLExporter.ts +4 -3
- package/src/api/exporters/html/util/simplifyBlocksRehypePlugin.ts +1 -1
- package/src/api/exporters/markdown/__snapshots__/file/basic/markdown.md +3 -0
- package/src/api/exporters/markdown/__snapshots__/file/button/markdown.md +1 -0
- package/src/api/exporters/markdown/__snapshots__/file/nested/markdown.md +7 -0
- package/src/api/exporters/markdown/__snapshots__/file/noCaption/markdown.md +1 -0
- package/src/api/exporters/markdown/__snapshots__/file/noName/markdown.md +3 -0
- package/src/api/exporters/markdown/__snapshots__/image/basic/markdown.md +1 -1
- package/src/api/exporters/markdown/__snapshots__/image/button/markdown.md +1 -1
- package/src/api/exporters/markdown/__snapshots__/image/nested/markdown.md +2 -2
- package/src/api/exporters/markdown/__snapshots__/image/noCaption/markdown.md +1 -0
- package/src/api/exporters/markdown/__snapshots__/image/noName/markdown.md +3 -0
- package/src/api/exporters/markdown/__snapshots__/image/noPreview/markdown.md +3 -0
- package/src/api/exporters/markdown/__snapshots__/lists/basic/markdown.md +8 -0
- package/src/api/exporters/markdown/__snapshots__/lists/nested/markdown.md +10 -0
- package/src/api/exporters/markdown/__snapshots__/simpleFile/basic/markdown.md +3 -0
- package/src/api/exporters/markdown/__snapshots__/simpleFile/button/markdown.md +1 -0
- package/src/api/exporters/markdown/__snapshots__/simpleFile/nested/markdown.md +7 -0
- package/src/api/exporters/markdown/__snapshots__/simpleImage/basic/markdown.md +3 -1
- package/src/api/exporters/markdown/__snapshots__/simpleImage/button/markdown.md +1 -0
- package/src/api/exporters/markdown/__snapshots__/simpleImage/nested/markdown.md +6 -2
- package/src/api/exporters/markdown/__snapshots__/simpleImage/noCaption/markdown.md +1 -0
- package/src/api/exporters/markdown/__snapshots__/simpleImage/noName/markdown.md +3 -0
- package/src/api/exporters/markdown/__snapshots__/simpleImage/noPreview/markdown.md +3 -0
- package/src/api/exporters/markdown/markdownExporter.ts +2 -0
- package/src/api/exporters/markdown/util/addSpacesToCheckboxesRehypePlugin.ts +42 -0
- package/src/api/nodeConversions/__snapshots__/nodeConversions.test.ts.snap +262 -4
- package/src/api/parsers/html/__snapshots__/paste/list-test.json +74 -2
- package/src/api/parsers/html/__snapshots__/paste/parse-basic-block-types.json +3 -1
- package/src/api/parsers/html/__snapshots__/paste/parse-fake-image-caption.json +3 -1
- package/src/api/parsers/html/__snapshots__/paste/parse-mixed-nested-lists.json +135 -10
- package/src/api/parsers/html/__snapshots__/paste/parse-nested-lists-with-paragraphs.json +132 -7
- package/src/api/parsers/html/__snapshots__/paste/parse-nested-lists.json +111 -3
- package/src/api/parsers/html/parseHTML.test.ts +166 -95
- package/src/api/testUtil/cases/customBlocks.ts +82 -33
- package/src/api/testUtil/cases/customInlineContent.ts +1 -1
- package/src/api/testUtil/cases/customStyles.ts +1 -1
- package/src/api/testUtil/cases/defaultSchema.ts +185 -4
- package/src/blocks/AudioBlockContent/AudioBlockContent.ts +163 -0
- package/src/blocks/AudioBlockContent/audioBlockHelpers.ts +5 -0
- package/src/blocks/FileBlockContent/FileBlockContent.ts +120 -0
- package/src/blocks/FileBlockContent/fileBlockHelpers.ts +377 -0
- package/src/blocks/ImageBlockContent/ImageBlockContent.ts +134 -354
- package/src/blocks/ImageBlockContent/imageBlockHelpers.ts +6 -0
- package/src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.ts +3 -0
- package/src/blocks/ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.ts +266 -0
- package/src/blocks/ListItemBlockContent/ListItemKeyboardShortcuts.ts +2 -1
- package/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.ts +1 -0
- package/src/blocks/VideoBlockContent/VideoBlockContent.ts +181 -0
- package/src/blocks/VideoBlockContent/videoBlockHelpers.ts +6 -0
- package/src/blocks/defaultBlockTypeGuards.ts +53 -1
- package/src/blocks/defaultBlocks.ts +11 -2
- package/src/editor/Block.css +89 -27
- package/src/editor/BlockNoteEditor.ts +24 -10
- package/src/editor/BlockNoteSchema.ts +12 -3
- package/src/editor/transformPasted.ts +2 -1
- package/src/extensions/{ImagePanel/ImageToolbarPlugin.ts → FilePanel/FilePanelPlugin.ts} +22 -25
- package/src/extensions/FormattingToolbar/FormattingToolbarPlugin.ts +14 -2
- package/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts +72 -2
- package/src/extensions/TableHandles/TableHandlesPlugin.ts +27 -27
- package/src/extensions/TextAlignment/TextAlignmentExtension.ts +7 -1
- package/src/i18n/locales/en.ts +117 -11
- package/src/i18n/locales/fr.ts +118 -11
- package/src/i18n/locales/index.ts +8 -2
- package/src/i18n/locales/is.ts +295 -0
- package/src/i18n/locales/ja.ts +323 -0
- package/src/i18n/locales/ko.ts +307 -0
- package/src/i18n/locales/nl.ts +108 -8
- package/src/i18n/locales/pl.ts +287 -0
- package/src/i18n/locales/pt.ts +295 -0
- package/src/i18n/locales/vi.ts +295 -0
- package/src/i18n/locales/zh.ts +123 -8
- package/src/index.ts +9 -2
- package/src/pm-nodes/BlockContainer.ts +18 -6
- package/src/schema/blocks/createSpec.ts +1 -0
- package/src/schema/blocks/internal.ts +10 -0
- package/src/schema/blocks/types.ts +40 -5
- package/src/util/string.ts +12 -0
- package/types/src/api/exporters/markdown/util/addSpacesToCheckboxesRehypePlugin.d.ts +7 -0
- package/types/src/api/testUtil/cases/customBlocks.d.ts +272 -54
- package/types/src/api/testUtil/cases/customInlineContent.d.ts +222 -16
- package/types/src/api/testUtil/cases/customStyles.d.ts +222 -16
- package/types/src/blocks/AudioBlockContent/AudioBlockContent.d.ts +101 -0
- package/types/src/blocks/AudioBlockContent/audioBlockHelpers.d.ts +3 -0
- package/types/src/blocks/FileBlockContent/FileBlockContent.d.ts +93 -0
- package/types/src/blocks/FileBlockContent/fileBlockHelpers.d.ts +30 -0
- package/types/src/blocks/ImageBlockContent/ImageBlockContent.d.ts +50 -14
- package/types/src/blocks/ImageBlockContent/imageBlockHelpers.d.ts +4 -0
- package/types/src/blocks/ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.d.ts +55 -0
- package/types/src/blocks/VideoBlockContent/VideoBlockContent.d.ts +129 -0
- package/types/src/blocks/VideoBlockContent/videoBlockHelpers.d.ts +4 -0
- package/types/src/blocks/defaultBlockTypeGuards.d.ts +6 -1
- package/types/src/blocks/defaultBlocks.d.ts +444 -32
- package/types/src/editor/BlockNoteEditor.d.ts +12 -5
- package/types/src/extensions/{ImagePanel/ImageToolbarPlugin.d.ts → FilePanel/FilePanelPlugin.d.ts} +9 -12
- package/types/src/extensions/TableHandles/TableHandlesPlugin.d.ts +1 -1
- package/types/src/i18n/locales/en.d.ts +56 -7
- package/types/src/i18n/locales/fr.d.ts +2 -184
- package/types/src/i18n/locales/index.d.ts +7 -1
- package/types/src/i18n/locales/is.d.ts +2 -0
- package/types/src/i18n/locales/ja.d.ts +2 -0
- package/types/src/i18n/locales/ko.d.ts +2 -0
- package/types/src/i18n/locales/pl.d.ts +2 -0
- package/types/src/i18n/locales/pt.d.ts +2 -0
- package/types/src/i18n/locales/vi.d.ts +2 -0
- package/types/src/index.d.ts +8 -2
- package/types/src/pm-nodes/BlockContainer.d.ts +1 -1
- package/types/src/schema/blocks/internal.d.ts +1 -1
- package/types/src/schema/blocks/types.d.ts +25 -1
- package/types/src/util/string.d.ts +1 -0
- /package/src/blocks/{ImageBlockContent → FileBlockContent}/uploadToTmpFilesDotOrg_DEV_ONLY.ts +0 -0
- /package/types/src/blocks/{ImageBlockContent → FileBlockContent}/uploadToTmpFilesDotOrg_DEV_ONLY.d.ts +0 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Element as HASTElement, Parent as HASTParent } from "hast";
|
|
2
|
+
import { fromDom } from "hast-util-from-dom";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Rehype plugin which adds a space after each checkbox input element. This is
|
|
6
|
+
* because remark doesn't add any spaces between the checkbox input and the text
|
|
7
|
+
* itself, but these are needed for correct Markdown syntax.
|
|
8
|
+
*/
|
|
9
|
+
export function addSpacesToCheckboxes() {
|
|
10
|
+
const helper = (tree: HASTParent) => {
|
|
11
|
+
if (tree.children && "length" in tree.children && tree.children.length) {
|
|
12
|
+
for (let i = tree.children.length - 1; i >= 0; i--) {
|
|
13
|
+
const child = tree.children[i];
|
|
14
|
+
const nextChild =
|
|
15
|
+
i + 1 < tree.children.length ? tree.children[i + 1] : undefined;
|
|
16
|
+
|
|
17
|
+
// Checks for paragraph element after checkbox input element.
|
|
18
|
+
if (
|
|
19
|
+
child.type === "element" &&
|
|
20
|
+
child.tagName === "input" &&
|
|
21
|
+
child.properties?.type === "checkbox" &&
|
|
22
|
+
nextChild?.type === "element" &&
|
|
23
|
+
nextChild.tagName === "p"
|
|
24
|
+
) {
|
|
25
|
+
// Converts paragraph to span, otherwise remark will think it needs to
|
|
26
|
+
// be on a new line.
|
|
27
|
+
nextChild.tagName = "span";
|
|
28
|
+
// Adds a space after the checkbox input element.
|
|
29
|
+
nextChild.children.splice(
|
|
30
|
+
0,
|
|
31
|
+
0,
|
|
32
|
+
fromDom(document.createTextNode(" ")) as HASTElement
|
|
33
|
+
);
|
|
34
|
+
} else {
|
|
35
|
+
helper(child as HASTParent);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
return helper;
|
|
42
|
+
}
|
|
@@ -217,6 +217,134 @@ exports[`Test BlockNote-Prosemirror conversion > Case: default schema > Convert
|
|
|
217
217
|
}
|
|
218
218
|
`;
|
|
219
219
|
|
|
220
|
+
exports[`Test BlockNote-Prosemirror conversion > Case: default schema > Convert file/basic to/from prosemirror 1`] = `
|
|
221
|
+
{
|
|
222
|
+
"attrs": {
|
|
223
|
+
"backgroundColor": "default",
|
|
224
|
+
"id": "1",
|
|
225
|
+
"textColor": "default",
|
|
226
|
+
},
|
|
227
|
+
"content": [
|
|
228
|
+
{
|
|
229
|
+
"attrs": {
|
|
230
|
+
"caption": "Caption",
|
|
231
|
+
"name": "example",
|
|
232
|
+
"url": "exampleURL",
|
|
233
|
+
},
|
|
234
|
+
"type": "file",
|
|
235
|
+
},
|
|
236
|
+
],
|
|
237
|
+
"type": "blockContainer",
|
|
238
|
+
}
|
|
239
|
+
`;
|
|
240
|
+
|
|
241
|
+
exports[`Test BlockNote-Prosemirror conversion > Case: default schema > Convert file/button to/from prosemirror 1`] = `
|
|
242
|
+
{
|
|
243
|
+
"attrs": {
|
|
244
|
+
"backgroundColor": "default",
|
|
245
|
+
"id": "1",
|
|
246
|
+
"textColor": "default",
|
|
247
|
+
},
|
|
248
|
+
"content": [
|
|
249
|
+
{
|
|
250
|
+
"attrs": {
|
|
251
|
+
"caption": "",
|
|
252
|
+
"name": "",
|
|
253
|
+
"url": "",
|
|
254
|
+
},
|
|
255
|
+
"type": "file",
|
|
256
|
+
},
|
|
257
|
+
],
|
|
258
|
+
"type": "blockContainer",
|
|
259
|
+
}
|
|
260
|
+
`;
|
|
261
|
+
|
|
262
|
+
exports[`Test BlockNote-Prosemirror conversion > Case: default schema > Convert file/nested to/from prosemirror 1`] = `
|
|
263
|
+
{
|
|
264
|
+
"attrs": {
|
|
265
|
+
"backgroundColor": "default",
|
|
266
|
+
"id": "1",
|
|
267
|
+
"textColor": "default",
|
|
268
|
+
},
|
|
269
|
+
"content": [
|
|
270
|
+
{
|
|
271
|
+
"attrs": {
|
|
272
|
+
"caption": "Caption",
|
|
273
|
+
"name": "example",
|
|
274
|
+
"url": "exampleURL",
|
|
275
|
+
},
|
|
276
|
+
"type": "file",
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
"content": [
|
|
280
|
+
{
|
|
281
|
+
"attrs": {
|
|
282
|
+
"backgroundColor": "default",
|
|
283
|
+
"id": "2",
|
|
284
|
+
"textColor": "default",
|
|
285
|
+
},
|
|
286
|
+
"content": [
|
|
287
|
+
{
|
|
288
|
+
"attrs": {
|
|
289
|
+
"caption": "Caption",
|
|
290
|
+
"name": "example",
|
|
291
|
+
"url": "exampleURL",
|
|
292
|
+
},
|
|
293
|
+
"type": "file",
|
|
294
|
+
},
|
|
295
|
+
],
|
|
296
|
+
"type": "blockContainer",
|
|
297
|
+
},
|
|
298
|
+
],
|
|
299
|
+
"type": "blockGroup",
|
|
300
|
+
},
|
|
301
|
+
],
|
|
302
|
+
"type": "blockContainer",
|
|
303
|
+
}
|
|
304
|
+
`;
|
|
305
|
+
|
|
306
|
+
exports[`Test BlockNote-Prosemirror conversion > Case: default schema > Convert file/noCaption to/from prosemirror 1`] = `
|
|
307
|
+
{
|
|
308
|
+
"attrs": {
|
|
309
|
+
"backgroundColor": "default",
|
|
310
|
+
"id": "1",
|
|
311
|
+
"textColor": "default",
|
|
312
|
+
},
|
|
313
|
+
"content": [
|
|
314
|
+
{
|
|
315
|
+
"attrs": {
|
|
316
|
+
"caption": "",
|
|
317
|
+
"name": "example",
|
|
318
|
+
"url": "exampleURL",
|
|
319
|
+
},
|
|
320
|
+
"type": "file",
|
|
321
|
+
},
|
|
322
|
+
],
|
|
323
|
+
"type": "blockContainer",
|
|
324
|
+
}
|
|
325
|
+
`;
|
|
326
|
+
|
|
327
|
+
exports[`Test BlockNote-Prosemirror conversion > Case: default schema > Convert file/noName to/from prosemirror 1`] = `
|
|
328
|
+
{
|
|
329
|
+
"attrs": {
|
|
330
|
+
"backgroundColor": "default",
|
|
331
|
+
"id": "1",
|
|
332
|
+
"textColor": "default",
|
|
333
|
+
},
|
|
334
|
+
"content": [
|
|
335
|
+
{
|
|
336
|
+
"attrs": {
|
|
337
|
+
"caption": "Caption",
|
|
338
|
+
"name": "",
|
|
339
|
+
"url": "exampleURL",
|
|
340
|
+
},
|
|
341
|
+
"type": "file",
|
|
342
|
+
},
|
|
343
|
+
],
|
|
344
|
+
"type": "blockContainer",
|
|
345
|
+
}
|
|
346
|
+
`;
|
|
347
|
+
|
|
220
348
|
exports[`Test BlockNote-Prosemirror conversion > Case: default schema > Convert hardbreak/basic to/from prosemirror 1`] = `
|
|
221
349
|
{
|
|
222
350
|
"attrs": {
|
|
@@ -524,9 +652,11 @@ exports[`Test BlockNote-Prosemirror conversion > Case: default schema > Convert
|
|
|
524
652
|
{
|
|
525
653
|
"attrs": {
|
|
526
654
|
"caption": "Caption",
|
|
655
|
+
"name": "example",
|
|
656
|
+
"previewWidth": 256,
|
|
657
|
+
"showPreview": true,
|
|
527
658
|
"textAlignment": "left",
|
|
528
659
|
"url": "exampleURL",
|
|
529
|
-
"width": 256,
|
|
530
660
|
},
|
|
531
661
|
"type": "image",
|
|
532
662
|
},
|
|
@@ -546,9 +676,11 @@ exports[`Test BlockNote-Prosemirror conversion > Case: default schema > Convert
|
|
|
546
676
|
{
|
|
547
677
|
"attrs": {
|
|
548
678
|
"caption": "",
|
|
679
|
+
"name": "",
|
|
680
|
+
"previewWidth": 512,
|
|
681
|
+
"showPreview": true,
|
|
549
682
|
"textAlignment": "left",
|
|
550
683
|
"url": "",
|
|
551
|
-
"width": 512,
|
|
552
684
|
},
|
|
553
685
|
"type": "image",
|
|
554
686
|
},
|
|
@@ -568,9 +700,11 @@ exports[`Test BlockNote-Prosemirror conversion > Case: default schema > Convert
|
|
|
568
700
|
{
|
|
569
701
|
"attrs": {
|
|
570
702
|
"caption": "Caption",
|
|
703
|
+
"name": "",
|
|
704
|
+
"previewWidth": 256,
|
|
705
|
+
"showPreview": true,
|
|
571
706
|
"textAlignment": "left",
|
|
572
707
|
"url": "exampleURL",
|
|
573
|
-
"width": 256,
|
|
574
708
|
},
|
|
575
709
|
"type": "image",
|
|
576
710
|
},
|
|
@@ -586,9 +720,11 @@ exports[`Test BlockNote-Prosemirror conversion > Case: default schema > Convert
|
|
|
586
720
|
{
|
|
587
721
|
"attrs": {
|
|
588
722
|
"caption": "Caption",
|
|
723
|
+
"name": "",
|
|
724
|
+
"previewWidth": 256,
|
|
725
|
+
"showPreview": true,
|
|
589
726
|
"textAlignment": "left",
|
|
590
727
|
"url": "exampleURL",
|
|
591
|
-
"width": 256,
|
|
592
728
|
},
|
|
593
729
|
"type": "image",
|
|
594
730
|
},
|
|
@@ -603,6 +739,78 @@ exports[`Test BlockNote-Prosemirror conversion > Case: default schema > Convert
|
|
|
603
739
|
}
|
|
604
740
|
`;
|
|
605
741
|
|
|
742
|
+
exports[`Test BlockNote-Prosemirror conversion > Case: default schema > Convert image/noCaption to/from prosemirror 1`] = `
|
|
743
|
+
{
|
|
744
|
+
"attrs": {
|
|
745
|
+
"backgroundColor": "default",
|
|
746
|
+
"id": "1",
|
|
747
|
+
"textColor": "default",
|
|
748
|
+
},
|
|
749
|
+
"content": [
|
|
750
|
+
{
|
|
751
|
+
"attrs": {
|
|
752
|
+
"caption": "",
|
|
753
|
+
"name": "example",
|
|
754
|
+
"previewWidth": 256,
|
|
755
|
+
"showPreview": true,
|
|
756
|
+
"textAlignment": "left",
|
|
757
|
+
"url": "exampleURL",
|
|
758
|
+
},
|
|
759
|
+
"type": "image",
|
|
760
|
+
},
|
|
761
|
+
],
|
|
762
|
+
"type": "blockContainer",
|
|
763
|
+
}
|
|
764
|
+
`;
|
|
765
|
+
|
|
766
|
+
exports[`Test BlockNote-Prosemirror conversion > Case: default schema > Convert image/noName to/from prosemirror 1`] = `
|
|
767
|
+
{
|
|
768
|
+
"attrs": {
|
|
769
|
+
"backgroundColor": "default",
|
|
770
|
+
"id": "1",
|
|
771
|
+
"textColor": "default",
|
|
772
|
+
},
|
|
773
|
+
"content": [
|
|
774
|
+
{
|
|
775
|
+
"attrs": {
|
|
776
|
+
"caption": "Caption",
|
|
777
|
+
"name": "",
|
|
778
|
+
"previewWidth": 256,
|
|
779
|
+
"showPreview": true,
|
|
780
|
+
"textAlignment": "left",
|
|
781
|
+
"url": "exampleURL",
|
|
782
|
+
},
|
|
783
|
+
"type": "image",
|
|
784
|
+
},
|
|
785
|
+
],
|
|
786
|
+
"type": "blockContainer",
|
|
787
|
+
}
|
|
788
|
+
`;
|
|
789
|
+
|
|
790
|
+
exports[`Test BlockNote-Prosemirror conversion > Case: default schema > Convert image/noPreview to/from prosemirror 1`] = `
|
|
791
|
+
{
|
|
792
|
+
"attrs": {
|
|
793
|
+
"backgroundColor": "default",
|
|
794
|
+
"id": "1",
|
|
795
|
+
"textColor": "default",
|
|
796
|
+
},
|
|
797
|
+
"content": [
|
|
798
|
+
{
|
|
799
|
+
"attrs": {
|
|
800
|
+
"caption": "Caption",
|
|
801
|
+
"name": "example",
|
|
802
|
+
"previewWidth": 256,
|
|
803
|
+
"showPreview": false,
|
|
804
|
+
"textAlignment": "left",
|
|
805
|
+
"url": "exampleURL",
|
|
806
|
+
},
|
|
807
|
+
"type": "image",
|
|
808
|
+
},
|
|
809
|
+
],
|
|
810
|
+
"type": "blockContainer",
|
|
811
|
+
}
|
|
812
|
+
`;
|
|
813
|
+
|
|
606
814
|
exports[`Test BlockNote-Prosemirror conversion > Case: default schema > Convert link/adjacent to/from prosemirror 1`] = `
|
|
607
815
|
{
|
|
608
816
|
"attrs": {
|
|
@@ -744,6 +952,56 @@ exports[`Test BlockNote-Prosemirror conversion > Case: default schema > Convert
|
|
|
744
952
|
}
|
|
745
953
|
`;
|
|
746
954
|
|
|
955
|
+
exports[`Test BlockNote-Prosemirror conversion > Case: default schema > Convert lists/basic to/from prosemirror 1`] = `
|
|
956
|
+
{
|
|
957
|
+
"attrs": {
|
|
958
|
+
"backgroundColor": "default",
|
|
959
|
+
"id": "1",
|
|
960
|
+
"textColor": "default",
|
|
961
|
+
},
|
|
962
|
+
"content": [
|
|
963
|
+
{
|
|
964
|
+
"attrs": {
|
|
965
|
+
"textAlignment": "left",
|
|
966
|
+
},
|
|
967
|
+
"content": [
|
|
968
|
+
{
|
|
969
|
+
"text": "Bullet List Item 1",
|
|
970
|
+
"type": "text",
|
|
971
|
+
},
|
|
972
|
+
],
|
|
973
|
+
"type": "bulletListItem",
|
|
974
|
+
},
|
|
975
|
+
],
|
|
976
|
+
"type": "blockContainer",
|
|
977
|
+
}
|
|
978
|
+
`;
|
|
979
|
+
|
|
980
|
+
exports[`Test BlockNote-Prosemirror conversion > Case: default schema > Convert lists/nested to/from prosemirror 1`] = `
|
|
981
|
+
{
|
|
982
|
+
"attrs": {
|
|
983
|
+
"backgroundColor": "default",
|
|
984
|
+
"id": "1",
|
|
985
|
+
"textColor": "default",
|
|
986
|
+
},
|
|
987
|
+
"content": [
|
|
988
|
+
{
|
|
989
|
+
"attrs": {
|
|
990
|
+
"textAlignment": "left",
|
|
991
|
+
},
|
|
992
|
+
"content": [
|
|
993
|
+
{
|
|
994
|
+
"text": "Bullet List Item 1",
|
|
995
|
+
"type": "text",
|
|
996
|
+
},
|
|
997
|
+
],
|
|
998
|
+
"type": "bulletListItem",
|
|
999
|
+
},
|
|
1000
|
+
],
|
|
1001
|
+
"type": "blockContainer",
|
|
1002
|
+
}
|
|
1003
|
+
`;
|
|
1004
|
+
|
|
747
1005
|
exports[`Test BlockNote-Prosemirror conversion > Case: default schema > Convert paragraph/basic to/from prosemirror 1`] = `
|
|
748
1006
|
{
|
|
749
1007
|
"attrs": {
|
|
@@ -52,6 +52,42 @@
|
|
|
52
52
|
},
|
|
53
53
|
{
|
|
54
54
|
"id": "4",
|
|
55
|
+
"type": "checkListItem",
|
|
56
|
+
"props": {
|
|
57
|
+
"textColor": "default",
|
|
58
|
+
"backgroundColor": "default",
|
|
59
|
+
"textAlignment": "left",
|
|
60
|
+
"checked": false
|
|
61
|
+
},
|
|
62
|
+
"content": [
|
|
63
|
+
{
|
|
64
|
+
"type": "text",
|
|
65
|
+
"text": "Fourth",
|
|
66
|
+
"styles": {}
|
|
67
|
+
}
|
|
68
|
+
],
|
|
69
|
+
"children": []
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"id": "5",
|
|
73
|
+
"type": "checkListItem",
|
|
74
|
+
"props": {
|
|
75
|
+
"textColor": "default",
|
|
76
|
+
"backgroundColor": "default",
|
|
77
|
+
"textAlignment": "left",
|
|
78
|
+
"checked": false
|
|
79
|
+
},
|
|
80
|
+
"content": [
|
|
81
|
+
{
|
|
82
|
+
"type": "text",
|
|
83
|
+
"text": "Fifth",
|
|
84
|
+
"styles": {}
|
|
85
|
+
}
|
|
86
|
+
],
|
|
87
|
+
"children": []
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"id": "6",
|
|
55
91
|
"type": "bulletListItem",
|
|
56
92
|
"props": {
|
|
57
93
|
"textColor": "default",
|
|
@@ -67,7 +103,7 @@
|
|
|
67
103
|
],
|
|
68
104
|
"children": [
|
|
69
105
|
{
|
|
70
|
-
"id": "
|
|
106
|
+
"id": "7",
|
|
71
107
|
"type": "bulletListItem",
|
|
72
108
|
"props": {
|
|
73
109
|
"textColor": "default",
|
|
@@ -84,7 +120,7 @@
|
|
|
84
120
|
"children": []
|
|
85
121
|
},
|
|
86
122
|
{
|
|
87
|
-
"id": "
|
|
123
|
+
"id": "8",
|
|
88
124
|
"type": "bulletListItem",
|
|
89
125
|
"props": {
|
|
90
126
|
"textColor": "default",
|
|
@@ -99,6 +135,42 @@
|
|
|
99
135
|
}
|
|
100
136
|
],
|
|
101
137
|
"children": []
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
"id": "9",
|
|
141
|
+
"type": "checkListItem",
|
|
142
|
+
"props": {
|
|
143
|
+
"textColor": "default",
|
|
144
|
+
"backgroundColor": "default",
|
|
145
|
+
"textAlignment": "left",
|
|
146
|
+
"checked": false
|
|
147
|
+
},
|
|
148
|
+
"content": [
|
|
149
|
+
{
|
|
150
|
+
"type": "text",
|
|
151
|
+
"text": "Child 3",
|
|
152
|
+
"styles": {}
|
|
153
|
+
}
|
|
154
|
+
],
|
|
155
|
+
"children": []
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
"id": "10",
|
|
159
|
+
"type": "checkListItem",
|
|
160
|
+
"props": {
|
|
161
|
+
"textColor": "default",
|
|
162
|
+
"backgroundColor": "default",
|
|
163
|
+
"textAlignment": "left",
|
|
164
|
+
"checked": false
|
|
165
|
+
},
|
|
166
|
+
"content": [
|
|
167
|
+
{
|
|
168
|
+
"type": "text",
|
|
169
|
+
"text": "Child 4",
|
|
170
|
+
"styles": {}
|
|
171
|
+
}
|
|
172
|
+
],
|
|
173
|
+
"children": []
|
|
102
174
|
}
|
|
103
175
|
]
|
|
104
176
|
}
|
|
@@ -14,9 +14,26 @@
|
|
|
14
14
|
"styles": {}
|
|
15
15
|
}
|
|
16
16
|
],
|
|
17
|
+
"children": []
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"id": "2",
|
|
21
|
+
"type": "bulletListItem",
|
|
22
|
+
"props": {
|
|
23
|
+
"textColor": "default",
|
|
24
|
+
"backgroundColor": "default",
|
|
25
|
+
"textAlignment": "left"
|
|
26
|
+
},
|
|
27
|
+
"content": [
|
|
28
|
+
{
|
|
29
|
+
"type": "text",
|
|
30
|
+
"text": "Bullet List Item",
|
|
31
|
+
"styles": {}
|
|
32
|
+
}
|
|
33
|
+
],
|
|
17
34
|
"children": [
|
|
18
35
|
{
|
|
19
|
-
"id": "
|
|
36
|
+
"id": "3",
|
|
20
37
|
"type": "numberedListItem",
|
|
21
38
|
"props": {
|
|
22
39
|
"textColor": "default",
|
|
@@ -33,7 +50,7 @@
|
|
|
33
50
|
"children": []
|
|
34
51
|
},
|
|
35
52
|
{
|
|
36
|
-
"id": "
|
|
53
|
+
"id": "4",
|
|
37
54
|
"type": "numberedListItem",
|
|
38
55
|
"props": {
|
|
39
56
|
"textColor": "default",
|
|
@@ -52,7 +69,7 @@
|
|
|
52
69
|
]
|
|
53
70
|
},
|
|
54
71
|
{
|
|
55
|
-
"id": "
|
|
72
|
+
"id": "5",
|
|
56
73
|
"type": "bulletListItem",
|
|
57
74
|
"props": {
|
|
58
75
|
"textColor": "default",
|
|
@@ -69,7 +86,78 @@
|
|
|
69
86
|
"children": []
|
|
70
87
|
},
|
|
71
88
|
{
|
|
72
|
-
"id": "
|
|
89
|
+
"id": "6",
|
|
90
|
+
"type": "numberedListItem",
|
|
91
|
+
"props": {
|
|
92
|
+
"textColor": "default",
|
|
93
|
+
"backgroundColor": "default",
|
|
94
|
+
"textAlignment": "left"
|
|
95
|
+
},
|
|
96
|
+
"content": [
|
|
97
|
+
{
|
|
98
|
+
"type": "text",
|
|
99
|
+
"text": "Numbered List Item",
|
|
100
|
+
"styles": {}
|
|
101
|
+
}
|
|
102
|
+
],
|
|
103
|
+
"children": []
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"id": "7",
|
|
107
|
+
"type": "numberedListItem",
|
|
108
|
+
"props": {
|
|
109
|
+
"textColor": "default",
|
|
110
|
+
"backgroundColor": "default",
|
|
111
|
+
"textAlignment": "left"
|
|
112
|
+
},
|
|
113
|
+
"content": [
|
|
114
|
+
{
|
|
115
|
+
"type": "text",
|
|
116
|
+
"text": "Numbered List Item",
|
|
117
|
+
"styles": {}
|
|
118
|
+
}
|
|
119
|
+
],
|
|
120
|
+
"children": [
|
|
121
|
+
{
|
|
122
|
+
"id": "8",
|
|
123
|
+
"type": "checkListItem",
|
|
124
|
+
"props": {
|
|
125
|
+
"textColor": "default",
|
|
126
|
+
"backgroundColor": "default",
|
|
127
|
+
"textAlignment": "left",
|
|
128
|
+
"checked": true
|
|
129
|
+
},
|
|
130
|
+
"content": [
|
|
131
|
+
{
|
|
132
|
+
"type": "text",
|
|
133
|
+
"text": "Nested Check List Item",
|
|
134
|
+
"styles": {}
|
|
135
|
+
}
|
|
136
|
+
],
|
|
137
|
+
"children": []
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
"id": "9",
|
|
141
|
+
"type": "checkListItem",
|
|
142
|
+
"props": {
|
|
143
|
+
"textColor": "default",
|
|
144
|
+
"backgroundColor": "default",
|
|
145
|
+
"textAlignment": "left",
|
|
146
|
+
"checked": false
|
|
147
|
+
},
|
|
148
|
+
"content": [
|
|
149
|
+
{
|
|
150
|
+
"type": "text",
|
|
151
|
+
"text": "Nested Check List Item",
|
|
152
|
+
"styles": {}
|
|
153
|
+
}
|
|
154
|
+
],
|
|
155
|
+
"children": []
|
|
156
|
+
}
|
|
157
|
+
]
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
"id": "10",
|
|
73
161
|
"type": "numberedListItem",
|
|
74
162
|
"props": {
|
|
75
163
|
"textColor": "default",
|
|
@@ -83,9 +171,45 @@
|
|
|
83
171
|
"styles": {}
|
|
84
172
|
}
|
|
85
173
|
],
|
|
174
|
+
"children": []
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
"id": "11",
|
|
178
|
+
"type": "checkListItem",
|
|
179
|
+
"props": {
|
|
180
|
+
"textColor": "default",
|
|
181
|
+
"backgroundColor": "default",
|
|
182
|
+
"textAlignment": "left",
|
|
183
|
+
"checked": true
|
|
184
|
+
},
|
|
185
|
+
"content": [
|
|
186
|
+
{
|
|
187
|
+
"type": "text",
|
|
188
|
+
"text": "Check List Item",
|
|
189
|
+
"styles": {}
|
|
190
|
+
}
|
|
191
|
+
],
|
|
192
|
+
"children": []
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
"id": "12",
|
|
196
|
+
"type": "checkListItem",
|
|
197
|
+
"props": {
|
|
198
|
+
"textColor": "default",
|
|
199
|
+
"backgroundColor": "default",
|
|
200
|
+
"textAlignment": "left",
|
|
201
|
+
"checked": false
|
|
202
|
+
},
|
|
203
|
+
"content": [
|
|
204
|
+
{
|
|
205
|
+
"type": "text",
|
|
206
|
+
"text": "Check List Item",
|
|
207
|
+
"styles": {}
|
|
208
|
+
}
|
|
209
|
+
],
|
|
86
210
|
"children": [
|
|
87
211
|
{
|
|
88
|
-
"id": "
|
|
212
|
+
"id": "13",
|
|
89
213
|
"type": "bulletListItem",
|
|
90
214
|
"props": {
|
|
91
215
|
"textColor": "default",
|
|
@@ -102,7 +226,7 @@
|
|
|
102
226
|
"children": []
|
|
103
227
|
},
|
|
104
228
|
{
|
|
105
|
-
"id": "
|
|
229
|
+
"id": "14",
|
|
106
230
|
"type": "bulletListItem",
|
|
107
231
|
"props": {
|
|
108
232
|
"textColor": "default",
|
|
@@ -121,17 +245,18 @@
|
|
|
121
245
|
]
|
|
122
246
|
},
|
|
123
247
|
{
|
|
124
|
-
"id": "
|
|
125
|
-
"type": "
|
|
248
|
+
"id": "15",
|
|
249
|
+
"type": "checkListItem",
|
|
126
250
|
"props": {
|
|
127
251
|
"textColor": "default",
|
|
128
252
|
"backgroundColor": "default",
|
|
129
|
-
"textAlignment": "left"
|
|
253
|
+
"textAlignment": "left",
|
|
254
|
+
"checked": true
|
|
130
255
|
},
|
|
131
256
|
"content": [
|
|
132
257
|
{
|
|
133
258
|
"type": "text",
|
|
134
|
-
"text": "
|
|
259
|
+
"text": "Nested Check List Item",
|
|
135
260
|
"styles": {}
|
|
136
261
|
}
|
|
137
262
|
],
|