@blocknote/xl-multi-column 0.19.1 → 0.20.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.
@@ -37,6 +37,23 @@ exports[`Test updateBlock > Update column list new children 1`] = `
37
37
  },
38
38
  "type": "paragraph",
39
39
  },
40
+ {
41
+ "children": [],
42
+ "content": [
43
+ {
44
+ "styles": {},
45
+ "text": "Paragraph 1",
46
+ "type": "text",
47
+ },
48
+ ],
49
+ "id": "paragraph-1",
50
+ "props": {
51
+ "backgroundColor": "default",
52
+ "textAlignment": "left",
53
+ "textColor": "default",
54
+ },
55
+ "type": "paragraph",
56
+ },
40
57
  {
41
58
  "children": [
42
59
  {
@@ -99,6 +116,23 @@ exports[`Test updateBlock > Update column list new children 1`] = `
99
116
  "props": {},
100
117
  "type": "columnList",
101
118
  },
119
+ {
120
+ "children": [],
121
+ "content": [
122
+ {
123
+ "styles": {},
124
+ "text": "Paragraph 2",
125
+ "type": "text",
126
+ },
127
+ ],
128
+ "id": "paragraph-2",
129
+ "props": {
130
+ "backgroundColor": "default",
131
+ "textAlignment": "left",
132
+ "textColor": "default",
133
+ },
134
+ "type": "paragraph",
135
+ },
102
136
  {
103
137
  "children": [],
104
138
  "content": [],
@@ -150,6 +184,23 @@ exports[`Test updateBlock > Update column new children 1`] = `
150
184
  },
151
185
  "type": "paragraph",
152
186
  },
187
+ {
188
+ "children": [],
189
+ "content": [
190
+ {
191
+ "styles": {},
192
+ "text": "Paragraph 1",
193
+ "type": "text",
194
+ },
195
+ ],
196
+ "id": "paragraph-1",
197
+ "props": {
198
+ "backgroundColor": "default",
199
+ "textAlignment": "left",
200
+ "textColor": "default",
201
+ },
202
+ "type": "paragraph",
203
+ },
153
204
  {
154
205
  "children": [
155
206
  {
@@ -229,6 +280,23 @@ exports[`Test updateBlock > Update column new children 1`] = `
229
280
  "props": {},
230
281
  "type": "columnList",
231
282
  },
283
+ {
284
+ "children": [],
285
+ "content": [
286
+ {
287
+ "styles": {},
288
+ "text": "Paragraph 2",
289
+ "type": "text",
290
+ },
291
+ ],
292
+ "id": "paragraph-2",
293
+ "props": {
294
+ "backgroundColor": "default",
295
+ "textAlignment": "left",
296
+ "textColor": "default",
297
+ },
298
+ "type": "paragraph",
299
+ },
232
300
  {
233
301
  "children": [],
234
302
  "content": [],
@@ -319,6 +387,23 @@ exports[`Test updateBlock > Update nested paragraph to column 1`] = `
319
387
  },
320
388
  "type": "paragraph",
321
389
  },
390
+ {
391
+ "children": [],
392
+ "content": [
393
+ {
394
+ "styles": {},
395
+ "text": "Paragraph 1",
396
+ "type": "text",
397
+ },
398
+ ],
399
+ "id": "paragraph-1",
400
+ "props": {
401
+ "backgroundColor": "default",
402
+ "textAlignment": "left",
403
+ "textColor": "default",
404
+ },
405
+ "type": "paragraph",
406
+ },
322
407
  {
323
408
  "children": [
324
409
  {
@@ -415,6 +500,23 @@ exports[`Test updateBlock > Update nested paragraph to column 1`] = `
415
500
  "props": {},
416
501
  "type": "columnList",
417
502
  },
