@atlaskit/editor-plugin-table 5.7.2 → 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.
Files changed (86) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/cjs/commands/insert.js +1 -1
  3. package/dist/cjs/nodeviews/TableComponent.js +4 -1
  4. package/dist/cjs/plugin.js +2 -1
  5. package/dist/cjs/pm-plugins/main.js +5 -16
  6. package/dist/cjs/pm-plugins/table-resizing/event-handlers.js +0 -4
  7. package/dist/cjs/transforms/column-width.js +3 -105
  8. package/dist/cjs/transforms/delete-columns.js +2 -5
  9. package/dist/cjs/types.js +0 -2
  10. package/dist/cjs/ui/FloatingDragMenu/index.js +5 -2
  11. package/dist/cjs/ui/FloatingInsertButton/InsertButton.js +3 -3
  12. package/dist/cjs/ui/FloatingInsertButton/index.js +1 -1
  13. package/dist/cjs/ui/TableFloatingColumnControls/ColumnControls/index.js +39 -8
  14. package/dist/cjs/ui/TableFloatingColumnControls/index.js +17 -8
  15. package/dist/cjs/ui/common-styles.js +1 -1
  16. package/dist/cjs/utils/decoration.js +48 -34
  17. package/dist/cjs/utils/dom.js +1 -19
  18. package/dist/cjs/utils/index.js +0 -6
  19. package/dist/es2019/commands/insert.js +1 -1
  20. package/dist/es2019/nodeviews/TableComponent.js +5 -2
  21. package/dist/es2019/plugin.js +2 -1
  22. package/dist/es2019/pm-plugins/main.js +1 -12
  23. package/dist/es2019/pm-plugins/table-resizing/event-handlers.js +1 -5
  24. package/dist/es2019/transforms/column-width.js +4 -102
  25. package/dist/es2019/transforms/delete-columns.js +2 -5
  26. package/dist/es2019/types.js +0 -2
  27. package/dist/es2019/ui/FloatingDragMenu/index.js +6 -3
  28. package/dist/es2019/ui/FloatingInsertButton/InsertButton.js +3 -3
  29. package/dist/es2019/ui/FloatingInsertButton/index.js +2 -2
  30. package/dist/es2019/ui/TableFloatingColumnControls/ColumnControls/index.js +34 -4
  31. package/dist/es2019/ui/TableFloatingColumnControls/index.js +18 -9
  32. package/dist/es2019/ui/common-styles.js +6 -1
  33. package/dist/es2019/utils/decoration.js +47 -33
  34. package/dist/es2019/utils/dom.js +0 -18
  35. package/dist/es2019/utils/index.js +1 -1
  36. package/dist/esm/commands/insert.js +1 -1
  37. package/dist/esm/nodeviews/TableComponent.js +5 -2
  38. package/dist/esm/plugin.js +2 -1
  39. package/dist/esm/pm-plugins/main.js +1 -12
  40. package/dist/esm/pm-plugins/table-resizing/event-handlers.js +1 -5
  41. package/dist/esm/transforms/column-width.js +4 -106
  42. package/dist/esm/transforms/delete-columns.js +2 -5
  43. package/dist/esm/types.js +0 -2
  44. package/dist/esm/ui/FloatingDragMenu/index.js +6 -3
  45. package/dist/esm/ui/FloatingInsertButton/InsertButton.js +3 -3
  46. package/dist/esm/ui/FloatingInsertButton/index.js +2 -2
  47. package/dist/esm/ui/TableFloatingColumnControls/ColumnControls/index.js +35 -4
  48. package/dist/esm/ui/TableFloatingColumnControls/index.js +18 -9
  49. package/dist/esm/ui/common-styles.js +2 -2
  50. package/dist/esm/utils/decoration.js +48 -34
  51. package/dist/esm/utils/dom.js +0 -18
  52. package/dist/esm/utils/index.js +1 -1
  53. package/dist/types/transforms/column-width.d.ts +1 -14
  54. package/dist/types/types.d.ts +0 -1
  55. package/dist/types/ui/FloatingDragMenu/index.d.ts +3 -1
  56. package/dist/types/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +3 -1
  57. package/dist/types/ui/TableFloatingColumnControls/index.d.ts +2 -0
  58. package/dist/types/utils/dom.d.ts +0 -1
  59. package/dist/types/utils/index.d.ts +1 -1
  60. package/dist/types-ts4.5/transforms/column-width.d.ts +1 -14
  61. package/dist/types-ts4.5/types.d.ts +0 -1
  62. package/dist/types-ts4.5/ui/FloatingDragMenu/index.d.ts +3 -1
  63. package/dist/types-ts4.5/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +3 -1
  64. package/dist/types-ts4.5/ui/TableFloatingColumnControls/index.d.ts +2 -0
  65. package/dist/types-ts4.5/utils/dom.d.ts +0 -1
  66. package/dist/types-ts4.5/utils/index.d.ts +1 -1
  67. package/package.json +6 -9
  68. package/src/__tests__/unit/commands/insert.ts +7 -0
  69. package/src/__tests__/unit/transforms/delete-columns.ts +147 -368
  70. package/src/commands/insert.ts +1 -3
  71. package/src/nodeviews/TableComponent.tsx +7 -2
  72. package/src/plugin.tsx +1 -0
  73. package/src/pm-plugins/main.ts +0 -18
  74. package/src/pm-plugins/table-resizing/event-handlers.ts +1 -8
  75. package/src/transforms/column-width.ts +4 -137
  76. package/src/transforms/delete-columns.ts +3 -9
  77. package/src/types.ts +0 -2
  78. package/src/ui/FloatingDragMenu/index.tsx +14 -2
  79. package/src/ui/FloatingInsertButton/InsertButton.tsx +6 -2
  80. package/src/ui/FloatingInsertButton/index.tsx +4 -2
  81. package/src/ui/TableFloatingColumnControls/ColumnControls/index.tsx +48 -3
  82. package/src/ui/TableFloatingColumnControls/index.tsx +23 -11
  83. package/src/ui/common-styles.ts +6 -0
  84. package/src/utils/decoration.ts +41 -28
  85. package/src/utils/dom.ts +0 -23
  86. package/src/utils/index.ts +0 -1
