@blocknote/xl-multi-column 0.19.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.
Files changed (78) hide show
  1. package/LICENSE +661 -0
  2. package/dist/blocknote-xl-multi-column.js +3038 -0
  3. package/dist/blocknote-xl-multi-column.js.map +1 -0
  4. package/dist/blocknote-xl-multi-column.umd.cjs +69 -0
  5. package/dist/blocknote-xl-multi-column.umd.cjs.map +1 -0
  6. package/dist/webpack-stats.json +1 -0
  7. package/package.json +80 -0
  8. package/src/blocks/Columns/index.ts +15 -0
  9. package/src/blocks/schema.ts +43 -0
  10. package/src/extensions/ColumnResize/ColumnResizeExtension.ts +357 -0
  11. package/src/extensions/DropCursor/MultiColumnDropCursorPlugin.ts +480 -0
  12. package/src/extensions/SuggestionMenu/getMultiColumnSlashMenuItems.tsx +105 -0
  13. package/src/i18n/dictionary.ts +27 -0
  14. package/src/i18n/locales/ar.ts +18 -0
  15. package/src/i18n/locales/de.ts +18 -0
  16. package/src/i18n/locales/en.ts +16 -0
  17. package/src/i18n/locales/es.ts +18 -0
  18. package/src/i18n/locales/fr.ts +18 -0
  19. package/src/i18n/locales/hr.ts +18 -0
  20. package/src/i18n/locales/index.ts +15 -0
  21. package/src/i18n/locales/is.ts +18 -0
  22. package/src/i18n/locales/ja.ts +18 -0
  23. package/src/i18n/locales/ko.ts +18 -0
  24. package/src/i18n/locales/nl.ts +18 -0
  25. package/src/i18n/locales/pl.ts +18 -0
  26. package/src/i18n/locales/pt.ts +18 -0
  27. package/src/i18n/locales/ru.ts +18 -0
  28. package/src/i18n/locales/vi.ts +18 -0
  29. package/src/i18n/locales/zh.ts +18 -0
  30. package/src/index.ts +7 -0
  31. package/src/pm-nodes/Column.ts +87 -0
  32. package/src/pm-nodes/ColumnList.ts +44 -0
  33. package/src/test/commands/__snapshots__/insertBlocks.test.ts.snap +757 -0
  34. package/src/test/commands/__snapshots__/textCursorPosition.test.ts.snap +169 -0
  35. package/src/test/commands/__snapshots__/updateBlock.test.ts.snap +964 -0
  36. package/src/test/commands/insertBlocks.test.ts +206 -0
  37. package/src/test/commands/textCursorPosition.test.ts +19 -0
  38. package/src/test/commands/updateBlock.test.ts +212 -0
  39. package/src/test/conversions/__snapshots__/multi-column/undefined/external.html +1 -0
  40. package/src/test/conversions/__snapshots__/multi-column/undefined/internal.html +1 -0
  41. package/src/test/conversions/__snapshots__/nodeConversion.test.ts.snap +118 -0
  42. package/src/test/conversions/htmlConversion.test.ts +100 -0
  43. package/src/test/conversions/nodeConversion.test.ts +84 -0
  44. package/src/test/conversions/testCases.ts +54 -0
  45. package/src/test/setupTestEnv.ts +99 -0
  46. package/src/vite-env.d.ts +1 -0
  47. package/types/src/blocks/Columns/index.d.ts +32 -0
  48. package/types/src/blocks/schema.d.ts +102 -0
  49. package/types/src/extensions/ColumnResize/ColumnResizeExtension.d.ts +3 -0
  50. package/types/src/extensions/DropCursor/MultiColumnDropCursorPlugin.d.ts +11 -0
  51. package/types/src/extensions/SuggestionMenu/getMultiColumnSlashMenuItems.d.ts +5 -0
  52. package/types/src/i18n/dictionary.d.ts +19 -0
  53. package/types/src/i18n/locales/ar.d.ts +2 -0
  54. package/types/src/i18n/locales/de.d.ts +2 -0
  55. package/types/src/i18n/locales/en.d.ts +16 -0
  56. package/types/src/i18n/locales/es.d.ts +2 -0
  57. package/types/src/i18n/locales/fr.d.ts +2 -0
  58. package/types/src/i18n/locales/hr.d.ts +2 -0
  59. package/types/src/i18n/locales/index.d.ts +15 -0
  60. package/types/src/i18n/locales/is.d.ts +2 -0
  61. package/types/src/i18n/locales/ja.d.ts +2 -0
  62. package/types/src/i18n/locales/ko.d.ts +2 -0
  63. package/types/src/i18n/locales/nl.d.ts +2 -0
  64. package/types/src/i18n/locales/pl.d.ts +2 -0
  65. package/types/src/i18n/locales/pt.d.ts +2 -0
  66. package/types/src/i18n/locales/ru.d.ts +2 -0
  67. package/types/src/i18n/locales/vi.d.ts +2 -0
  68. package/types/src/i18n/locales/zh.d.ts +2 -0
  69. package/types/src/index.d.ts +7 -0
  70. package/types/src/pm-nodes/Column.d.ts +6 -0
  71. package/types/src/pm-nodes/ColumnList.d.ts +6 -0
  72. package/types/src/test/commands/insertBlocks.test.d.ts +1 -0
  73. package/types/src/test/commands/textCursorPosition.test.d.ts +1 -0
  74. package/types/src/test/commands/updateBlock.test.d.ts +1 -0
  75. package/types/src/test/conversions/htmlConversion.test.d.ts +1 -0
  76. package/types/src/test/conversions/nodeConversion.test.d.ts +1 -0
  77. package/types/src/test/conversions/testCases.d.ts +3 -0
  78. package/types/src/test/setupTestEnv.d.ts +1041 -0
