@atlaskit/adf-schema 28.1.8 → 28.1.9
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/CHANGELOG.md +10 -0
- package/dist/cjs/schema/create-schema.js +2 -2
- package/dist/cjs/schema/marks/annotation.js +2 -2
- package/dist/cjs/schema/marks/data-consumer.js +2 -2
- package/dist/cjs/schema/marks/fragment.js +2 -2
- package/dist/cjs/schema/marks/link.js +2 -2
- package/dist/cjs/schema/nodes/block-card.js +2 -2
- package/dist/cjs/schema/nodes/expand.js +2 -2
- package/dist/cjs/schema/nodes/media-single.js +2 -2
- package/dist/cjs/schema/nodes/mention.js +2 -2
- package/dist/cjs/schema/nodes/ordered-list.js +2 -2
- package/dist/cjs/schema/nodes/panel.js +2 -2
- package/dist/cjs/schema/nodes/tableNodes.js +2 -2
- package/dist/cjs/steps/analytics.js +2 -2
- package/dist/cjs/steps/set-attrs.js +2 -2
- package/dist/cjs/steps/table/add-column.js +2 -2
- package/dist/cjs/steps/table/utils/cell-step.js +2 -2
- package/dist/cjs/steps/table/utils/side-effects/rows.js +2 -2
- package/dist/esm/schema/create-schema.js +2 -2
- package/dist/esm/schema/marks/annotation.js +2 -2
- package/dist/esm/schema/marks/data-consumer.js +2 -2
- package/dist/esm/schema/marks/fragment.js +2 -2
- package/dist/esm/schema/marks/link.js +2 -2
- package/dist/esm/schema/nodes/block-card.js +2 -2
- package/dist/esm/schema/nodes/expand.js +2 -2
- package/dist/esm/schema/nodes/media-single.js +2 -2
- package/dist/esm/schema/nodes/mention.js +2 -2
- package/dist/esm/schema/nodes/ordered-list.js +2 -2
- package/dist/esm/schema/nodes/panel.js +2 -2
- package/dist/esm/schema/nodes/tableNodes.js +2 -2
- package/dist/esm/steps/analytics.js +2 -2
- package/dist/esm/steps/set-attrs.js +2 -2
- package/dist/esm/steps/table/add-column.js +2 -2
- package/dist/esm/steps/table/utils/cell-step.js +2 -2
- package/dist/esm/steps/table/utils/side-effects/rows.js +2 -2
- package/dist/types/schema/default-schema.d.ts +2 -2
- package/dist/types/schema/jira-schema.d.ts +1 -1
- package/dist/types/schema/marks/data-consumer.d.ts +2 -2
- package/dist/types/schema/marks/fragment.d.ts +1 -1
- package/dist/types/schema/marks/link.d.ts +2 -2
- package/dist/types/schema/nodes/bodied-extension.d.ts +1 -0
- package/dist/types/schema/nodes/code-block.d.ts +1 -1
- package/dist/types/schema/nodes/expand.d.ts +2 -2
- package/dist/types/schema/nodes/extension.d.ts +1 -0
- package/dist/types/schema/nodes/inline-extension.d.ts +1 -0
- package/dist/types/schema/nodes/media-single.d.ts +1 -1
- package/dist/types/schema/nodes/media.d.ts +2 -2
- package/dist/types/schema/nodes/mention.d.ts +2 -2
- package/dist/types/schema/nodes/panel.d.ts +1 -0
- package/dist/types/schema/nodes/tableNodes.d.ts +2 -2
- package/dist/types/schema/nodes/unknown-block.d.ts +1 -0
- package/dist/types/steps/analytics.d.ts +4 -4
- package/dist/types/steps/link-meta-step.d.ts +4 -4
- package/dist/types/steps/set-attrs.d.ts +2 -2
- package/dist/types/steps/table/sort-column.d.ts +4 -4
- package/dist/types/steps/type-ahead.d.ts +4 -4
- package/package.json +2 -2
- package/src/__tests__/unit/schema/nodes/confluence-unsupported-block.ts +1 -5
- package/src/__tests__/unit/schema/nodes/confluence-unsupported-inline.ts +1 -1
- package/src/__tests__/unit/schema/nodes/date.ts +1 -1
- package/src/__tests__/unit/schema/nodes/expand.ts +1 -1
- package/src/__tests__/unit/schema/nodes/inline-extension.ts +1 -1
- package/src/__tests__/unit/schema/nodes/list-item.ts +1 -1
- package/src/__tests__/unit/schema/nodes/media-group.ts +1 -1
- package/src/__tests__/unit/schema/nodes/media-single.ts +1 -1
- package/src/__tests__/unit/schema/nodes/media.ts +1 -5
- package/src/__tests__/unit/schema/nodes/nestedExpand.ts +1 -1
- package/src/__tests__/unit/schema/nodes/ordered-list.ts +1 -1
- package/src/__tests__/unit/schema/nodes/placeholder.ts +1 -1
- package/src/__tests__/unit/schema/nodes/status.ts +1 -1
- package/src/__tests__/unit/schema/nodes/unknown-block.ts +1 -1
- package/src/__tests__/unit/schema/nodes/unsupported-block.ts +1 -1
- package/src/__tests__/unit/schema/nodes/unsupported-inline.ts +1 -1
- package/src/schema/nodes/media-single.ts +2 -2
- package/src/schema/nodes/media.ts +5 -1
- package/src/schema/nodes/tableNodes.ts +3 -5
- package/src/steps/table/__tests__/_utils.ts +6 -7
- package/src/steps/table/__tests__/add-column-merge-columns.ts +27 -9
- package/src/steps/table/__tests__/add-column-merge-rows.ts +24 -8
- package/src/steps/table/__tests__/add-column.ts +46 -18
- package/src/steps/table/add-column.ts +4 -1
- package/src/steps/table/utils/cells-at-column.ts +4 -1
- package/src/utils/colors.ts +1 -1
@@ -166,7 +166,9 @@ describe('AddColumnStep', () => {
|
|
166
166
|
addColumnAtFactory('table', column)(editorState, refs),
|
167
167
|
);
|
168
168
|
|
169
|
-
expect(editorState.doc).
|
169
|
+
expect(editorState.doc.toJSON()).toEqual(
|
170
|
+
expectedDoc(defaultSchema).toJSON(),
|
171
|
+
);
|
170
172
|
},
|
171
173
|
);
|
172
174
|
});
|
@@ -184,7 +186,9 @@ describe('AddColumnStep', () => {
|
|
184
186
|
removeColumnAtFactory('table', column)(editorState, refs),
|
185
187
|
);
|
186
188
|
|
187
|
-
expect(editorState.doc).
|
189
|
+
expect(editorState.doc.toJSON()).toEqual(
|
190
|
+
expectedDoc(defaultSchema).toJSON(),
|
191
|
+
);
|
188
192
|
},
|
189
193
|
);
|
190
194
|
});
|
@@ -214,7 +218,9 @@ describe('AddColumnStep', () => {
|
|
214
218
|
transaction,
|
215
219
|
editorState,
|
216
220
|
);
|
217
|
-
expect(editorState.doc).
|
221
|
+
expect(editorState.doc.toJSON()).toEqual(
|
222
|
+
originalDoc(defaultSchema).toJSON(),
|
223
|
+
);
|
218
224
|
});
|
219
225
|
});
|
220
226
|
|
@@ -323,7 +329,9 @@ describe('AddColumnStep', () => {
|
|
323
329
|
|
324
330
|
editorState = editorState.apply(editorState.tr.step(addColumnStep!));
|
325
331
|
|
326
|
-
expect(editorState.doc).
|
332
|
+
expect(editorState.doc.toJSON()).toEqual(
|
333
|
+
expectedDoc(defaultSchema).toJSON(),
|
334
|
+
);
|
327
335
|
},
|
328
336
|
);
|
329
337
|
});
|
@@ -343,7 +351,9 @@ describe('AddColumnStep', () => {
|
|
343
351
|
const addColumnStep = Step.fromJSON(defaultSchema, jsonStep);
|
344
352
|
editorState = editorState.apply(editorState.tr.step(addColumnStep));
|
345
353
|
|
346
|
-
expect(editorState.doc).
|
354
|
+
expect(editorState.doc.toJSON()).toEqual(
|
355
|
+
expectedDoc(defaultSchema).toJSON(),
|
356
|
+
);
|
347
357
|
},
|
348
358
|
);
|
349
359
|
|
@@ -361,7 +371,9 @@ describe('AddColumnStep', () => {
|
|
361
371
|
const addColumnStep = Step.fromJSON(defaultSchema, jsonStep);
|
362
372
|
editorState = editorState.apply(editorState.tr.step(addColumnStep));
|
363
373
|
|
364
|
-
expect(editorState.doc).
|
374
|
+
expect(editorState.doc.toJSON()).toEqual(
|
375
|
+
expectedDoc(defaultSchema).toJSON(),
|
376
|
+
);
|
365
377
|
},
|
366
378
|
);
|
367
379
|
|
@@ -376,7 +388,9 @@ describe('AddColumnStep', () => {
|
|
376
388
|
const addColumnStep = Step.fromJSON(defaultSchema, jsonStep);
|
377
389
|
editorState = editorState.apply(editorState.tr.step(addColumnStep));
|
378
390
|
|
379
|
-
expect(editorState.doc).
|
391
|
+
expect(editorState.doc.toJSON()).toEqual(
|
392
|
+
expectedDoc(defaultSchema).toJSON(),
|
393
|
+
);
|
380
394
|
},
|
381
395
|
);
|
382
396
|
|
@@ -393,7 +407,9 @@ describe('AddColumnStep', () => {
|
|
393
407
|
const addColumnStep = Step.fromJSON(defaultSchema, jsonStep);
|
394
408
|
editorState = editorState.apply(editorState.tr.step(addColumnStep));
|
395
409
|
|
396
|
-
expect(editorState.doc).
|
410
|
+
expect(editorState.doc.toJSON()).toEqual(
|
411
|
+
expectedDoc(defaultSchema).toJSON(),
|
412
|
+
);
|
397
413
|
},
|
398
414
|
);
|
399
415
|
});
|
@@ -119,7 +119,9 @@ describe('AddColumnStep', () => {
|
|
119
119
|
removeColumnAtFactory('table', 0)(editorState, refs),
|
120
120
|
);
|
121
121
|
|
122
|
-
expect(editorState.doc
|
122
|
+
expect(editorState.doc.toJSON()).toEqual(
|
123
|
+
doc(p(''))(defaultSchema).toJSON(),
|
124
|
+
);
|
123
125
|
});
|
124
126
|
|
125
127
|
it('should add the table after been removed it for a remove column', () => {
|
@@ -127,7 +129,9 @@ describe('AddColumnStep', () => {
|
|
127
129
|
removeColumnAtFactory('table', 0)(editorState, refs),
|
128
130
|
editorState,
|
129
131
|
);
|
130
|
-
expect(editorState.doc).
|
132
|
+
expect(editorState.doc.toJSON()).toEqual(
|
133
|
+
threeByOne(defaultSchema).toJSON(),
|
134
|
+
);
|
131
135
|
});
|
132
136
|
|
133
137
|
it('should remove the table after undoing the last column ', function () {
|
@@ -137,7 +141,9 @@ describe('AddColumnStep', () => {
|
|
137
141
|
[removeColumnAtFactory('table', 1)],
|
138
142
|
);
|
139
143
|
|
140
|
-
expect(editorState.doc
|
144
|
+
expect(editorState.doc.toJSON()).toEqual(
|
145
|
+
doc(p(''))(defaultSchema).toJSON(),
|
146
|
+
);
|
141
147
|
});
|
142
148
|
|
143
149
|
it('should drop add column step when I remove the column', function () {
|
@@ -176,10 +182,14 @@ describe('AddColumnStep', () => {
|
|
176
182
|
|
177
183
|
editorState = editorState.apply(editorState.tr.step(addColumnStep));
|
178
184
|
|
185
|
+
const expectedDoc = doc(
|
186
|
+
p(''),
|
187
|
+
'{table}',
|
188
|
+
table()(tr(tdEmpty), tr(tdEmpty), tr(tdEmpty)),
|
189
|
+
)(defaultSchema).toJSON();
|
190
|
+
|
179
191
|
// Should keep the new created single column and remove the old one
|
180
|
-
expect(editorState.doc).
|
181
|
-
doc(p(''), '{table}', table()(tr(tdEmpty), tr(tdEmpty), tr(tdEmpty))),
|
182
|
-
);
|
192
|
+
expect(editorState.doc.toJSON()).toEqual(expectedDoc);
|
183
193
|
});
|
184
194
|
|
185
195
|
it('should parse a json that we just generate', function () {
|
@@ -216,7 +226,9 @@ describe('AddColumnStep', () => {
|
|
216
226
|
editorState.tr.step(removeLastRowInverted),
|
217
227
|
);
|
218
228
|
|
219
|
-
expect(editorState.doc).
|
229
|
+
expect(editorState.doc.toJSON()).toEqual(
|
230
|
+
threeByOne(defaultSchema).toJSON(),
|
231
|
+
);
|
220
232
|
});
|
221
233
|
|
222
234
|
it('should remove the table when I received a JSON', () => {
|
@@ -229,7 +241,9 @@ describe('AddColumnStep', () => {
|
|
229
241
|
editorState.tr.step(removeLastRowInverted),
|
230
242
|
);
|
231
243
|
|
232
|
-
expect(editorState.doc
|
244
|
+
expect(editorState.doc.toJSON()).toEqual(
|
245
|
+
doc(p(''))(defaultSchema).toJSON(),
|
246
|
+
);
|
233
247
|
});
|
234
248
|
});
|
235
249
|
|
@@ -313,7 +327,9 @@ describe('AddColumnStep', () => {
|
|
313
327
|
addColumnAtFactory('table', column)(editorState, refs),
|
314
328
|
);
|
315
329
|
|
316
|
-
expect(editorState.doc).
|
330
|
+
expect(editorState.doc.toJSON()).toEqual(
|
331
|
+
expectedDoc(defaultSchema).toJSON(),
|
332
|
+
);
|
317
333
|
},
|
318
334
|
);
|
319
335
|
});
|
@@ -331,7 +347,9 @@ describe('AddColumnStep', () => {
|
|
331
347
|
removeColumnAtFactory('table', column)(editorState, refs),
|
332
348
|
);
|
333
349
|
|
334
|
-
expect(editorState.doc).
|
350
|
+
expect(editorState.doc.toJSON()).toEqual(
|
351
|
+
expectedDoc(defaultSchema).toJSON(),
|
352
|
+
);
|
335
353
|
},
|
336
354
|
);
|
337
355
|
});
|
@@ -363,7 +381,9 @@ describe('AddColumnStep', () => {
|
|
363
381
|
addColumnAtFactory('table', column)(editorState, refs),
|
364
382
|
);
|
365
383
|
|
366
|
-
expect(editorState.doc).
|
384
|
+
expect(editorState.doc.toJSON()).toEqual(
|
385
|
+
expectedDoc(defaultSchema).toJSON(),
|
386
|
+
);
|
367
387
|
},
|
368
388
|
);
|
369
389
|
});
|
@@ -381,7 +401,9 @@ describe('AddColumnStep', () => {
|
|
381
401
|
removeColumnAtFactory('table', column)(editorState, refs),
|
382
402
|
);
|
383
403
|
|
384
|
-
expect(editorState.doc).
|
404
|
+
expect(editorState.doc.toJSON()).toEqual(
|
405
|
+
expectedDoc(defaultSchema).toJSON(),
|
406
|
+
);
|
385
407
|
},
|
386
408
|
);
|
387
409
|
});
|
@@ -432,7 +454,7 @@ describe('AddColumnStep', () => {
|
|
432
454
|
transaction,
|
433
455
|
editorState,
|
434
456
|
);
|
435
|
-
expect(editorState.doc).
|
457
|
+
expect(editorState.doc.toJSON()).toEqual(originalDoc.toJSON());
|
436
458
|
});
|
437
459
|
});
|
438
460
|
|
@@ -496,7 +518,9 @@ describe('AddColumnStep', () => {
|
|
496
518
|
|
497
519
|
editorState = editorState.apply(editorState.tr.step(addColumnStep!));
|
498
520
|
|
499
|
-
expect(editorState.doc).
|
521
|
+
expect(editorState.doc.toJSON()).toEqual(
|
522
|
+
expectedDoc(defaultSchema).toJSON(),
|
523
|
+
);
|
500
524
|
},
|
501
525
|
);
|
502
526
|
});
|
@@ -509,13 +533,13 @@ describe('AddColumnStep', () => {
|
|
509
533
|
[addColumnAtFactory('table', 1), addColumnAtFactory('table', 1)],
|
510
534
|
);
|
511
535
|
|
512
|
-
expect(editorState.doc).
|
536
|
+
expect(editorState.doc.toJSON()).toEqual(
|
513
537
|
doc(
|
514
538
|
table()(
|
515
539
|
tr(tdColorA, tdEmpty, tdEmpty, tdColorB, tdColorC),
|
516
540
|
tr(tdColorA, tdEmpty, tdEmpty, tdColorB, tdColorC),
|
517
541
|
),
|
518
|
-
),
|
542
|
+
)(defaultSchema).toJSON(),
|
519
543
|
);
|
520
544
|
});
|
521
545
|
});
|
@@ -533,7 +557,9 @@ describe('AddColumnStep', () => {
|
|
533
557
|
const addColumnStep = Step.fromJSON(defaultSchema, jsonStep);
|
534
558
|
editorState = editorState.apply(editorState.tr.step(addColumnStep));
|
535
559
|
|
536
|
-
expect(editorState.doc).
|
560
|
+
expect(editorState.doc.toJSON()).toEqual(
|
561
|
+
expectedDoc(defaultSchema).toJSON(),
|
562
|
+
);
|
537
563
|
},
|
538
564
|
);
|
539
565
|
|
@@ -548,7 +574,9 @@ describe('AddColumnStep', () => {
|
|
548
574
|
const addColumnStep = Step.fromJSON(defaultSchema, jsonStep);
|
549
575
|
editorState = editorState.apply(editorState.tr.step(addColumnStep));
|
550
576
|
|
551
|
-
expect(editorState.doc).
|
577
|
+
expect(editorState.doc.toJSON()).toEqual(
|
578
|
+
expectedDoc(defaultSchema).toJSON(),
|
579
|
+
);
|
552
580
|
},
|
553
581
|
);
|
554
582
|
});
|
@@ -21,7 +21,10 @@ export interface Cell {
|
|
21
21
|
* @param rect
|
22
22
|
* @param col
|
23
23
|
*/
|
24
|
-
export function* cellsAtColumn(
|
24
|
+
export function* cellsAtColumn(
|
25
|
+
rect: TableRect,
|
26
|
+
col: number,
|
27
|
+
): Generator<Cell, void, number | undefined> {
|
25
28
|
const { map, tableStart, table } = rect;
|
26
29
|
|
27
30
|
let refColumn: number | null = col > 0 ? -1 : 0;
|
package/src/utils/colors.ts
CHANGED
@@ -89,7 +89,7 @@ export function normalizeHexColor(
|
|
89
89
|
// http://dev.w3.org/csswg/css-color/#named-colors
|
90
90
|
if (color === 'default') {
|
91
91
|
return null;
|
92
|
-
} else if (
|
92
|
+
} else if (namedColors.default && (namedColors as any).default[color]) {
|
93
93
|
color = (namedColors as any).default[color];
|
94
94
|
} else if (namedColors && namedColors[color]) {
|
95
95
|
color = namedColors[color];
|