@@ -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
- describe('should delete the column and move cursor to the first column', () => {
91
- ffTest(
92
- 'platform.editor.table-update-colwidths-after-column-is-deleted',
93
- () => {
94
- const {
95
- editorView,
96
- refs: { nextCursorPos },
97
- } = editor(
98
- doc(
99
- p('text'),
100
- table()(
101
- tr(
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
- expect(editorView.state.selection.from).toEqual(nextCursorPos);
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
- describe('should delete the column and move cursor to the previous column', () => {
155
- ffTest(
156
- 'platform.editor.table-update-colwidths-after-column-is-deleted',
157
- () => {
158
- const {
159
- editorView,
160
- refs: { nextCursorPos },
161
- } = editor(
162
- doc(
163
- p('text'),
164
- table()(
165
- tr(
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
- expect(editorView.state.selection.from).toEqual(nextCursorPos);
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
- describe('should delete these columns', () => {
215
- ffTest(
216
- 'platform.editor.table-update-colwidths-after-column-is-deleted',
217
- () => {
218
- const { editorView } = editor(
219
- doc(
220
- p('text'),
221
- table()(tr(tdCursor, td({})(p('c1')), td({})(p('c2')))),
222
- ),
223
- );
224
- const { state, dispatch } = editorView;
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
- describe('should delete the column', () => {
256
- ffTest(
257
- 'platform.editor.table-update-colwidths-after-column-is-deleted',
258
- () => {
259
- const { editorView } = editor(
260
- doc(
261
- p('text'),
262
- table()(
263
- tr(td({})(p('a1')), td({})(p('{<cell}a2')), td({})(p('a3'))),
264
- tr(td({})(p('b1')), td({})(p('{cell>}b2')), td({})(p('b3'))),
265
- ),
266
- ),
267
- );
268
- const { state, dispatch } = editorView;
269
- dispatch(
270
- deleteColumns(getSelectionRect(state.selection)!, true)(state.tr),
271
- );
272
- expect(editorView.state.doc).toEqualDocument(
273
- doc(
274
- p('text'),
275
- table({ localId: TABLE_LOCAL_ID })(
276
- tr(td({})(p('a1')), td({})(p('a3'))),
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
- describe('should update each cells colWidth', () => {
310
- ffTest(
311
- 'platform.editor.table-update-colwidths-after-column-is-deleted',
312
- () => {
313
- const { editorView } = editor(
314
- doc(
315
- table({ localId: TABLE_LOCAL_ID, layout: 'default', width: 760 })(
316
- tr(
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
- const { dispatch, state } = editorView;
353
-
354
- dispatch(
355
- deleteColumns(colsToRect([1], 1), true, editorView)(state.tr),
356
- );
200
+ ),
201
+ ),
202
+ );
203
+ const { dispatch, state } = editorView;
204
+ dispatch(deleteColumns(colsToRect([1], 1), true, editorView)(state.tr));
357
205
 
358
- expect(editorView.state.doc).toEqualDocument(
359
- doc(
360
- table({ localId: TABLE_LOCAL_ID, width: 691 })(
361
- tr(
362
- td({ colwidth: [230] })(p('')),
363
- td({ colwidth: [230] })(p('')),
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
- describe('should delete these column', () => {
375
- ffTest(
376
- 'platform.editor.table-update-colwidths-after-column-is-deleted',
377
- () => {
378
- const { editorView } = editor(
379
- doc(
380
- p('text'),
381
- table()(
382
- tr(td({})(p('{<cell}a1')), td({})(p('a2')), td({})(p('a3'))),
383
- tr(td({})(p('b1')), td({})(p('{cell>}b2')), td({})(p('b3'))),
384
- ),
385
- ),
386
- );
387
- const { state, dispatch } = editorView;
388
- dispatch(
389
- deleteColumns(getSelectionRect(state.selection)!, true)(state.tr),
390
- );
391
- expect(editorView.state.doc).toEqualDocument(
392
- doc(
393
- p('text'),
394
- table({ localId: TABLE_LOCAL_ID })(
395
- tr(td({})(p('a3'))),
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
- describe('should update each cells colWidth', () => {
429
- ffTest(
430
- 'platform.editor.table-update-colwidths-after-column-is-deleted',
431
- () => {
432
- const { editorView } = editor(
433
- doc(
434
- table({ localId: TABLE_LOCAL_ID, layout: 'default', width: 760 })(
435
- tr(
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
- const { dispatch, state } = editorView;
473
-
474
- dispatch(
475
- deleteColumns(
476
- getSelectionRect(state.selection)!,
477
- true,
478
- editorView,
479
- )(state.tr),
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
- expect(editorView.state.doc).toEqualDocument(
483
- doc(
484
- table({ localId: TABLE_LOCAL_ID, width: 691 })(
485
- tr(td({ colwidth: [253] })(p(''))),
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
  });
@@ -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(getEditorContainerWidth)(table, view)(
60
- updatedTr,
61
- );
59
+ updatedTr = rescaleColumns()(table, view)(updatedTr);
62
60
  }
63
61
 
64
62
  if (
@@ -13,7 +13,10 @@ import {
13
13
  } from '@atlaskit/editor-common/analytics';
14
14
  import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
15
15
  import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
16
- import { getParentNodeWidth } from '@atlaskit/editor-common/node-width';
16
+ import {
17
+ getParentNodeWidth,
18
+ getTableContainerWidth,
19
+ } from '@atlaskit/editor-common/node-width';
17
20
  import { tableMarginSides } from '@atlaskit/editor-common/styles';
18
21
  import type {
19
22
  EditorContainerWidth,
@@ -510,7 +513,7 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
510
513
  stickyHeader={this.state.stickyHeader}
511
514
  />
512
515
  );
513
-
516
+ const tableContainerWidth = getTableContainerWidth(node);
514
517
  const colControls = isDragAndDropEnabled ? (
515
518
  <TableFloatingColumnControls
516
519
  editorView={view}
@@ -530,6 +533,8 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
530
533
  stickyHeader={this.state.stickyHeader}
531
534
  canDrag={canDrag}
532
535
  getEditorFeatureFlags={getEditorFeatureFlags}
536
+ tableContainerWidth={tableContainerWidth}
537
+ isNumberColumnEnabled={node.attrs.isNumberColumnEnabled}
533
538
  />
534
539
  ) : null;
535
540
 
package/src/plugin.tsx CHANGED
@@ -515,6 +515,7 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
515
515
  canDrag={dragAndDropState?.canDrag}
516
516
  getEditorContainerWidth={defaultGetEditorContainerWidth}
517
517
  editorAnalyticsAPI={editorAnalyticsAPI}
518
+ stickyHeaders={stickyHeader}
518
519
  />
519
520
  )}
520
521
  {allowControls && !isDragAndDropEnabled && !isResizing && (
@@ -37,8 +37,6 @@ import {
37
37
  findParentNodeOfType,
38
38
  } from '@atlaskit/editor-prosemirror/utils';
39
39
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
40
- import { findTable } from '@atlaskit/editor-tables/utils';
41
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
42
40
 
43
41
  import {
44
42
  addBoldInEmptyHeaderCells,
@@ -83,7 +81,6 @@ import {
83
81
  transformSliceToCorrectEmptyTableCells,
84
82
  transformSliceToFixHardBreakProblemOnCopyFromCell,
85
83
  transformSliceToRemoveOpenTable,
86
- updateResizeHandles,
87
84
  } from '../utils';
88
85
  import { isHeaderRowRequired } from '../utils/paste';
89
86
 
@@ -209,7 +206,6 @@ export const createPlugin = (
209
206
  const { selection } = state;
210
207
  const pluginState = getPluginState(state);
211
208
  let tableRef: HTMLTableElement | undefined;
212
- let tableNode;
213
209
  if (pluginState.editorHasFocus) {
214
210
  const parent = findParentDomRefOfType(
215
211
  state.schema.nodes.table,
@@ -221,26 +217,12 @@ export const createPlugin = (
221
217
  'table',
222
218
  ) || undefined;
223
219
  }
224
-
225
- tableNode = findTable(state.selection);
226
220
  }
227
221
 
228
222
  if (pluginState.tableRef !== tableRef) {
229
223
  setTableRef(tableRef)(state, dispatch);
230
224
  }
231
225
 
232
- // Removes updateResizeHandles
233
- if (
234
- getBooleanFF(
235
- 'platform.editor.table-remove-update-resize-handles_djvab',
236
- )
237
- ) {
238
- } else {
239
- if (pluginState.tableNode !== tableNode) {
240
- updateResizeHandles(tableRef);
241
- }
242
- }
243
-
244
226
  if (pluginState.editorHasFocus && pluginState.tableRef) {
245
227
  const { $cursor } = state.selection as TextSelection;
246
228
  if ($cursor) {