@@ -0,0 +1,757 @@
1
+ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2
+
3
+ exports[`Test insertBlocks > Insert column list into paragraph 1`] = `
4
+ [
5
+ {
6
+ "children": [
7
+ {
8
+ "children": [],
9
+ "content": [
10
+ {
11
+ "styles": {},
12
+ "text": "Nested Paragraph 0",
13
+ "type": "text",
14
+ },
15
+ ],
16
+ "id": "nested-paragraph-0",
17
+ "props": {
18
+ "backgroundColor": "default",
19
+ "textAlignment": "left",
20
+ "textColor": "default",
21
+ },
22
+ "type": "paragraph",
23
+ },
24
+ {
25
+ "children": [
26
+ {
27
+ "children": [
28
+ {
29
+ "children": [],
30
+ "content": [
31
+ {
32
+ "styles": {},
33
+ "text": "Inserted Column Paragraph",
34
+ "type": "text",
35
+ },
36
+ ],
37
+ "id": "2",
38
+ "props": {
39
+ "backgroundColor": "default",
40
+ "textAlignment": "left",
41
+ "textColor": "default",
42
+ },
43
+ "type": "paragraph",
44
+ },
45
+ ],
46
+ "content": undefined,
47
+ "id": "1",
48
+ "props": {
49
+ "width": 1,
50
+ },
51
+ "type": "column",
52
+ },
53
+ {
54
+ "children": [
55
+ {
56
+ "children": [],
57
+ "content": [
58
+ {
59
+ "styles": {},
60
+ "text": "Inserted Column Paragraph",
61
+ "type": "text",
62
+ },
63
+ ],
64
+ "id": "4",
65
+ "props": {
66
+ "backgroundColor": "default",
67
+ "textAlignment": "left",
68
+ "textColor": "default",
69
+ },
70
+ "type": "paragraph",
71
+ },
72
+ ],
73
+ "content": undefined,
74
+ "id": "3",
75
+ "props": {
76
+ "width": 1,
77
+ },
78
+ "type": "column",
79
+ },
80
+ ],
81
+ "content": undefined,
82
+ "id": "0",
83
+ "props": {},
84
+ "type": "columnList",
85
+ },
86
+ ],
87
+ "content": [
88
+ {
89
+ "styles": {},
90
+ "text": "Paragraph 0",
91
+ "type": "text",
92
+ },
93
+ ],
94
+ "id": "paragraph-0",
95
+ "props": {
96
+ "backgroundColor": "default",
97
+ "textAlignment": "left",
98
+ "textColor": "default",
99
+ },
100
+ "type": "paragraph",
101
+ },
102
+ {
103
+ "children": [
104
+ {
105
+ "children": [
106
+ {
107
+ "children": [],
108
+ "content": [
109
+ {
110
+ "styles": {},
111
+ "text": "Column Paragraph 0",
112
+ "type": "text",
113
+ },
114
+ ],
115
+ "id": "column-paragraph-0",
116
+ "props": {
117
+ "backgroundColor": "default",
118
+ "textAlignment": "left",
119
+ "textColor": "default",
120
+ },
121
+ "type": "paragraph",
122
+ },
123
+ {
124
+ "children": [],
125
+ "content": [
126
+ {
127
+ "styles": {},
128
+ "text": "Column Paragraph 1",
129
+ "type": "text",
130
+ },
131
+ ],
132
+ "id": "column-paragraph-1",
133
+ "props": {
134
+ "backgroundColor": "default",
135
+ "textAlignment": "left",
136
+ "textColor": "default",
137
+ },
138
+ "type": "paragraph",
139
+ },
140
+ ],
141
+ "content": undefined,
142
+ "id": "column-0",
143
+ "props": {
144
+ "width": 1,
145
+ },
146
+ "type": "column",
147
+ },
148
+ {
149
+ "children": [
150
+ {
151
+ "children": [],
152
+ "content": [
153
+ {
154
+ "styles": {},
155
+ "text": "Column Paragraph 2",
156
+ "type": "text",
157
+ },
158
+ ],
159
+ "id": "column-paragraph-2",
160
+ "props": {
161
+ "backgroundColor": "default",
162
+ "textAlignment": "left",
163
+ "textColor": "default",
164
+ },
165
+ "type": "paragraph",
166
+ },
167
+ {
168
+ "children": [],
169
+ "content": [
170
+ {
171
+ "styles": {},
172
+ "text": "Column Paragraph 3",
173
+ "type": "text",
174
+ },
175
+ ],
176
+ "id": "column-paragraph-3",
177
+ "props": {
178
+ "backgroundColor": "default",
179
+ "textAlignment": "left",
180
+ "textColor": "default",
181
+ },
182
+ "type": "paragraph",
183
+ },
184
+ ],
185
+ "content": undefined,
186
+ "id": "column-1",
187
+ "props": {
188
+ "width": 1,
189
+ },
190
+ "type": "column",
191
+ },
192
+ ],
193
+ "content": undefined,
194
+ "id": "column-list-0",
195
+ "props": {},
196
+ "type": "columnList",
197
+ },
198
+ {
199
+ "children": [],
200
+ "content": [],
201
+ "id": "trailing-paragraph",
202
+ "props": {
203
+ "backgroundColor": "default",
204
+ "textAlignment": "left",
205
+ "textColor": "default",
206
+ },
207
+ "type": "paragraph",
208
+ },
209
+ ]
210
+ `;
211
+
212
+ exports[`Test insertBlocks > Insert column with paragraph into column list 1`] = `
213
+ [
214
+ {
215
+ "children": [
216
+ {
217
+ "children": [],
218
+ "content": [
219
+ {
220
+ "styles": {},
221
+ "text": "Nested Paragraph 0",
222
+ "type": "text",
223
+ },
224
+ ],
225
+ "id": "nested-paragraph-0",
226
+ "props": {
227
+ "backgroundColor": "default",
228
+ "textAlignment": "left",
229
+ "textColor": "default",
230
+ },
231
+ "type": "paragraph",
232
+ },
233
+ ],
234
+ "content": [
235
+ {
236
+ "styles": {},
237
+ "text": "Paragraph 0",
238
+ "type": "text",
239
+ },
240
+ ],
241
+ "id": "paragraph-0",
242
+ "props": {
243
+ "backgroundColor": "default",
244
+ "textAlignment": "left",
245
+ "textColor": "default",
246
+ },
247
+ "type": "paragraph",
248
+ },
249
+ {
250
+ "children": [
251
+ {
252
+ "children": [
253
+ {
254
+ "children": [],
255
+ "content": [
256
+ {
257
+ "styles": {},
258
+ "text": "Inserted Column Paragraph",
259
+ "type": "text",
260
+ },
261
+ ],
262
+ "id": "1",
263
+ "props": {
264
+ "backgroundColor": "default",
265
+ "textAlignment": "left",
266
+ "textColor": "default",
267
+ },
268
+ "type": "paragraph",
269
+ },
270
+ ],
271
+ "content": undefined,
272
+ "id": "0",
273
+ "props": {
274
+ "width": 1,
275
+ },
276
+ "type": "column",
277
+ },
278
+ {
279
+ "children": [
280
+ {
281
+ "children": [],
282
+ "content": [
283
+ {
284
+ "styles": {},
285
+ "text": "Column Paragraph 0",
286
+ "type": "text",
287
+ },
288
+ ],
289
+ "id": "column-paragraph-0",
290
+ "props": {
291
+ "backgroundColor": "default",
292
+ "textAlignment": "left",
293
+ "textColor": "default",
294
+ },
295
+ "type": "paragraph",
296
+ },
297
+ {
298
+ "children": [],
299
+ "content": [
300
+ {
301
+ "styles": {},
302
+ "text": "Column Paragraph 1",
303
+ "type": "text",
304
+ },
305
+ ],
306
+ "id": "column-paragraph-1",
307
+ "props": {
308
+ "backgroundColor": "default",
309
+ "textAlignment": "left",
310
+ "textColor": "default",
311
+ },
312
+ "type": "paragraph",
313
+ },
314
+ ],
315
+ "content": undefined,
316
+ "id": "column-0",
317
+ "props": {
318
+ "width": 1,
319
+ },
320
+ "type": "column",
321
+ },
322
+ {
323
+ "children": [
324
+ {
325
+ "children": [],
326
+ "content": [
327
+ {
328
+ "styles": {},
329
+ "text": "Column Paragraph 2",
330
+ "type": "text",
331
+ },
332
+ ],
333
+ "id": "column-paragraph-2",
334
+ "props": {
335
+ "backgroundColor": "default",
336
+ "textAlignment": "left",
337
+ "textColor": "default",
338
+ },
339
+ "type": "paragraph",
340
+ },
341
+ {
342
+ "children": [],
343
+ "content": [
344
+ {
345
+ "styles": {},
346
+ "text": "Column Paragraph 3",
347
+ "type": "text",
348
+ },
349
+ ],
350
+ "id": "column-paragraph-3",
351
+ "props": {
352
+ "backgroundColor": "default",
353
+ "textAlignment": "left",
354
+ "textColor": "default",
355
+ },
356
+ "type": "paragraph",
357
+ },
358
+ ],
359
+ "content": undefined,
360
+ "id": "column-1",
361
+ "props": {
362
+ "width": 1,
363
+ },
364
+ "type": "column",
365
+ },
366
+ ],
367
+ "content": undefined,
368
+ "id": "column-list-0",
369
+ "props": {},
370
+ "type": "columnList",
371
+ },
372
+ {
373
+ "children": [],
374
+ "content": [],
375
+ "id": "trailing-paragraph",
376
+ "props": {
377
+ "backgroundColor": "default",
378
+ "textAlignment": "left",
379
+ "textColor": "default",
380
+ },
381
+ "type": "paragraph",
382
+ },
383
+ ]
384
+ `;
385
+
386
+ exports[`Test insertBlocks > Insert paragraph into column 1`] = `
387
+ [
388
+ {
389
+ "children": [
390
+ {
391
+ "children": [],
392
+ "content": [
393
+ {
394
+ "styles": {},
395
+ "text": "Nested Paragraph 0",
396
+ "type": "text",
397
+ },
398
+ ],
399
+ "id": "nested-paragraph-0",
400
+ "props": {
401
+ "backgroundColor": "default",
402
+ "textAlignment": "left",
403
+ "textColor": "default",
404
+ },
405
+ "type": "paragraph",
406
+ },
407
+ ],
408
+ "content": [
409
+ {
410
+ "styles": {},
411
+ "text": "Paragraph 0",
412
+ "type": "text",
413
+ },
414
+ ],
415
+ "id": "paragraph-0",
416
+ "props": {
417
+ "backgroundColor": "default",
418
+ "textAlignment": "left",
419
+ "textColor": "default",
420
+ },
421
+ "type": "paragraph",
422
+ },
423
+ {
424
+ "children": [
425
+ {
426
+ "children": [
427
+ {
428
+ "children": [],
429
+ "content": [
430
+ {
431
+ "styles": {},
432
+ "text": "Column Paragraph 0",
433
+ "type": "text",
434
+ },
435
+ ],
436
+ "id": "column-paragraph-0",
437
+ "props": {
438
+ "backgroundColor": "default",
439
+ "textAlignment": "left",
440
+ "textColor": "default",
441
+ },
442
+ "type": "paragraph",
443
+ },
444
+ {
445
+ "children": [],
446
+ "content": [
447
+ {
448
+ "styles": {},
449
+ "text": "Inserted Column List Paragraph",
450
+ "type": "text",
451
+ },
452
+ ],
453
+ "id": "0",
454
+ "props": {
455
+ "backgroundColor": "default",
456
+ "textAlignment": "left",
457
+ "textColor": "default",
458
+ },
459
+ "type": "paragraph",
460
+ },
461
+ {
462
+ "children": [],
463
+ "content": [
464
+ {
465
+ "styles": {},
466
+ "text": "Column Paragraph 1",
467
+ "type": "text",
468
+ },
469
+ ],
470
+ "id": "column-paragraph-1",
471
+ "props": {
472
+ "backgroundColor": "default",
473
+ "textAlignment": "left",
474
+ "textColor": "default",
475
+ },
476
+ "type": "paragraph",
477
+ },
478
+ ],
479
+ "content": undefined,
480
+ "id": "column-0",
481
+ "props": {
482
+ "width": 1,
483
+ },
484
+ "type": "column",
485
+ },
486
+ {
487
+ "children": [
488
+ {
489
+ "children": [],
490
+ "content": [
491
+ {
492
+ "styles": {},
493
+ "text": "Column Paragraph 2",
494
+ "type": "text",
495
+ },
496
+ ],
497
+ "id": "column-paragraph-2",
498
+ "props": {
499
+ "backgroundColor": "default",
500
+ "textAlignment": "left",
501
+ "textColor": "default",
502
+ },
503
+ "type": "paragraph",
504
+ },
505
+ {
506
+ "children": [],
507
+ "content": [
508
+ {
509
+ "styles": {},
510
+ "text": "Column Paragraph 3",
511
+ "type": "text",
512
+ },
513
+ ],
514
+ "id": "column-paragraph-3",
515
+ "props": {
516
+ "backgroundColor": "default",
517
+ "textAlignment": "left",
518
+ "textColor": "default",
519
+ },
520
+ "type": "paragraph",
521
+ },
522
+ ],
523
+ "content": undefined,
524
+ "id": "column-1",
525
+ "props": {
526
+ "width": 1,
527
+ },
528
+ "type": "column",
529
+ },
530
+ ],
531
+ "content": undefined,
532
+ "id": "column-list-0",
533
+ "props": {},
534
+ "type": "columnList",
535
+ },
536
+ {
537
+ "children": [],
538
+ "content": [],
539
+ "id": "trailing-paragraph",
540
+ "props": {
541
+ "backgroundColor": "default",
542
+ "textAlignment": "left",
543
+ "textColor": "default",
544
+ },
545
+ "type": "paragraph",
546
+ },
547
+ ]
548
+ `;
549
+
550
+ exports[`Test insertBlocks > Insert valid column list with two columns 1`] = `
551
+ [
552
+ {
553
+ "children": [
554
+ {
555
+ "children": [],
556
+ "content": [
557
+ {
558
+ "styles": {},
559
+ "text": "Nested Paragraph 0",
560
+ "type": "text",
561
+ },
562
+ ],
563
+ "id": "nested-paragraph-0",
564
+ "props": {
565
+ "backgroundColor": "default",
566
+ "textAlignment": "left",
567
+ "textColor": "default",
568
+ },
569
+ "type": "paragraph",
570
+ },
571
+ ],
572
+ "content": [
573
+ {
574
+ "styles": {},
575
+ "text": "Paragraph 0",
576
+ "type": "text",
577
+ },
578
+ ],
579
+ "id": "paragraph-0",
580
+ "props": {
581
+ "backgroundColor": "default",
582
+ "textAlignment": "left",
583
+ "textColor": "default",
584
+ },
585
+ "type": "paragraph",
586
+ },
587
+ {
588
+ "children": [
589
+ {
590
+ "children": [
591
+ {
592
+ "children": [],
593
+ "content": [
594
+ {
595
+ "styles": {},
596
+ "text": "Inserted Column Paragraph",
597
+ "type": "text",
598
+ },
599
+ ],
600
+ "id": "2",
601
+ "props": {
602
+ "backgroundColor": "default",
603
+ "textAlignment": "left",
604
+ "textColor": "default",
605
+ },
606
+ "type": "paragraph",
607
+ },
608
+ ],
609
+ "content": undefined,
610
+ "id": "1",
611
+ "props": {
612
+ "width": 1,
613
+ },
614
+ "type": "column",
615
+ },
616
+ {
617
+ "children": [
618
+ {
619
+ "children": [],
620
+ "content": [
621
+ {
622
+ "styles": {},
623
+ "text": "Inserted Second Column Paragraph",
624
+ "type": "text",
625
+ },
626
+ ],
627
+ "id": "4",
628
+ "props": {
629
+ "backgroundColor": "default",
630
+ "textAlignment": "left",
631
+ "textColor": "default",
632
+ },
633
+ "type": "paragraph",
634
+ },
635
+ ],
636
+ "content": undefined,
637
+ "id": "3",
638
+ "props": {
639
+ "width": 1,
640
+ },
641
+ "type": "column",
642
+ },
643
+ ],
644
+ "content": undefined,
645
+ "id": "0",
646
+ "props": {},
647
+ "type": "columnList",
648
+ },
649
+ {
650
+ "children": [
651
+ {
652
+ "children": [
653
+ {
654
+ "children": [],
655
+ "content": [
656
+ {
657
+ "styles": {},
658
+ "text": "Column Paragraph 0",
659
+ "type": "text",
660
+ },
661
+ ],
662
+ "id": "column-paragraph-0",
663
+ "props": {
664
+ "backgroundColor": "default",
665
+ "textAlignment": "left",
666
+ "textColor": "default",
667
+ },
668
+ "type": "paragraph",
669
+ },
670
+ {
671
+ "children": [],
672
+ "content": [
673
+ {
674
+ "styles": {},
675
+ "text": "Column Paragraph 1",
676
+ "type": "text",
677
+ },
678
+ ],
679
+ "id": "column-paragraph-1",
680
+ "props": {
681
+ "backgroundColor": "default",
682
+ "textAlignment": "left",
683
+ "textColor": "default",
684
+ },
685
+ "type": "paragraph",
686
+ },
687
+ ],
688
+ "content": undefined,
689
+ "id": "column-0",
690
+ "props": {
691
+ "width": 1,
692
+ },
693
+ "type": "column",
694
+ },
695
+ {
696
+ "children": [
697
+ {
698
+ "children": [],
699
+ "content": [
700
+ {
701
+ "styles": {},
702
+ "text": "Column Paragraph 2",
703
+ "type": "text",
704
+ },
705
+ ],
706
+ "id": "column-paragraph-2",
707
+ "props": {
708
+ "backgroundColor": "default",
709
+ "textAlignment": "left",
710
+ "textColor": "default",
711
+ },
712
+ "type": "paragraph",
713
+ },
714
+ {
715
+ "children": [],
716
+ "content": [
717
+ {
718
+ "styles": {},
719
+ "text": "Column Paragraph 3",
720
+ "type": "text",
721
+ },
722
+ ],
723
+ "id": "column-paragraph-3",
724
+ "props": {
725
+ "backgroundColor": "default",
726
+ "textAlignment": "left",
727
+ "textColor": "default",
728
+ },
729
+ "type": "paragraph",
730
+ },
731
+ ],
732
+ "content": undefined,
733
+ "id": "column-1",
734
+ "props": {
735
+ "width": 1,
736
+ },
737
+ "type": "column",
738
+ },
739
+ ],
740
+ "content": undefined,
741
+ "id": "column-list-0",
742
+ "props": {},
743
+ "type": "columnList",
744
+ },
745
+ {
746
+ "children": [],
747
+ "content": [],
748
+ "id": "trailing-paragraph",
749
+ "props": {
750
+ "backgroundColor": "default",
751
+ "textAlignment": "left",
752
+ "textColor": "default",
753
+ },
754
+ "type": "paragraph",
755
+ },
756
+ ]
757
+ `;