@atlaskit/editor-plugin-table 4.0.0 → 4.0.2
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 +146 -133
- package/README.md +1 -1
- package/dist/cjs/plugins/table/commands/insert.js +2 -2
- package/dist/cjs/plugins/table/commands/sort.js +3 -3
- package/dist/cjs/plugins/table/handlers.js +2 -2
- package/dist/cjs/plugins/table/nodeviews/TableComponent.js +2 -1
- package/dist/cjs/plugins/table/toolbar.js +3 -3
- package/dist/cjs/plugins/table/transforms/delete-columns.js +2 -2
- package/dist/cjs/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +3 -3
- package/dist/es2019/plugins/table/commands/insert.js +1 -1
- package/dist/es2019/plugins/table/commands/sort.js +1 -1
- package/dist/es2019/plugins/table/handlers.js +1 -1
- package/dist/es2019/plugins/table/nodeviews/TableComponent.js +2 -1
- package/dist/es2019/plugins/table/toolbar.js +1 -1
- package/dist/es2019/plugins/table/transforms/delete-columns.js +1 -1
- package/dist/es2019/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +1 -1
- package/dist/esm/plugins/table/commands/insert.js +1 -1
- package/dist/esm/plugins/table/commands/sort.js +1 -1
- package/dist/esm/plugins/table/handlers.js +1 -1
- package/dist/esm/plugins/table/nodeviews/TableComponent.js +2 -1
- package/dist/esm/plugins/table/toolbar.js +1 -1
- package/dist/esm/plugins/table/transforms/delete-columns.js +1 -1
- package/dist/esm/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +1 -1
- package/dist/types/plugins/table/commands/sort.d.ts +2 -2
- package/dist/types/plugins/table/commands-with-analytics.d.ts +4 -4
- package/dist/types/plugins/table/handlers.d.ts +2 -2
- package/dist/types/plugins/table/nodeviews/TableComponent.d.ts +1 -1
- package/dist/types/plugins/table/types.d.ts +1 -1
- package/dist/types/plugins/table/ui/TableFloatingControls/index.d.ts +4 -4
- package/dist/types-ts4.5/plugins/table/commands/sort.d.ts +2 -2
- package/dist/types-ts4.5/plugins/table/commands-with-analytics.d.ts +4 -4
- package/dist/types-ts4.5/plugins/table/handlers.d.ts +2 -2
- package/dist/types-ts4.5/plugins/table/nodeviews/TableComponent.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/types.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/index.d.ts +4 -4
- package/docs/0-intro.tsx +1 -1
- package/package.json +5 -4
- package/src/__tests__/integration/__snapshots__/auto-size.ts.snap +3 -0
- package/src/__tests__/integration/__snapshots__/copy-button.ts.snap +2 -0
- package/src/__tests__/integration/__snapshots__/delete-columns.ts.snap +2 -0
- package/src/__tests__/integration/__snapshots__/delete-last-column-in-full-width.ts.snap +1 -0
- package/src/__tests__/integration/__snapshots__/delete-last-column-with-empty-action.ts.snap +1 -0
- package/src/__tests__/integration/__snapshots__/delete-last-row-with-empty-action.ts.snap +2 -0
- package/src/__tests__/integration/__snapshots__/delete-rows.ts.snap +3 -0
- package/src/__tests__/integration/__snapshots__/deleting-empty-paragraph-under-table.ts.snap +3 -0
- package/src/__tests__/integration/__snapshots__/even-columns.ts.snap +2 -0
- package/src/__tests__/integration/__snapshots__/insert-cell-header-with-strong-mark.ts.snap +1 -0
- package/src/__tests__/integration/__snapshots__/insert-row-inside-layout.ts.snap +1 -0
- package/src/__tests__/integration/__snapshots__/layout.ts.snap +9 -0
- package/src/__tests__/integration/__snapshots__/resize.ts.snap +11 -0
- package/src/__tests__/integration/__snapshots__/scale.ts.snap +2 -0
- package/src/__tests__/unit/commands/sort.ts +1 -1
- package/src/__tests__/unit/pm-plugins/table-width.ts +190 -1
- package/src/__tests__/unit/sort-column.ts +1 -1
- package/src/plugins/table/commands/insert.ts +1 -1
- package/src/plugins/table/commands/sort.ts +7 -7
- package/src/plugins/table/commands-with-analytics.ts +11 -6
- package/src/plugins/table/handlers.ts +7 -8
- package/src/plugins/table/nodeviews/TableComponent.tsx +7 -2
- package/src/plugins/table/nodeviews/table.tsx +1 -1
- package/src/plugins/table/toolbar.tsx +1 -1
- package/src/plugins/table/transforms/delete-columns.ts +1 -1
- package/src/plugins/table/types.ts +1 -1
- package/src/plugins/table/ui/FloatingContextualMenu/ContextualMenu.tsx +1 -1
- package/src/plugins/table/ui/TableFloatingControls/index.tsx +4 -4
- package/tsconfig.app.json +3 -0
- package/tsconfig.dev.json +3 -0
|
@@ -9,6 +9,7 @@ Object {
|
|
|
9
9
|
"isNumberColumnEnabled": false,
|
|
10
10
|
"layout": "full-width",
|
|
11
11
|
"localId": "abc-123",
|
|
12
|
+
"width": null,
|
|
12
13
|
},
|
|
13
14
|
"content": Array [
|
|
14
15
|
Object {
|
|
@@ -187,6 +188,7 @@ Object {
|
|
|
187
188
|
"isNumberColumnEnabled": false,
|
|
188
189
|
"layout": "wide",
|
|
189
190
|
"localId": "abc-123",
|
|
191
|
+
"width": null,
|
|
190
192
|
},
|
|
191
193
|
"content": Array [
|
|
192
194
|
Object {
|
|
@@ -365,6 +367,7 @@ Object {
|
|
|
365
367
|
"isNumberColumnEnabled": false,
|
|
366
368
|
"layout": "default",
|
|
367
369
|
"localId": "abc-123",
|
|
370
|
+
"width": null,
|
|
368
371
|
},
|
|
369
372
|
"content": Array [
|
|
370
373
|
Object {
|
|
@@ -519,6 +522,7 @@ Object {
|
|
|
519
522
|
"isNumberColumnEnabled": false,
|
|
520
523
|
"layout": "full-width",
|
|
521
524
|
"localId": "abc-123",
|
|
525
|
+
"width": null,
|
|
522
526
|
},
|
|
523
527
|
"content": Array [
|
|
524
528
|
Object {
|
|
@@ -673,6 +677,7 @@ Object {
|
|
|
673
677
|
"isNumberColumnEnabled": false,
|
|
674
678
|
"layout": "wide",
|
|
675
679
|
"localId": "abc-123",
|
|
680
|
+
"width": null,
|
|
676
681
|
},
|
|
677
682
|
"content": Array [
|
|
678
683
|
Object {
|
|
@@ -843,6 +848,7 @@ Object {
|
|
|
843
848
|
"isNumberColumnEnabled": false,
|
|
844
849
|
"layout": "default",
|
|
845
850
|
"localId": "abc-123",
|
|
851
|
+
"width": null,
|
|
846
852
|
},
|
|
847
853
|
"content": Array [
|
|
848
854
|
Object {
|
|
@@ -1063,6 +1069,7 @@ Object {
|
|
|
1063
1069
|
"isNumberColumnEnabled": false,
|
|
1064
1070
|
"layout": "default",
|
|
1065
1071
|
"localId": "abc-123",
|
|
1072
|
+
"width": null,
|
|
1066
1073
|
},
|
|
1067
1074
|
"content": Array [
|
|
1068
1075
|
Object {
|
|
@@ -1260,6 +1267,7 @@ Object {
|
|
|
1260
1267
|
"isNumberColumnEnabled": false,
|
|
1261
1268
|
"layout": "default",
|
|
1262
1269
|
"localId": "abc-123",
|
|
1270
|
+
"width": null,
|
|
1263
1271
|
},
|
|
1264
1272
|
"content": Array [
|
|
1265
1273
|
Object {
|
|
@@ -1472,6 +1480,7 @@ Object {
|
|
|
1472
1480
|
"isNumberColumnEnabled": false,
|
|
1473
1481
|
"layout": "default",
|
|
1474
1482
|
"localId": "abc-123",
|
|
1483
|
+
"width": null,
|
|
1475
1484
|
},
|
|
1476
1485
|
"content": Array [
|
|
1477
1486
|
Object {
|
|
@@ -9,6 +9,7 @@ Object {
|
|
|
9
9
|
"isNumberColumnEnabled": true,
|
|
10
10
|
"layout": "full-width",
|
|
11
11
|
"localId": "abc-123",
|
|
12
|
+
"width": null,
|
|
12
13
|
},
|
|
13
14
|
"content": Array [
|
|
14
15
|
Object {
|
|
@@ -248,6 +249,7 @@ Object {
|
|
|
248
249
|
"isNumberColumnEnabled": false,
|
|
249
250
|
"layout": "default",
|
|
250
251
|
"localId": "abc-123",
|
|
252
|
+
"width": null,
|
|
251
253
|
},
|
|
252
254
|
"content": Array [
|
|
253
255
|
Object {
|
|
@@ -405,6 +407,7 @@ Object {
|
|
|
405
407
|
"isNumberColumnEnabled": false,
|
|
406
408
|
"layout": "default",
|
|
407
409
|
"localId": "abc-123",
|
|
410
|
+
"width": null,
|
|
408
411
|
},
|
|
409
412
|
"content": Array [
|
|
410
413
|
Object {
|
|
@@ -566,6 +569,7 @@ Object {
|
|
|
566
569
|
"isNumberColumnEnabled": false,
|
|
567
570
|
"layout": "default",
|
|
568
571
|
"localId": "abc-123",
|
|
572
|
+
"width": null,
|
|
569
573
|
},
|
|
570
574
|
"content": Array [
|
|
571
575
|
Object {
|
|
@@ -761,6 +765,7 @@ Object {
|
|
|
761
765
|
"isNumberColumnEnabled": false,
|
|
762
766
|
"layout": "default",
|
|
763
767
|
"localId": "abc-123",
|
|
768
|
+
"width": null,
|
|
764
769
|
},
|
|
765
770
|
"content": Array [
|
|
766
771
|
Object {
|
|
@@ -1035,6 +1040,7 @@ Object {
|
|
|
1035
1040
|
"isNumberColumnEnabled": false,
|
|
1036
1041
|
"layout": "default",
|
|
1037
1042
|
"localId": "abc-123",
|
|
1043
|
+
"width": null,
|
|
1038
1044
|
},
|
|
1039
1045
|
"content": Array [
|
|
1040
1046
|
Object {
|
|
@@ -1261,6 +1267,7 @@ Object {
|
|
|
1261
1267
|
"isNumberColumnEnabled": false,
|
|
1262
1268
|
"layout": "default",
|
|
1263
1269
|
"localId": "abc-123",
|
|
1270
|
+
"width": null,
|
|
1264
1271
|
},
|
|
1265
1272
|
"content": Array [
|
|
1266
1273
|
Object {
|
|
@@ -1631,6 +1638,7 @@ Object {
|
|
|
1631
1638
|
"isNumberColumnEnabled": true,
|
|
1632
1639
|
"layout": "default",
|
|
1633
1640
|
"localId": "abc-123",
|
|
1641
|
+
"width": null,
|
|
1634
1642
|
},
|
|
1635
1643
|
"content": Array [
|
|
1636
1644
|
Object {
|
|
@@ -1860,6 +1868,7 @@ Object {
|
|
|
1860
1868
|
"isNumberColumnEnabled": false,
|
|
1861
1869
|
"layout": "default",
|
|
1862
1870
|
"localId": "abc-123",
|
|
1871
|
+
"width": null,
|
|
1863
1872
|
},
|
|
1864
1873
|
"content": Array [
|
|
1865
1874
|
Object {
|
|
@@ -2134,6 +2143,7 @@ Object {
|
|
|
2134
2143
|
"isNumberColumnEnabled": false,
|
|
2135
2144
|
"layout": "default",
|
|
2136
2145
|
"localId": "abc-123",
|
|
2146
|
+
"width": null,
|
|
2137
2147
|
},
|
|
2138
2148
|
"content": Array [
|
|
2139
2149
|
Object {
|
|
@@ -2408,6 +2418,7 @@ Object {
|
|
|
2408
2418
|
"isNumberColumnEnabled": false,
|
|
2409
2419
|
"layout": "default",
|
|
2410
2420
|
"localId": "abc-123",
|
|
2421
|
+
"width": null,
|
|
2411
2422
|
},
|
|
2412
2423
|
"content": Array [
|
|
2413
2424
|
Object {
|
|
@@ -9,6 +9,7 @@ Object {
|
|
|
9
9
|
"isNumberColumnEnabled": false,
|
|
10
10
|
"layout": "default",
|
|
11
11
|
"localId": "abc-123",
|
|
12
|
+
"width": null,
|
|
12
13
|
},
|
|
13
14
|
"content": Array [
|
|
14
15
|
Object {
|
|
@@ -718,6 +719,7 @@ Object {
|
|
|
718
719
|
"isNumberColumnEnabled": false,
|
|
719
720
|
"layout": "default",
|
|
720
721
|
"localId": "abc-123",
|
|
722
|
+
"width": null,
|
|
721
723
|
},
|
|
722
724
|
"content": Array [
|
|
723
725
|
Object {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { uuid } from '@atlaskit/adf-schema';
|
|
2
|
-
import { TableSortOrder as SortOrder } from '@atlaskit/
|
|
2
|
+
import { TableSortOrder as SortOrder } from '@atlaskit/custom-steps';
|
|
3
3
|
// eslint-disable-next-line import/no-extraneous-dependencies -- Removed import for fixing circular dependencies
|
|
4
4
|
import selectionPlugin from '@atlaskit/editor-core/src/plugins/selection';
|
|
5
5
|
import { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
@@ -6,6 +6,7 @@ import { contentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertio
|
|
|
6
6
|
import { featureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
|
|
7
7
|
import { guidelinePlugin } from '@atlaskit/editor-plugin-guideline';
|
|
8
8
|
import { widthPlugin } from '@atlaskit/editor-plugin-width';
|
|
9
|
+
import { undo } from '@atlaskit/editor-prosemirror/history';
|
|
9
10
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
10
11
|
import type { LightEditorPlugin } from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
|
|
11
12
|
// eslint-disable-next-line import/no-extraneous-dependencies -- Removed import for fixing circular dependencies
|
|
@@ -26,6 +27,42 @@ import {
|
|
|
26
27
|
import tablePlugin from '../../../plugins/table-plugin';
|
|
27
28
|
import { pluginKey as tablePluginKey } from '../../../plugins/table/pm-plugins/plugin-key';
|
|
28
29
|
|
|
30
|
+
const createDoc = (attrs: any) =>
|
|
31
|
+
doc(
|
|
32
|
+
table(attrs)(
|
|
33
|
+
tr(tdEmpty, tdEmpty, tdEmpty),
|
|
34
|
+
tr(tdEmpty, tdEmpty, tdEmpty),
|
|
35
|
+
tr(tdEmpty, tdEmpty, tdEmpty),
|
|
36
|
+
),
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
const expectedDocuments = {
|
|
40
|
+
fullWidthAppearanceLayoutDefault: createDoc({
|
|
41
|
+
localId: 'localId',
|
|
42
|
+
isNumberColumnEnabled: false,
|
|
43
|
+
layout: 'default',
|
|
44
|
+
width: 1800,
|
|
45
|
+
}),
|
|
46
|
+
fixedWidthAppearanceLayoutDefault: createDoc({
|
|
47
|
+
localId: 'localId',
|
|
48
|
+
isNumberColumnEnabled: false,
|
|
49
|
+
layout: 'default',
|
|
50
|
+
width: 760,
|
|
51
|
+
}),
|
|
52
|
+
fixedWidthAppearanceLayoutWide: createDoc({
|
|
53
|
+
localId: 'localId',
|
|
54
|
+
isNumberColumnEnabled: false,
|
|
55
|
+
layout: 'wide',
|
|
56
|
+
width: 960,
|
|
57
|
+
}),
|
|
58
|
+
fixedWidthAppearanceLayoutFullWidth: createDoc({
|
|
59
|
+
localId: 'localId',
|
|
60
|
+
isNumberColumnEnabled: false,
|
|
61
|
+
layout: 'full-width',
|
|
62
|
+
width: 1800,
|
|
63
|
+
}),
|
|
64
|
+
};
|
|
65
|
+
|
|
29
66
|
describe('table width', () => {
|
|
30
67
|
const createEditor = createProsemirrorEditorFactory();
|
|
31
68
|
|
|
@@ -34,7 +71,7 @@ describe('table width', () => {
|
|
|
34
71
|
global['fetch'] = jest.fn();
|
|
35
72
|
});
|
|
36
73
|
|
|
37
|
-
const editor = (doc: DocBuilder) => {
|
|
74
|
+
const editor = (doc: DocBuilder, isFullWidthEnabled = false) => {
|
|
38
75
|
return createEditor({
|
|
39
76
|
doc,
|
|
40
77
|
attachTo: document.body,
|
|
@@ -48,6 +85,7 @@ describe('table width', () => {
|
|
|
48
85
|
.add([
|
|
49
86
|
tablePlugin,
|
|
50
87
|
{
|
|
88
|
+
fullWidthEnabled: isFullWidthEnabled,
|
|
51
89
|
tableResizingEnabled: true, // so table-width plugin is enabled
|
|
52
90
|
tableOptions: {
|
|
53
91
|
advanced: true,
|
|
@@ -99,4 +137,155 @@ describe('table width', () => {
|
|
|
99
137
|
);
|
|
100
138
|
});
|
|
101
139
|
});
|
|
140
|
+
|
|
141
|
+
describe('Load an existing table with width attr equal null', () => {
|
|
142
|
+
describe('full-width editor appearance', () => {
|
|
143
|
+
it('should translate table width attr to 1800', () => {
|
|
144
|
+
const { editorView } = editor(
|
|
145
|
+
doc(
|
|
146
|
+
// @ts-ignore
|
|
147
|
+
table({ localId: 'localId', layout: 'default', width: null })(
|
|
148
|
+
tr(tdEmpty, tdEmpty, tdEmpty),
|
|
149
|
+
tr(tdEmpty, tdEmpty, tdEmpty),
|
|
150
|
+
tr(tdEmpty, tdEmpty, tdEmpty),
|
|
151
|
+
),
|
|
152
|
+
),
|
|
153
|
+
true,
|
|
154
|
+
);
|
|
155
|
+
|
|
156
|
+
// create `replaceDocument` step
|
|
157
|
+
editorView.dispatch(
|
|
158
|
+
editorView.state.tr.setMeta('replaceDocument', true),
|
|
159
|
+
);
|
|
160
|
+
|
|
161
|
+
expect(editorView.state.doc).toEqualDocument(
|
|
162
|
+
expectedDocuments.fullWidthAppearanceLayoutDefault,
|
|
163
|
+
);
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
it('should not remove width when undo is sent', () => {
|
|
167
|
+
const { editorView } = editor(
|
|
168
|
+
doc(
|
|
169
|
+
// @ts-ignore
|
|
170
|
+
table({ localId: 'localId', layout: 'default', width: null })(
|
|
171
|
+
tr(tdEmpty, tdEmpty, tdEmpty),
|
|
172
|
+
tr(tdEmpty, tdEmpty, tdEmpty),
|
|
173
|
+
tr(tdEmpty, tdEmpty, tdEmpty),
|
|
174
|
+
),
|
|
175
|
+
),
|
|
176
|
+
true,
|
|
177
|
+
);
|
|
178
|
+
|
|
179
|
+
// create `replaceDocument` step
|
|
180
|
+
editorView.dispatch(
|
|
181
|
+
editorView.state.tr.setMeta('replaceDocument', true),
|
|
182
|
+
);
|
|
183
|
+
|
|
184
|
+
expect(editorView.state.doc).toEqualDocument(
|
|
185
|
+
expectedDocuments.fullWidthAppearanceLayoutDefault,
|
|
186
|
+
);
|
|
187
|
+
|
|
188
|
+
undo(editorView.state, editorView.dispatch);
|
|
189
|
+
|
|
190
|
+
expect(editorView.state.doc).toEqualDocument(
|
|
191
|
+
expectedDocuments.fullWidthAppearanceLayoutDefault,
|
|
192
|
+
);
|
|
193
|
+
});
|
|
194
|
+
});
|
|
195
|
+
describe('fixed-width editor appearance', () => {
|
|
196
|
+
it('should translate table width attr to 760 for default layout', () => {
|
|
197
|
+
const { editorView } = editor(
|
|
198
|
+
doc(
|
|
199
|
+
// @ts-ignore
|
|
200
|
+
table({ localId: 'localId', layout: 'default', width: null })(
|
|
201
|
+
tr(tdEmpty, tdEmpty, tdEmpty),
|
|
202
|
+
tr(tdEmpty, tdEmpty, tdEmpty),
|
|
203
|
+
tr(tdEmpty, tdEmpty, tdEmpty),
|
|
204
|
+
),
|
|
205
|
+
),
|
|
206
|
+
);
|
|
207
|
+
|
|
208
|
+
// create `replaceDocument` step
|
|
209
|
+
editorView.dispatch(
|
|
210
|
+
editorView.state.tr.setMeta('replaceDocument', true),
|
|
211
|
+
);
|
|
212
|
+
|
|
213
|
+
expect(editorView.state.doc).toEqualDocument(
|
|
214
|
+
expectedDocuments.fixedWidthAppearanceLayoutDefault,
|
|
215
|
+
);
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
it('should not remove width when undo is sent', () => {
|
|
219
|
+
const { editorView } = editor(
|
|
220
|
+
doc(
|
|
221
|
+
// @ts-ignore
|
|
222
|
+
table({ localId: 'localId', layout: 'default', width: null })(
|
|
223
|
+
tr(tdEmpty, tdEmpty, tdEmpty),
|
|
224
|
+
tr(tdEmpty, tdEmpty, tdEmpty),
|
|
225
|
+
tr(tdEmpty, tdEmpty, tdEmpty),
|
|
226
|
+
),
|
|
227
|
+
),
|
|
228
|
+
);
|
|
229
|
+
|
|
230
|
+
// create `replaceDocument` step
|
|
231
|
+
editorView.dispatch(
|
|
232
|
+
editorView.state.tr.setMeta('replaceDocument', true),
|
|
233
|
+
);
|
|
234
|
+
|
|
235
|
+
expect(editorView.state.doc).toEqualDocument(
|
|
236
|
+
expectedDocuments.fixedWidthAppearanceLayoutDefault,
|
|
237
|
+
);
|
|
238
|
+
|
|
239
|
+
undo(editorView.state, editorView.dispatch);
|
|
240
|
+
|
|
241
|
+
expect(editorView.state.doc).toEqualDocument(
|
|
242
|
+
expectedDocuments.fixedWidthAppearanceLayoutDefault,
|
|
243
|
+
);
|
|
244
|
+
});
|
|
245
|
+
|
|
246
|
+
it('should translate table width attr to 960 for wide layout', () => {
|
|
247
|
+
const { editorView } = editor(
|
|
248
|
+
doc(
|
|
249
|
+
// @ts-ignore
|
|
250
|
+
table({ localId: 'localId', layout: 'wide', width: null })(
|
|
251
|
+
tr(tdEmpty, tdEmpty, tdEmpty),
|
|
252
|
+
tr(tdEmpty, tdEmpty, tdEmpty),
|
|
253
|
+
tr(tdEmpty, tdEmpty, tdEmpty),
|
|
254
|
+
),
|
|
255
|
+
),
|
|
256
|
+
);
|
|
257
|
+
|
|
258
|
+
// create `replaceDocument` step
|
|
259
|
+
editorView.dispatch(
|
|
260
|
+
editorView.state.tr.setMeta('replaceDocument', true),
|
|
261
|
+
);
|
|
262
|
+
|
|
263
|
+
expect(editorView.state.doc).toEqualDocument(
|
|
264
|
+
expectedDocuments.fixedWidthAppearanceLayoutWide,
|
|
265
|
+
);
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
it('should translate table width attr to 1800 for full-width layout', () => {
|
|
269
|
+
const { editorView } = editor(
|
|
270
|
+
doc(
|
|
271
|
+
// @ts-ignore
|
|
272
|
+
table({ localId: 'localId', layout: 'full-width', width: null })(
|
|
273
|
+
tr(tdEmpty, tdEmpty, tdEmpty),
|
|
274
|
+
tr(tdEmpty, tdEmpty, tdEmpty),
|
|
275
|
+
tr(tdEmpty, tdEmpty, tdEmpty),
|
|
276
|
+
),
|
|
277
|
+
),
|
|
278
|
+
);
|
|
279
|
+
|
|
280
|
+
// create `replaceDocument` step
|
|
281
|
+
editorView.dispatch(
|
|
282
|
+
editorView.state.tr.setMeta('replaceDocument', true),
|
|
283
|
+
);
|
|
284
|
+
|
|
285
|
+
expect(editorView.state.doc).toEqualDocument(
|
|
286
|
+
expectedDocuments.fixedWidthAppearanceLayoutFullWidth,
|
|
287
|
+
);
|
|
288
|
+
});
|
|
289
|
+
});
|
|
290
|
+
});
|
|
102
291
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { uuid } from '@atlaskit/adf-schema';
|
|
2
|
-
import { TableSortOrder as SortOrder } from '@atlaskit/
|
|
2
|
+
import { TableSortOrder as SortOrder } from '@atlaskit/custom-steps';
|
|
3
3
|
import type { DocBuilder } from '@atlaskit/editor-common/types';
|
|
4
4
|
// eslint-disable-next-line import/no-extraneous-dependencies -- Removed import for fixing circular dependencies
|
|
5
5
|
import selectionPlugin from '@atlaskit/editor-core/src/plugins/selection';
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { CardAttributes, DataType, UrlType } from '@atlaskit/adf-schema';
|
|
1
|
+
import type { CardAttributes, DataType, UrlType } from '@atlaskit/adf-schema';
|
|
2
2
|
import {
|
|
3
3
|
TableSortOrder as SortOrder,
|
|
4
4
|
TableSortStep,
|
|
5
|
-
} from '@atlaskit/
|
|
6
|
-
import { Command } from '@atlaskit/editor-common/types';
|
|
5
|
+
} from '@atlaskit/custom-steps';
|
|
6
|
+
import type { Command } from '@atlaskit/editor-common/types';
|
|
7
7
|
import { createCompareNodes } from '@atlaskit/editor-common/utils';
|
|
8
|
-
import { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
9
|
-
import {
|
|
8
|
+
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
9
|
+
import type {
|
|
10
10
|
EditorState,
|
|
11
|
-
Selection,
|
|
12
11
|
Transaction,
|
|
13
12
|
} from '@atlaskit/editor-prosemirror/state';
|
|
13
|
+
import { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
14
14
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
15
15
|
import {
|
|
16
16
|
convertArrayOfRowsToTableNode,
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
} from '@atlaskit/editor-tables/utils';
|
|
23
23
|
|
|
24
24
|
import { createCommand, getPluginState } from '../pm-plugins/plugin-factory';
|
|
25
|
-
import { TablePluginState } from '../types';
|
|
25
|
+
import type { TablePluginState } from '../types';
|
|
26
26
|
|
|
27
27
|
const createGetInlineCardTextFromStore = (
|
|
28
28
|
attrs: CardAttributes,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { TableLayout } from '@atlaskit/adf-schema';
|
|
2
|
+
import { tableBackgroundColorPalette } from '@atlaskit/adf-schema';
|
|
3
|
+
import type { TableSortOrder as SortOrder } from '@atlaskit/custom-steps';
|
|
3
4
|
import {
|
|
4
5
|
ACTION_SUBJECT,
|
|
5
6
|
EVENT_TYPE,
|
|
@@ -15,9 +16,9 @@ import type {
|
|
|
15
16
|
Command,
|
|
16
17
|
GetEditorContainerWidth,
|
|
17
18
|
} from '@atlaskit/editor-common/types';
|
|
18
|
-
import { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
19
|
+
import type { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
19
20
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
20
|
-
import { Rect } from '@atlaskit/editor-tables/table-map';
|
|
21
|
+
import type { Rect } from '@atlaskit/editor-tables/table-map';
|
|
21
22
|
import {
|
|
22
23
|
findCellClosestToPos,
|
|
23
24
|
findCellRectClosestToPos,
|
|
@@ -43,9 +44,13 @@ import {
|
|
|
43
44
|
} from './commands/toggle';
|
|
44
45
|
import { getPluginState } from './pm-plugins/plugin-factory';
|
|
45
46
|
import { distributeColumnsWidths } from './pm-plugins/table-resizing/commands';
|
|
46
|
-
import { ResizeStateWithAnalytics } from './pm-plugins/table-resizing/utils';
|
|
47
|
+
import type { ResizeStateWithAnalytics } from './pm-plugins/table-resizing/utils';
|
|
47
48
|
import { deleteColumns, deleteRows, mergeCells } from './transforms';
|
|
48
|
-
import {
|
|
49
|
+
import type {
|
|
50
|
+
InsertRowMethods,
|
|
51
|
+
InsertRowOptions,
|
|
52
|
+
RowInsertPosition,
|
|
53
|
+
} from './types';
|
|
49
54
|
import {
|
|
50
55
|
checkIfNumberColumnEnabled,
|
|
51
56
|
getSelectedCellInfo,
|
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
// #region Imports
|
|
2
|
-
import {
|
|
2
|
+
import { TableSortStep } from '@atlaskit/custom-steps';
|
|
3
|
+
import type { TableColumnOrdering } from '@atlaskit/custom-steps';
|
|
3
4
|
import { isTextInput } from '@atlaskit/editor-common/utils';
|
|
4
|
-
import { NodeType } from '@atlaskit/editor-prosemirror/model';
|
|
5
|
+
import type { NodeType } from '@atlaskit/editor-prosemirror/model';
|
|
5
6
|
// @ts-ignore -- ReadonlyTransaction is a local declaration and will cause a TS2305 error in CCFE typecheck
|
|
6
|
-
import {
|
|
7
|
+
import type {
|
|
7
8
|
ReadonlyTransaction,
|
|
8
9
|
Transaction,
|
|
9
10
|
} from '@atlaskit/editor-prosemirror/state';
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
findParentNodeOfType,
|
|
13
|
-
} from '@atlaskit/editor-prosemirror/utils';
|
|
11
|
+
import type { ContentNodeWithPos } from '@atlaskit/editor-prosemirror/utils';
|
|
12
|
+
import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
14
13
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
15
14
|
|
|
16
15
|
import { defaultTableSelection } from './pm-plugins/default-table-selection';
|
|
17
16
|
import { pluginKey as tableResizingPluginKey } from './pm-plugins/table-resizing';
|
|
18
|
-
import { TablePluginState } from './types';
|
|
17
|
+
import type { TablePluginState } from './types';
|
|
19
18
|
import { isTableCollapsible } from './utils/collapse';
|
|
20
19
|
import {
|
|
21
20
|
checkIfHeaderColumnEnabled,
|
|
@@ -5,7 +5,7 @@ import classnames from 'classnames';
|
|
|
5
5
|
import memoizeOne from 'memoize-one';
|
|
6
6
|
import rafSchedule from 'raf-schd';
|
|
7
7
|
|
|
8
|
-
import type { TableColumnOrdering } from '@atlaskit/
|
|
8
|
+
import type { TableColumnOrdering } from '@atlaskit/custom-steps';
|
|
9
9
|
import {
|
|
10
10
|
ACTION_SUBJECT,
|
|
11
11
|
EVENT_TYPE,
|
|
@@ -524,7 +524,12 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
524
524
|
display: 'none',
|
|
525
525
|
}}
|
|
526
526
|
>
|
|
527
|
-
<div
|
|
527
|
+
<div
|
|
528
|
+
style={{
|
|
529
|
+
width: tableRef?.clientWidth,
|
|
530
|
+
height: '100%',
|
|
531
|
+
}}
|
|
532
|
+
></div>
|
|
528
533
|
</div>
|
|
529
534
|
)}
|
|
530
535
|
<div
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import type { TableColumnOrdering } from '@atlaskit/
|
|
3
|
+
import type { TableColumnOrdering } from '@atlaskit/custom-steps';
|
|
4
4
|
import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
5
5
|
import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
6
6
|
import type { PortalProviderAPI } from '@atlaskit/editor-common/portal-provider';
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx } from '@emotion/react';
|
|
3
3
|
import { defineMessages } from 'react-intl-next';
|
|
4
4
|
|
|
5
|
-
import { TableSortOrder as SortOrder } from '@atlaskit/
|
|
5
|
+
import { TableSortOrder as SortOrder } from '@atlaskit/custom-steps';
|
|
6
6
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
7
7
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
8
8
|
import {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CellAttributes } from '@atlaskit/adf-schema';
|
|
2
|
-
import { AddColumnStep } from '@atlaskit/
|
|
2
|
+
import { AddColumnStep } from '@atlaskit/custom-steps';
|
|
3
3
|
import { TABLE_OVERFLOW_CHANGE_TRIGGER } from '@atlaskit/editor-common/analytics';
|
|
4
4
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
5
5
|
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
tableHeaderSelector,
|
|
7
7
|
tablePrefixSelector,
|
|
8
8
|
} from '@atlaskit/adf-schema';
|
|
9
|
-
import type { TableColumnOrdering } from '@atlaskit/
|
|
9
|
+
import type { TableColumnOrdering } from '@atlaskit/custom-steps';
|
|
10
10
|
import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
11
11
|
import { TableSharedCssClassName } from '@atlaskit/editor-common/styles';
|
|
12
12
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
@@ -11,7 +11,7 @@ type DropdownItem = MenuItem & {
|
|
|
11
11
|
};
|
|
12
12
|
};
|
|
13
13
|
|
|
14
|
-
import { TableSortOrder as SortOrder } from '@atlaskit/
|
|
14
|
+
import { TableSortOrder as SortOrder } from '@atlaskit/custom-steps';
|
|
15
15
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
16
16
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
17
17
|
import {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import React, { Component } from 'react';
|
|
2
2
|
|
|
3
|
-
import type { TableColumnOrdering } from '@atlaskit/
|
|
3
|
+
import type { TableColumnOrdering } from '@atlaskit/custom-steps';
|
|
4
4
|
import type { GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
5
5
|
import { browser } from '@atlaskit/editor-common/utils';
|
|
6
|
-
import { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
7
|
-
import { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
6
|
+
import type { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
7
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
8
8
|
|
|
9
9
|
import { hoverRows, selectRow } from '../../commands';
|
|
10
|
-
import { RowStickyState } from '../../pm-plugins/sticky-headers';
|
|
10
|
+
import type { RowStickyState } from '../../pm-plugins/sticky-headers';
|
|
11
11
|
import { isSelectionUpdated } from '../../utils';
|
|
12
12
|
|
|
13
13
|
import { CornerControls } from './CornerControls';
|
package/tsconfig.app.json
CHANGED