503
+ {
504
+ "children": [],
505
+ "content": [
506
+ {
507
+ "styles": {},
508
+ "text": "Paragraph 2",
509
+ "type": "text",
510
+ },
511
+ ],
512
+ "id": "paragraph-2",
513
+ "props": {
514
+ "backgroundColor": "default",
515
+ "textAlignment": "left",
516
+ "textColor": "default",
517
+ },
518
+ "type": "paragraph",
519
+ },
418
520
  {
419
521
  "children": [],
420
522
  "content": [],
@@ -511,6 +613,23 @@ exports[`Test updateBlock > Update nested paragraph to column list 1`] = `
511
613
  },
512
614
  "type": "paragraph",
513
615
  },
616
+ {
617
+ "children": [],
618
+ "content": [
619
+ {
620
+ "styles": {},
621
+ "text": "Paragraph 1",
622
+ "type": "text",
623
+ },
624
+ ],
625
+ "id": "paragraph-1",
626
+ "props": {
627
+ "backgroundColor": "default",
628
+ "textAlignment": "left",
629
+ "textColor": "default",
630
+ },
631
+ "type": "paragraph",
632
+ },
514
633
  {
515
634
  "children": [
516
635
  {
@@ -607,6 +726,23 @@ exports[`Test updateBlock > Update nested paragraph to column list 1`] = `
607
726
  "props": {},
608
727
  "type": "columnList",
609
728
  },
729
+ {
730
+ "children": [],
731
+ "content": [
732
+ {
733
+ "styles": {},
734
+ "text": "Paragraph 2",
735
+ "type": "text",
736
+ },
737
+ ],
738
+ "id": "paragraph-2",
739
+ "props": {
740
+ "backgroundColor": "default",
741
+ "textAlignment": "left",
742
+ "textColor": "default",
743
+ },
744
+ "type": "paragraph",
745
+ },
610
746
  {
611
747
  "children": [],
612
748
  "content": [],
@@ -679,6 +815,23 @@ exports[`Test updateBlock > Update paragraph to column 1`] = `
679
815
  "props": {},
680
816
  "type": "columnList",
681
817
  },
818
+ {
819
+ "children": [],
820
+ "content": [
821
+ {
822
+ "styles": {},
823
+ "text": "Paragraph 1",
824
+ "type": "text",
825
+ },
826
+ ],
827
+ "id": "paragraph-1",
828
+ "props": {
829
+ "backgroundColor": "default",
830
+ "textAlignment": "left",
831
+ "textColor": "default",
832
+ },
833
+ "type": "paragraph",
834
+ },
682
835
  {
683
836
  "children": [
684
837
  {
@@ -775,6 +928,23 @@ exports[`Test updateBlock > Update paragraph to column 1`] = `
775
928
  "props": {},
776
929
  "type": "columnList",
777
930
  },
931
+ {
932
+ "children": [],
933
+ "content": [
934
+ {
935
+ "styles": {},
936
+ "text": "Paragraph 2",
937
+ "type": "text",
938
+ },
939
+ ],
940
+ "id": "paragraph-2",
941
+ "props": {
942
+ "backgroundColor": "default",
943
+ "textAlignment": "left",
944
+ "textColor": "default",
945
+ },
946
+ "type": "paragraph",
947
+ },
778
948
  {
779
949
  "children": [],
780
950
  "content": [],
@@ -853,6 +1023,23 @@ exports[`Test updateBlock > Update paragraph to column list 1`] = `
853
1023
  "props": {},
854
1024
  "type": "columnList",
855
1025
  },
1026
+ {
1027
+ "children": [],
1028
+ "content": [
1029
+ {
1030
+ "styles": {},
1031
+ "text": "Paragraph 1",
1032
+ "type": "text",
1033
+ },
1034
+ ],
1035
+ "id": "paragraph-1",
1036
+ "props": {
1037
+ "backgroundColor": "default",
1038
+ "textAlignment": "left",
1039
+ "textColor": "default",
1040
+ },
1041
+ "type": "paragraph",
1042
+ },
856
1043
  {
857
1044
  "children": [
858
1045
  {
@@ -949,6 +1136,23 @@ exports[`Test updateBlock > Update paragraph to column list 1`] = `
949
1136
  "props": {},
950
1137
  "type": "columnList",
951
1138
  },
