@blocknote/xl-multi-column 0.41.1 → 0.42.1

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.
@@ -1,5 +1,271 @@
1
1
  // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2
2
 
3
+ exports[`Test replaceBlocks > Replace all blocks in column with single block 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
+ "content": [
26
+ {
27
+ "styles": {},
28
+ "text": "Paragraph 0",
29
+ "type": "text",
30
+ },
31
+ ],
32
+ "id": "paragraph-0",
33
+ "props": {
34
+ "backgroundColor": "default",
35
+ "textAlignment": "left",
36
+ "textColor": "default",
37
+ },
38
+ "type": "paragraph",
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
+ },
57
+ {
58
+ "children": [
59
+ {
60
+ "children": [
61
+ {
62
+ "children": [],
63
+ "content": [
64
+ {
65
+ "styles": {},
66
+ "text": "New Paragraph",
67
+ "type": "text",
68
+ },
69
+ ],
70
+ "id": "0",
71
+ "props": {
72
+ "backgroundColor": "default",
73
+ "textAlignment": "left",
74
+ "textColor": "default",
75
+ },
76
+ "type": "paragraph",
77
+ },
78
+ ],
79
+ "content": undefined,
80
+ "id": "column-0",
81
+ "props": {
82
+ "width": 1,
83
+ },
84
+ "type": "column",
85
+ },
86
+ {
87
+ "children": [
88
+ {
89
+ "children": [],
90
+ "content": [
91
+ {
92
+ "styles": {},
93
+ "text": "Column Paragraph 2",
94
+ "type": "text",
95
+ },
96
+ ],
97
+ "id": "column-paragraph-2",
98
+ "props": {
99
+ "backgroundColor": "default",
100
+ "textAlignment": "left",
101
+ "textColor": "default",
102
+ },
103
+ "type": "paragraph",
104
+ },
105
+ {
106
+ "children": [],
107
+ "content": [
108
+ {
109
+ "styles": {},
110
+ "text": "Column Paragraph 3",
111
+ "type": "text",
112
+ },
113
+ ],
114
+ "id": "column-paragraph-3",
115
+ "props": {
116
+ "backgroundColor": "default",
117
+ "textAlignment": "left",
118
+ "textColor": "default",
119
+ },
120
+ "type": "paragraph",
121
+ },
122
+ ],
123
+ "content": undefined,
124
+ "id": "column-1",
125
+ "props": {
126
+ "width": 1,
127
+ },
128
+ "type": "column",
129
+ },
130
+ ],
131
+ "content": undefined,
132
+ "id": "column-list-0",
133
+ "props": {},
134
+ "type": "columnList",
135
+ },
136
+ {
137
+ "children": [],
138
+ "content": [
139
+ {
140
+ "styles": {},
141
+ "text": "Paragraph 2",
142
+ "type": "text",
143
+ },
144
+ ],
145
+ "id": "paragraph-2",
146
+ "props": {
147
+ "backgroundColor": "default",
148
+ "textAlignment": "left",
149
+ "textColor": "default",
150
+ },
151
+ "type": "paragraph",
152
+ },
153
+ {
154
+ "children": [],
155
+ "content": [],
156
+ "id": "trailing-paragraph",
157
+ "props": {
158
+ "backgroundColor": "default",
159
+ "textAlignment": "left",
160
+ "textColor": "default",
161
+ },
162
+ "type": "paragraph",
163
+ },
164
+ ]
165
+ `;
166
+
167
+ exports[`Test replaceBlocks > Replace all blocks in columns with single block 1`] = `
168
+ [
169
+ {
170
+ "children": [
171
+ {
172
+ "children": [],
173
+ "content": [
174
+ {
175
+ "styles": {},
176
+ "text": "Nested Paragraph 0",
177
+ "type": "text",
178
+ },
179
+ ],
180
+ "id": "nested-paragraph-0",
181
+ "props": {
182
+ "backgroundColor": "default",
183
+ "textAlignment": "left",
184
+ "textColor": "default",
185
+ },
186
+ "type": "paragraph",
187
+ },
188
+ ],
189
+ "content": [
190
+ {
191
+ "styles": {},
192
+ "text": "Paragraph 0",
193
+ "type": "text",
194
+ },
195
+ ],
196
+ "id": "paragraph-0",
197
+ "props": {
198
+ "backgroundColor": "default",
199
+ "textAlignment": "left",
200
+ "textColor": "default",
201
+ },
202
+ "type": "paragraph",
203
+ },
204
+ {
205
+ "children": [],
206
+ "content": [
207
+ {
208
+ "styles": {},
209
+ "text": "Paragraph 1",
210
+ "type": "text",
211
+ },
212
+ ],
213
+ "id": "paragraph-1",
214
+ "props": {
215
+ "backgroundColor": "default",
216
+ "textAlignment": "left",
217
+ "textColor": "default",
218
+ },
219
+ "type": "paragraph",
220
+ },
221
+ {
222
+ "children": [],
223
+ "content": [
224
+ {
225
+ "styles": {},
226
+ "text": "New Paragraph",
227
+ "type": "text",
228
+ },
229
+ ],
230
+ "id": "0",
231
+ "props": {
232
+ "backgroundColor": "default",
233
+ "textAlignment": "left",
234
+ "textColor": "default",
235
+ },
236
+ "type": "paragraph",
237
+ },
238
+ {
239
+ "children": [],
240
+ "content": [
241
+ {
242
+ "styles": {},
243
+ "text": "Paragraph 2",
244
+ "type": "text",
245
+ },
246
+ ],
247
+ "id": "paragraph-2",
248
+ "props": {
249
+ "backgroundColor": "default",
250
+ "textAlignment": "left",
251
+ "textColor": "default",
252
+ },
253
+ "type": "paragraph",
254
+ },
255
+ {
256
+ "children": [],
257
+ "content": [],
258
+ "id": "trailing-paragraph",
259
+ "props": {
260
+ "backgroundColor": "default",
261
+ "textAlignment": "left",
262
+ "textColor": "default",
263
+ },
264
+ "type": "paragraph",
265
+ },
266
+ ]
267
+ `;
268
+
3
269
  exports[`Test replaceBlocks > Replace paragraph with column list above column list 1`] = `
4
270
  [
5
271
  {
@@ -11,9 +11,72 @@ describe("Test removeBlocks", () => {
11
11
  expect(getEditor().document).toMatchSnapshot();
12
12
  });
13
13
 
14
+ it("Remove all blocks in second column", () => {
15
+ getEditor().removeBlocks(["column-paragraph-2", "column-paragraph-3"]);
16
+
17
+ expect(getEditor().document).toMatchSnapshot();
18
+ });
19
+
20
+ it("Remove all blocks in columns", () => {
21
+ getEditor().removeBlocks([
22
+ "column-paragraph-0",
23
+ "column-paragraph-1",
24
+ "column-paragraph-2",
25
+ "column-paragraph-3",
26
+ ]);
27
+
28
+ expect(getEditor().document).toMatchSnapshot();
29
+ });
30
+
31
+ it("Remove column in columnList", () => {
32
+ getEditor().removeBlocks(["column-0"]);
33
+
34
+ expect(getEditor().document).toMatchSnapshot();
35
+ });
36
+
14
37
  it("Remove all columns in columnList", () => {
15
38
  getEditor().removeBlocks(["column-0", "column-1"]);
16
39
 
17
40
  expect(getEditor().document).toMatchSnapshot();
18
41
  });
42
+
43
+ it("Remove all blocks in column and block after", () => {
44
+ getEditor().removeBlocks([
45
+ "column-paragraph-0",
46
+ "column-paragraph-1",
47
+ "paragraph-2",
48
+ ]);
49
+
50
+ expect(getEditor().document).toMatchSnapshot();
51
+ });
52
+
53
+ it("Remove all blocks in columns and block after", () => {
54
+ getEditor().removeBlocks([
55
+ "column-paragraph-0",
56
+ "column-paragraph-1",
57
+ "column-paragraph-2",
58
+ "column-paragraph-3",
59
+ "paragraph-2",
60
+ ]);
61
+
62
+ expect(getEditor().document).toMatchSnapshot();
63
+ });
64
+
65
+ it("Remove column in columnList and block after", () => {
66
+ getEditor().removeBlocks(["column-0", "paragraph-2"]);
67
+
68
+ expect(getEditor().document).toMatchSnapshot();
69
+ });
70
+
71
+ it("Remove all columns in columnList and block after", () => {
72
+ getEditor().removeBlocks(["column-0", "column-1", "paragraph-2"]);
73
+
74
+ expect(getEditor().document).toMatchSnapshot();
75
+ });
76
+
77
+ it("Remove column and and block in column after", () => {
78
+ getEditor().removeBlocks(["column-0", "column-paragraph-2"]);
79
+
80
+ expect(getEditor().document).toMatchSnapshot();
81
+ });
19
82
  });
@@ -37,4 +37,37 @@ describe("Test replaceBlocks", () => {
37
37
 
38
38
  expect(getEditor().document).toMatchSnapshot();
39
39
  });
40
+
41
+ it("Replace all blocks in column with single block", () => {
42
+ getEditor().replaceBlocks(
43
+ ["column-paragraph-0", "column-paragraph-1"],
44
+ [
45
+ {
46
+ type: "paragraph",
47
+ content: "New Paragraph",
48
+ },
49
+ ],
50
+ );
51
+
52
+ expect(getEditor().document).toMatchSnapshot();
53
+ });
54
+
55
+ it("Replace all blocks in columns with single block", () => {
56
+ getEditor().replaceBlocks(
57
+ [
58
+ "column-paragraph-0",
59
+ "column-paragraph-1",
60
+ "column-paragraph-2",
61
+ "column-paragraph-3",
62
+ ],
63
+ [
64
+ {
65
+ type: "paragraph",
66
+ content: "New Paragraph",
67
+ },
68
+ ],
69
+ );
70
+
71
+ expect(getEditor().document).toMatchSnapshot();
72
+ });
40
73
  });