@atlaskit/editor-plugin-table 5.7.3 → 5.7.4
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 +6 -0
- package/dist/cjs/commands/insert.js +1 -1
- package/dist/cjs/transforms/column-width.js +3 -105
- package/dist/cjs/transforms/delete-columns.js +2 -5
- package/dist/es2019/commands/insert.js +1 -1
- package/dist/es2019/transforms/column-width.js +4 -102
- package/dist/es2019/transforms/delete-columns.js +2 -5
- package/dist/esm/commands/insert.js +1 -1
- package/dist/esm/transforms/column-width.js +4 -106
- package/dist/esm/transforms/delete-columns.js +2 -5
- package/dist/types/transforms/column-width.d.ts +1 -14
- package/dist/types-ts4.5/transforms/column-width.d.ts +1 -14
- package/package.json +1 -4
- package/src/__tests__/unit/commands/insert.ts +7 -0
- package/src/__tests__/unit/transforms/delete-columns.ts +147 -368
- package/src/commands/insert.ts +1 -3
- package/src/transforms/column-width.ts +4 -137
- package/src/transforms/delete-columns.ts +3 -9
|
@@ -27,7 +27,6 @@ import {
|
|
|
27
27
|
tdEmpty,
|
|
28
28
|
tr,
|
|
29
29
|
} from '@atlaskit/editor-test-helpers/doc-builder';
|
|
30
|
-
import { ffTest } from '@atlassian/feature-flags-test-utils';
|
|
31
30
|
|
|
32
31
|
import tablePlugin from '../../../plugin';
|
|
33
32
|
import { pluginKey } from '../../../pm-plugins/plugin-key';
|
|
@@ -87,406 +86,186 @@ describe('table plugin -> transforms -> delete columns', () => {
|
|
|
87
86
|
|
|
88
87
|
describe('when selection rect is given', () => {
|
|
89
88
|
describe('when the first column is deleted', () => {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
p('
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
td({})(p('{nextCursorPos}')),
|
|
103
|
-
td({})(p('c2')),
|
|
104
|
-
td({})(p('c3')),
|
|
105
|
-
),
|
|
106
|
-
),
|
|
107
|
-
),
|
|
108
|
-
);
|
|
109
|
-
const { state, dispatch } = editorView;
|
|
110
|
-
dispatch(deleteColumns(colsToRect([0], 1), true)(state.tr));
|
|
111
|
-
expect(editorView.state.doc).toEqualDocument(
|
|
112
|
-
doc(
|
|
113
|
-
p('text'),
|
|
114
|
-
table({ localId: TABLE_LOCAL_ID })(
|
|
115
|
-
tr(td({})(p('c2')), td()(p('c3'))),
|
|
116
|
-
),
|
|
117
|
-
),
|
|
118
|
-
);
|
|
119
|
-
expect(editorView.state.selection.from).toEqual(nextCursorPos);
|
|
120
|
-
},
|
|
121
|
-
() => {
|
|
122
|
-
const {
|
|
123
|
-
editorView,
|
|
124
|
-
refs: { nextCursorPos },
|
|
125
|
-
} = editor(
|
|
126
|
-
doc(
|
|
127
|
-
p('text'),
|
|
128
|
-
table()(
|
|
129
|
-
tr(
|
|
130
|
-
td({})(p('{nextCursorPos}')),
|
|
131
|
-
td({})(p('c2')),
|
|
132
|
-
td({})(p('c3')),
|
|
133
|
-
),
|
|
134
|
-
),
|
|
135
|
-
),
|
|
136
|
-
);
|
|
137
|
-
const { state, dispatch } = editorView;
|
|
138
|
-
dispatch(deleteColumns(colsToRect([0], 1), true)(state.tr));
|
|
139
|
-
expect(editorView.state.doc).toEqualDocument(
|
|
140
|
-
doc(
|
|
141
|
-
p('text'),
|
|
142
|
-
table({ localId: TABLE_LOCAL_ID })(
|
|
143
|
-
tr(td({})(p('c2')), td()(p('c3'))),
|
|
144
|
-
),
|
|
89
|
+
it('should delete the column and move cursor to the first column', () => {
|
|
90
|
+
const {
|
|
91
|
+
editorView,
|
|
92
|
+
refs: { nextCursorPos },
|
|
93
|
+
} = editor(
|
|
94
|
+
doc(
|
|
95
|
+
p('text'),
|
|
96
|
+
table()(
|
|
97
|
+
tr(
|
|
98
|
+
td({})(p('{nextCursorPos}')),
|
|
99
|
+
td({})(p('c2')),
|
|
100
|
+
td({})(p('c3')),
|
|
145
101
|
),
|
|
146
|
-
)
|
|
147
|
-
|
|
148
|
-
|
|
102
|
+
),
|
|
103
|
+
),
|
|
104
|
+
);
|
|
105
|
+
const { state, dispatch } = editorView;
|
|
106
|
+
dispatch(deleteColumns(colsToRect([0], 1), true)(state.tr));
|
|
107
|
+
expect(editorView.state.doc).toEqualDocument(
|
|
108
|
+
doc(
|
|
109
|
+
p('text'),
|
|
110
|
+
table({ localId: TABLE_LOCAL_ID })(
|
|
111
|
+
tr(td({})(p('c2')), td()(p('c3'))),
|
|
112
|
+
),
|
|
113
|
+
),
|
|
149
114
|
);
|
|
115
|
+
expect(editorView.state.selection.from).toEqual(nextCursorPos);
|
|
150
116
|
});
|
|
151
117
|
});
|
|
152
118
|
|
|
153
119
|
describe('when middle column is deleted', () => {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
p('
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
td({})(p('{nextCursorPos}')),
|
|
167
|
-
td({})(p('c2')),
|
|
168
|
-
td({})(p('c3')),
|
|
169
|
-
),
|
|
170
|
-
),
|
|
171
|
-
),
|
|
172
|
-
);
|
|
173
|
-
const { state, dispatch } = editorView;
|
|
174
|
-
dispatch(deleteColumns(colsToRect([1], 1), true)(state.tr));
|
|
175
|
-
expect(editorView.state.doc).toEqualDocument(
|
|
176
|
-
doc(
|
|
177
|
-
p('text'),
|
|
178
|
-
table({ localId: TABLE_LOCAL_ID })(tr(tdEmpty, td()(p('c3')))),
|
|
179
|
-
),
|
|
180
|
-
);
|
|
181
|
-
expect(editorView.state.selection.from).toEqual(nextCursorPos);
|
|
182
|
-
},
|
|
183
|
-
() => {
|
|
184
|
-
const {
|
|
185
|
-
editorView,
|
|
186
|
-
refs: { nextCursorPos },
|
|
187
|
-
} = editor(
|
|
188
|
-
doc(
|
|
189
|
-
p('text'),
|
|
190
|
-
table()(
|
|
191
|
-
tr(
|
|
192
|
-
td({})(p('{nextCursorPos}')),
|
|
193
|
-
td({})(p('c2')),
|
|
194
|
-
td({})(p('c3')),
|
|
195
|
-
),
|
|
196
|
-
),
|
|
197
|
-
),
|
|
198
|
-
);
|
|
199
|
-
const { state, dispatch } = editorView;
|
|
200
|
-
dispatch(deleteColumns(colsToRect([1], 1), true)(state.tr));
|
|
201
|
-
expect(editorView.state.doc).toEqualDocument(
|
|
202
|
-
doc(
|
|
203
|
-
p('text'),
|
|
204
|
-
table({ localId: TABLE_LOCAL_ID })(tr(tdEmpty, td()(p('c3')))),
|
|
120
|
+
it('should delete the column and move cursor to the previous column', () => {
|
|
121
|
+
const {
|
|
122
|
+
editorView,
|
|
123
|
+
refs: { nextCursorPos },
|
|
124
|
+
} = editor(
|
|
125
|
+
doc(
|
|
126
|
+
p('text'),
|
|
127
|
+
table()(
|
|
128
|
+
tr(
|
|
129
|
+
td({})(p('{nextCursorPos}')),
|
|
130
|
+
td({})(p('c2')),
|
|
131
|
+
td({})(p('c3')),
|
|
205
132
|
),
|
|
206
|
-
)
|
|
207
|
-
|
|
208
|
-
|
|
133
|
+
),
|
|
134
|
+
),
|
|
135
|
+
);
|
|
136
|
+
const { state, dispatch } = editorView;
|
|
137
|
+
dispatch(deleteColumns(colsToRect([1], 1), true)(state.tr));
|
|
138
|
+
expect(editorView.state.doc).toEqualDocument(
|
|
139
|
+
doc(
|
|
140
|
+
p('text'),
|
|
141
|
+
table({ localId: TABLE_LOCAL_ID })(tr(tdEmpty, td()(p('c3')))),
|
|
142
|
+
),
|
|
209
143
|
);
|
|
144
|
+
expect(editorView.state.selection.from).toEqual(nextCursorPos);
|
|
210
145
|
});
|
|
211
146
|
});
|
|
212
147
|
|
|
213
148
|
describe('when multiple rows are selected', () => {
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
dispatch(deleteColumns(colsToRect([0, 1], 1), true)(state.tr));
|
|
226
|
-
expect(editorView.state.doc).toEqualDocument(
|
|
227
|
-
doc(
|
|
228
|
-
p('text'),
|
|
229
|
-
table({ localId: TABLE_LOCAL_ID })(tr(td()(p('c2')))),
|
|
230
|
-
),
|
|
231
|
-
);
|
|
232
|
-
},
|
|
233
|
-
() => {
|
|
234
|
-
const { editorView } = editor(
|
|
235
|
-
doc(
|
|
236
|
-
p('text'),
|
|
237
|
-
table()(tr(tdCursor, td({})(p('c1')), td({})(p('c2')))),
|
|
238
|
-
),
|
|
239
|
-
);
|
|
240
|
-
const { state, dispatch } = editorView;
|
|
241
|
-
dispatch(deleteColumns(colsToRect([0, 1], 1), true)(state.tr));
|
|
242
|
-
expect(editorView.state.doc).toEqualDocument(
|
|
243
|
-
doc(
|
|
244
|
-
p('text'),
|
|
245
|
-
table({ localId: TABLE_LOCAL_ID })(tr(td()(p('c2')))),
|
|
246
|
-
),
|
|
247
|
-
);
|
|
248
|
-
},
|
|
149
|
+
it('should delete these columns', () => {
|
|
150
|
+
const { editorView } = editor(
|
|
151
|
+
doc(
|
|
152
|
+
p('text'),
|
|
153
|
+
table()(tr(tdCursor, td({})(p('c1')), td({})(p('c2')))),
|
|
154
|
+
),
|
|
155
|
+
);
|
|
156
|
+
const { state, dispatch } = editorView;
|
|
157
|
+
dispatch(deleteColumns(colsToRect([0, 1], 1), true)(state.tr));
|
|
158
|
+
expect(editorView.state.doc).toEqualDocument(
|
|
159
|
+
doc(p('text'), table({ localId: TABLE_LOCAL_ID })(tr(td()(p('c2'))))),
|
|
249
160
|
);
|
|
250
161
|
});
|
|
251
162
|
});
|
|
252
163
|
});
|
|
253
164
|
|
|
254
165
|
describe('when one column is selected', () => {
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
)
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
tr(td({})(p('b1')), td({})(p('b3'))),
|
|
278
|
-
),
|
|
279
|
-
),
|
|
280
|
-
);
|
|
281
|
-
},
|
|
282
|
-
() => {
|
|
283
|
-
const { editorView } = editor(
|
|
284
|
-
doc(
|
|
285
|
-
p('text'),
|
|
286
|
-
table()(
|
|
287
|
-
tr(td({})(p('a1')), td({})(p('{<cell}a2')), td({})(p('a3'))),
|
|
288
|
-
tr(td({})(p('b1')), td({})(p('{cell>}b2')), td({})(p('b3'))),
|
|
289
|
-
),
|
|
290
|
-
),
|
|
291
|
-
);
|
|
292
|
-
const { state, dispatch } = editorView;
|
|
293
|
-
dispatch(
|
|
294
|
-
deleteColumns(getSelectionRect(state.selection)!, true)(state.tr),
|
|
295
|
-
);
|
|
296
|
-
expect(editorView.state.doc).toEqualDocument(
|
|
297
|
-
doc(
|
|
298
|
-
p('text'),
|
|
299
|
-
table({ localId: TABLE_LOCAL_ID })(
|
|
300
|
-
tr(td({})(p('a1')), td({})(p('a3'))),
|
|
301
|
-
tr(td({})(p('b1')), td({})(p('b3'))),
|
|
302
|
-
),
|
|
303
|
-
),
|
|
304
|
-
);
|
|
305
|
-
},
|
|
166
|
+
it('should delete the column', () => {
|
|
167
|
+
const { editorView } = editor(
|
|
168
|
+
doc(
|
|
169
|
+
p('text'),
|
|
170
|
+
table()(
|
|
171
|
+
tr(td({})(p('a1')), td({})(p('{<cell}a2')), td({})(p('a3'))),
|
|
172
|
+
tr(td({})(p('b1')), td({})(p('{cell>}b2')), td({})(p('b3'))),
|
|
173
|
+
),
|
|
174
|
+
),
|
|
175
|
+
);
|
|
176
|
+
const { state, dispatch } = editorView;
|
|
177
|
+
dispatch(
|
|
178
|
+
deleteColumns(getSelectionRect(state.selection)!, true)(state.tr),
|
|
179
|
+
);
|
|
180
|
+
expect(editorView.state.doc).toEqualDocument(
|
|
181
|
+
doc(
|
|
182
|
+
p('text'),
|
|
183
|
+
table({ localId: TABLE_LOCAL_ID })(
|
|
184
|
+
tr(td({})(p('a1')), td({})(p('a3'))),
|
|
185
|
+
tr(td({})(p('b1')), td({})(p('b3'))),
|
|
186
|
+
),
|
|
187
|
+
),
|
|
306
188
|
);
|
|
307
189
|
});
|
|
308
190
|
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
td({ colwidth: [401] })(p('{<>}')),
|
|
318
|
-
td({ colwidth: [105] })(p('')),
|
|
319
|
-
td({ colwidth: [253] })(p('')),
|
|
320
|
-
),
|
|
321
|
-
),
|
|
322
|
-
),
|
|
323
|
-
);
|
|
324
|
-
const { dispatch, state } = editorView;
|
|
325
|
-
dispatch(
|
|
326
|
-
deleteColumns(colsToRect([1], 1), true, editorView)(state.tr),
|
|
327
|
-
);
|
|
328
|
-
|
|
329
|
-
expect(editorView.state.doc).toEqualDocument(
|
|
330
|
-
doc(
|
|
331
|
-
table({ localId: TABLE_LOCAL_ID, width: 760 })(
|
|
332
|
-
tr(
|
|
333
|
-
td({ colwidth: [460] })(p('')),
|
|
334
|
-
td({ colwidth: [289] })(p('')),
|
|
335
|
-
),
|
|
336
|
-
),
|
|
337
|
-
),
|
|
338
|
-
);
|
|
339
|
-
},
|
|
340
|
-
() => {
|
|
341
|
-
const { editorView } = editor(
|
|
342
|
-
doc(
|
|
343
|
-
table({ localId: TABLE_LOCAL_ID, width: 691 })(
|
|
344
|
-
tr(
|
|
345
|
-
td({ colwidth: [230] })(p('')),
|
|
346
|
-
td({ colwidth: [230] })(p('')),
|
|
347
|
-
td({ colwidth: [230] })(p('')),
|
|
348
|
-
),
|
|
349
|
-
),
|
|
191
|
+
it('should update each cells colWidth', () => {
|
|
192
|
+
const { editorView } = editor(
|
|
193
|
+
doc(
|
|
194
|
+
table({ localId: TABLE_LOCAL_ID, layout: 'default', width: 760 })(
|
|
195
|
+
tr(
|
|
196
|
+
td({ colwidth: [401] })(p('{<>}')),
|
|
197
|
+
td({ colwidth: [105] })(p('')),
|
|
198
|
+
td({ colwidth: [253] })(p('')),
|
|
350
199
|
),
|
|
351
|
-
)
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
);
|
|
200
|
+
),
|
|
201
|
+
),
|
|
202
|
+
);
|
|
203
|
+
const { dispatch, state } = editorView;
|
|
204
|
+
dispatch(deleteColumns(colsToRect([1], 1), true, editorView)(state.tr));
|
|
357
205
|
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
),
|
|
365
|
-
),
|
|
366
|
-
),
|
|
367
|
-
);
|
|
368
|
-
},
|
|
206
|
+
expect(editorView.state.doc).toEqualDocument(
|
|
207
|
+
doc(
|
|
208
|
+
table({ localId: TABLE_LOCAL_ID, width: 760 })(
|
|
209
|
+
tr(td({ colwidth: [460] })(p('')), td({ colwidth: [290] })(p(''))),
|
|
210
|
+
),
|
|
211
|
+
),
|
|
369
212
|
);
|
|
370
213
|
});
|
|
371
214
|
});
|
|
372
215
|
|
|
373
216
|
describe('when multiple columns are selected', () => {
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
)
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
tr(td({})(p('b3'))),
|
|
397
|
-
),
|
|
398
|
-
),
|
|
399
|
-
);
|
|
400
|
-
},
|
|
401
|
-
() => {
|
|
402
|
-
const { editorView } = editor(
|
|
403
|
-
doc(
|
|
404
|
-
p('text'),
|
|
405
|
-
table()(
|
|
406
|
-
tr(td({})(p('{<cell}a1')), td({})(p('a2')), td({})(p('a3'))),
|
|
407
|
-
tr(td({})(p('b1')), td({})(p('{cell>}b2')), td({})(p('b3'))),
|
|
408
|
-
),
|
|
409
|
-
),
|
|
410
|
-
);
|
|
411
|
-
const { state, dispatch } = editorView;
|
|
412
|
-
dispatch(
|
|
413
|
-
deleteColumns(getSelectionRect(state.selection)!, true)(state.tr),
|
|
414
|
-
);
|
|
415
|
-
expect(editorView.state.doc).toEqualDocument(
|
|
416
|
-
doc(
|
|
417
|
-
p('text'),
|
|
418
|
-
table({ localId: TABLE_LOCAL_ID })(
|
|
419
|
-
tr(td({})(p('a3'))),
|
|
420
|
-
tr(td({})(p('b3'))),
|
|
421
|
-
),
|
|
422
|
-
),
|
|
423
|
-
);
|
|
424
|
-
},
|
|
217
|
+
it('should delete these column', () => {
|
|
218
|
+
const { editorView } = editor(
|
|
219
|
+
doc(
|
|
220
|
+
p('text'),
|
|
221
|
+
table()(
|
|
222
|
+
tr(td({})(p('{<cell}a1')), td({})(p('a2')), td({})(p('a3'))),
|
|
223
|
+
tr(td({})(p('b1')), td({})(p('{cell>}b2')), td({})(p('b3'))),
|
|
224
|
+
),
|
|
225
|
+
),
|
|
226
|
+
);
|
|
227
|
+
const { state, dispatch } = editorView;
|
|
228
|
+
dispatch(
|
|
229
|
+
deleteColumns(getSelectionRect(state.selection)!, true)(state.tr),
|
|
230
|
+
);
|
|
231
|
+
expect(editorView.state.doc).toEqualDocument(
|
|
232
|
+
doc(
|
|
233
|
+
p('text'),
|
|
234
|
+
table({ localId: TABLE_LOCAL_ID })(
|
|
235
|
+
tr(td({})(p('a3'))),
|
|
236
|
+
tr(td({})(p('b3'))),
|
|
237
|
+
),
|
|
238
|
+
),
|
|
425
239
|
);
|
|
426
240
|
});
|
|
427
241
|
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
td({ colwidth: [401] })(p('{<cell}')),
|
|
437
|
-
td({ colwidth: [105] })(p('{cell>}')),
|
|
438
|
-
td({ colwidth: [253] })(p('')),
|
|
439
|
-
),
|
|
440
|
-
),
|
|
441
|
-
),
|
|
442
|
-
);
|
|
443
|
-
const { dispatch, state } = editorView;
|
|
444
|
-
dispatch(
|
|
445
|
-
deleteColumns(
|
|
446
|
-
getSelectionRect(state.selection)!,
|
|
447
|
-
true,
|
|
448
|
-
editorView,
|
|
449
|
-
)(state.tr),
|
|
450
|
-
);
|
|
451
|
-
|
|
452
|
-
expect(editorView.state.doc).toEqualDocument(
|
|
453
|
-
doc(
|
|
454
|
-
table({ localId: TABLE_LOCAL_ID, width: 760 })(
|
|
455
|
-
tr(td({ colwidth: [749] })(p(''))),
|
|
456
|
-
),
|
|
457
|
-
),
|
|
458
|
-
);
|
|
459
|
-
},
|
|
460
|
-
() => {
|
|
461
|
-
const { editorView } = editor(
|
|
462
|
-
doc(
|
|
463
|
-
table({ localId: TABLE_LOCAL_ID, width: 691 })(
|
|
464
|
-
tr(
|
|
465
|
-
td({ colwidth: [401] })(p('{<cell}')),
|
|
466
|
-
td({ colwidth: [105] })(p('{cell>}')),
|
|
467
|
-
td({ colwidth: [253] })(p('')),
|
|
468
|
-
),
|
|
469
|
-
),
|
|
242
|
+
it('should update each cells colWidth', () => {
|
|
243
|
+
const { editorView } = editor(
|
|
244
|
+
doc(
|
|
245
|
+
table({ localId: TABLE_LOCAL_ID, layout: 'default', width: 760 })(
|
|
246
|
+
tr(
|
|
247
|
+
td({ colwidth: [401] })(p('{<cell}')),
|
|
248
|
+
td({ colwidth: [105] })(p('{cell>}')),
|
|
249
|
+
td({ colwidth: [253] })(p('')),
|
|
470
250
|
),
|
|
471
|
-
)
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
251
|
+
),
|
|
252
|
+
),
|
|
253
|
+
);
|
|
254
|
+
const { dispatch, state } = editorView;
|
|
255
|
+
dispatch(
|
|
256
|
+
deleteColumns(
|
|
257
|
+
getSelectionRect(state.selection)!,
|
|
258
|
+
true,
|
|
259
|
+
editorView,
|
|
260
|
+
)(state.tr),
|
|
261
|
+
);
|
|
481
262
|
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
);
|
|
489
|
-
},
|
|
263
|
+
expect(editorView.state.doc).toEqualDocument(
|
|
264
|
+
doc(
|
|
265
|
+
table({ localId: TABLE_LOCAL_ID, width: 760 })(
|
|
266
|
+
tr(td({ colwidth: [750] })(p(''))),
|
|
267
|
+
),
|
|
268
|
+
),
|
|
490
269
|
);
|
|
491
270
|
});
|
|
492
271
|
});
|
package/src/commands/insert.ts
CHANGED
|
@@ -56,9 +56,7 @@ export function addColumnAt(getEditorContainerWidth: GetEditorContainerWidth) {
|
|
|
56
56
|
const table = findTable(updatedTr.selection);
|
|
57
57
|
if (table) {
|
|
58
58
|
// [ED-8288] Update colwidths manually to avoid multiple dispatch in TableComponent
|
|
59
|
-
updatedTr = rescaleColumns(
|
|
60
|
-
updatedTr,
|
|
61
|
-
);
|
|
59
|
+
updatedTr = rescaleColumns()(table, view)(updatedTr);
|
|
62
60
|
}
|
|
63
61
|
|
|
64
62
|
if (
|