1139
+ {
1140
+ "children": [],
1141
+ "content": [
1142
+ {
1143
+ "styles": {},
1144
+ "text": "Paragraph 2",
1145
+ "type": "text",
1146
+ },
1147
+ ],
1148
+ "id": "paragraph-2",
1149
+ "props": {
1150
+ "backgroundColor": "default",
1151
+ "textAlignment": "left",
1152
+ "textColor": "default",
1153
+ },
1154
+ "type": "paragraph",
1155
+ },
952
1156
  {
953
1157
  "children": [],
954
1158
  "content": [],
@@ -0,0 +1,57 @@
1
+ import { describe, expect, it } from "vitest";
2
+
3
+ import { setupTestEnv } from "../setupTestEnv.js";
4
+
5
+ const getEditor = setupTestEnv();
6
+
7
+ describe("Test moveBlocksUp", () => {
8
+ it("Move into column list", () => {
9
+ getEditor().setTextCursorPosition("paragraph-2");
10
+
11
+ getEditor().moveBlocksUp();
12
+
13
+ expect(getEditor().document).toMatchSnapshot();
14
+ });
15
+
16
+ it("Move out of column list", () => {
17
+ getEditor().setTextCursorPosition("column-paragraph-0");
18
+
19
+ getEditor().moveBlocksUp();
20
+
21
+ expect(getEditor().document).toMatchSnapshot();
22
+ });
23
+
24
+ it("Move into previous column", () => {
25
+ getEditor().setTextCursorPosition("column-paragraph-2");
26
+
27
+ getEditor().moveBlocksUp();
28
+
29
+ expect(getEditor().document).toMatchSnapshot();
30
+ });
31
+ });
32
+
33
+ describe("Test moveBlocksDown", () => {
34
+ it("Move into column list", () => {
35
+ getEditor().setTextCursorPosition("paragraph-1");
36
+
37
+ getEditor().moveBlocksDown();
38
+
39
+ expect(getEditor().document).toMatchSnapshot();
40
+ });
41
+
42
+ it("Move out of column list", () => {
43
+ getEditor().setTextCursorPosition("column-paragraph-3");
44
+
45
+ getEditor().moveBlocksDown();
46
+
47
+ expect(getEditor().document).toMatchSnapshot();
48
+ });
49
+
50
+ it("Move into next column", () => {
51
+ getEditor().setTextCursorPosition("column-paragraph-1");
52
+
53
+ getEditor().moveBlocksDown();
54
+
55
+ expect(getEditor().document).toMatchSnapshot();
56
+ });
57
+ });
@@ -5,9 +5,9 @@ import { setupTestEnv } from "../setupTestEnv.js";
5
5
  const getEditor = setupTestEnv();
6
6
 
7
7
  describe("Test replaceBlocks", () => {
8
- it("Replace paragraph with column list above column list empty column list", () => {
8
+ it("Replace paragraph with column list above column list", () => {
9
9
  getEditor().replaceBlocks(
10
- ["paragraph-0"],
10
+ ["paragraph-1"],
11
11
  [
12
12
  {
13
13
  type: "columnList",
@@ -0,0 +1,25 @@
1
+ import { describe, expect, it } from "vitest";
2
+
3
+ import { setupTestEnv } from "../setupTestEnv.js";
4
+
5
+ const getEditor = setupTestEnv();
6
+
7
+ describe("Test getSelection & setSelection", () => {
8
+ it("Starts in column", () => {
9
+ getEditor().setSelection("column-paragraph-2", "paragraph-2");
10
+
11
+ expect(getEditor().getSelection()).toMatchSnapshot();
12
+ });
13
+
14
+ it("Ends in column", () => {
15
+ getEditor().setSelection("paragraph-1", "column-paragraph-1");
16
+
17
+ expect(getEditor().getSelection()).toMatchSnapshot();
18
+ });
19
+
20
+ it("Spans column list", () => {
21
+ getEditor().setSelection("paragraph-1", "paragraph-2");
22
+
23
+ expect(getEditor().getSelection()).toMatchSnapshot();
24
+ });
25
+ });
@@ -54,6 +54,11 @@ const testDocument: PartialBlock<
54
54
  },
55
55
  ],
56
56
  },
57
+ {
58
+ id: "paragraph-1",
59
+ type: "paragraph",
60
+ content: "Paragraph 1",
61
+ },
57
62
  {
58
63
  id: "column-list-0",
59
64
  type: "columnList",
@@ -92,6 +97,11 @@ const testDocument: PartialBlock<
92
97
  },
93
98
  ],
94
99
  },
100
+ {
101
+ id: "paragraph-2",
102
+ type: "paragraph",
103
+ content: "Paragraph 2",
104
+ },
95
105
  {
96
106
  id: "trailing-paragraph",
97
107
  type: "paragraph",
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};