@atlaskit/editor-plugin-table 5.3.25 → 5.3.26

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 (32) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/commands.js +19 -6
  3. package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/plugin.js +6 -1
  4. package/dist/cjs/plugins/table/ui/FloatingDragMenu/DragMenu.js +26 -1
  5. package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/commands.js +19 -6
  6. package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/plugin.js +6 -1
  7. package/dist/es2019/plugins/table/ui/FloatingDragMenu/DragMenu.js +27 -1
  8. package/dist/esm/plugins/table/pm-plugins/drag-and-drop/commands.js +19 -6
  9. package/dist/esm/plugins/table/pm-plugins/drag-and-drop/plugin.js +6 -1
  10. package/dist/esm/plugins/table/ui/FloatingDragMenu/DragMenu.js +26 -1
  11. package/package.json +2 -2
  12. package/src/plugins/table/pm-plugins/drag-and-drop/commands.ts +31 -7
  13. package/src/plugins/table/pm-plugins/drag-and-drop/plugin.ts +7 -1
  14. package/src/plugins/table/ui/FloatingDragMenu/DragMenu.tsx +33 -1
  15. package/src/__tests__/integration/__snapshots__/auto-size.ts.snap +0 -612
  16. package/src/__tests__/integration/__snapshots__/delete-columns.ts.snap +0 -820
  17. package/src/__tests__/integration/__snapshots__/delete-last-column-in-full-width.ts.snap +0 -120
  18. package/src/__tests__/integration/__snapshots__/delete-last-column-with-empty-action.ts.snap +0 -120
  19. package/src/__tests__/integration/__snapshots__/delete-last-row-with-empty-action.ts.snap +0 -229
  20. package/src/__tests__/integration/__snapshots__/insert-row-inside-layout.ts.snap +0 -239
  21. package/src/__tests__/integration/__snapshots__/resize.ts.snap +0 -2685
  22. package/src/__tests__/integration/__snapshots__/scale.ts.snap +0 -1085
  23. package/src/__tests__/integration/arrow-down-into-table.ts +0 -50
  24. package/src/__tests__/integration/auto-size.ts +0 -92
  25. package/src/__tests__/integration/cell-selection.ts +0 -105
  26. package/src/__tests__/integration/delete-columns.ts +0 -99
  27. package/src/__tests__/integration/delete-last-column-in-full-width.ts +0 -73
  28. package/src/__tests__/integration/delete-last-column-with-empty-action.ts +0 -60
  29. package/src/__tests__/integration/delete-last-row-with-empty-action.ts +0 -99
  30. package/src/__tests__/integration/insert-row-inside-layout.ts +0 -52
  31. package/src/__tests__/integration/resize.ts +0 -333
  32. package/src/__tests__/integration/scale.ts +0 -70
@@ -1,333 +0,0 @@
1
- import { tableNewColumnMinWidth } from '@atlaskit/editor-common/styles';
2
- import type { PluginKey } from '@atlaskit/editor-prosemirror/state';
3
- // eslint-disable-next-line import/no-extraneous-dependencies -- Removed import for fixing circular dependencies
4
- import {
5
- editable,
6
- fullpage,
7
- getDocFromElement,
8
- resizeColumn,
9
- selectColumns,
10
- updateEditorProps,
11
- } from '@atlaskit/editor-test-helpers/integration/helpers';
12
- // eslint-disable-next-line import/no-extraneous-dependencies -- Removed import for fixing circular dependencies
13
- import {
14
- clickFirstCell,
15
- insertColumn,
16
- selectTable,
17
- } from '@atlaskit/editor-test-helpers/page-objects/table';
18
- // eslint-disable-next-line import/no-extraneous-dependencies -- Removed import for fixing circular dependencies
19
- import {
20
- goToEditorTestingWDExample,
21
- mountEditor,
22
- } from '@atlaskit/editor-test-helpers/testing-example-page';
23
- import { BrowserTestCase } from '@atlaskit/webdriver-runner/runner';
24
-
25
- import { pluginKey as tableResizingPluginKey } from '../../plugins/table/pm-plugins/table-resizing';
26
-
27
- import {
28
- resizedTableWithStackedColumns,
29
- tableForBulkResize,
30
- tableForBulkResize3Cols,
31
- tableForBulkResizeWithNumberCol,
32
- tableInsideColumns,
33
- tableWithRowSpan,
34
- tableWithRowSpanAndColSpan,
35
- twoColFullWidthTableWithContent,
36
- } from './__fixtures__/resize-documents';
37
- import { tableWithMinWidthColumnsDocument } from './__fixtures__/table-with-min-width-columns-document';
38
-
39
- BrowserTestCase(
40
- 'Can resize normally with a rowspan in the non last column.',
41
- {},
42
- async (client: any, testName: string) => {
43
- const page = await goToEditorTestingWDExample(
44
- client,
45
- 'editor-plugin-table',
46
- );
47
-
48
- await mountEditor(page, {
49
- appearance: fullpage.appearance,
50
- defaultValue: JSON.stringify(tableWithRowSpan),
51
- allowTables: {
52
- advanced: true,
53
- },
54
- });
55
-
56
- await resizeColumn(page, { cellHandlePos: 2, resizeWidth: 50 });
57
-
58
- const doc = await page.$eval(editable, getDocFromElement);
59
- expect(doc).toMatchCustomDocSnapshot(testName);
60
- },
61
- );
62
-
63
- BrowserTestCase(
64
- 'Can resize normally with a rowspan and colspan',
65
- {},
66
- async (client: any, testName: string) => {
67
- const page = await goToEditorTestingWDExample(
68
- client,
69
- 'editor-plugin-table',
70
- );
71
-
72
- await mountEditor(page, {
73
- appearance: fullpage.appearance,
74
- defaultValue: JSON.stringify(tableWithRowSpanAndColSpan),
75
- allowTables: {
76
- advanced: true,
77
- },
78
- });
79
-
80
- await resizeColumn(page, { cellHandlePos: 22, resizeWidth: -50 });
81
-
82
- const doc = await page.$eval(editable, getDocFromElement);
83
- expect(doc).toMatchCustomDocSnapshot(testName);
84
- },
85
- );
86
-
87
- BrowserTestCase(
88
- 'Can resize normally on a full width table with content',
89
- { skip: ['firefox', 'safari'] },
90
- async (client: any, testName: string) => {
91
- const page = await goToEditorTestingWDExample(
92
- client,
93
- 'editor-plugin-table',
94
- );
95
-
96
- await mountEditor(page, {
97
- appearance: fullpage.appearance,
98
- defaultValue: JSON.stringify(twoColFullWidthTableWithContent),
99
- allowTables: {
100
- advanced: true,
101
- },
102
- });
103
-
104
- await resizeColumn(page, { cellHandlePos: 2, resizeWidth: -100 });
105
-
106
- const doc = await page.$eval(editable, getDocFromElement);
107
- expect(doc).toMatchCustomDocSnapshot(testName);
108
- },
109
- );
110
-
111
- BrowserTestCase(
112
- `Created column should be set to ${tableNewColumnMinWidth}px`,
113
- { skip: ['safari'] },
114
- async (client: any, testName: string) => {
115
- const page = await goToEditorTestingWDExample(
116
- client,
117
- 'editor-plugin-table',
118
- );
119
-
120
- await mountEditor(page, {
121
- appearance: fullpage.appearance,
122
- defaultValue: JSON.stringify(tableWithMinWidthColumnsDocument),
123
- allowTables: {
124
- advanced: true,
125
- },
126
- });
127
-
128
- await insertColumn(page, 0, 'right');
129
-
130
- const doc = await page.$eval(editable, getDocFromElement);
131
- expect(doc).toMatchCustomDocSnapshot(testName);
132
- },
133
- );
134
-
135
- BrowserTestCase(
136
- 'Can resize the last column when table is nested in Columns',
137
- { skip: ['firefox', 'safari'] },
138
- async (client: any, testName: string) => {
139
- const page = await goToEditorTestingWDExample(
140
- client,
141
- 'editor-plugin-table',
142
- );
143
-
144
- await mountEditor(page, {
145
- appearance: fullpage.appearance,
146
- defaultValue: JSON.stringify(tableInsideColumns),
147
- allowTables: {
148
- advanced: true,
149
- },
150
- allowLayouts: true,
151
- });
152
-
153
- await resizeColumn(page, { cellHandlePos: 10, resizeWidth: -100 });
154
-
155
- const doc = await page.$eval(editable, getDocFromElement);
156
- expect(doc).toMatchCustomDocSnapshot(testName);
157
- },
158
- );
159
-
160
- BrowserTestCase(
161
- 'Should stack columns to the left when widths of some of the columns equal minWidth',
162
- {},
163
- async (client: any, testName: string) => {
164
- const page = await goToEditorTestingWDExample(
165
- client,
166
- 'editor-plugin-table',
167
- );
168
-
169
- await mountEditor(page, {
170
- appearance: fullpage.appearance,
171
- defaultValue: JSON.stringify(resizedTableWithStackedColumns),
172
- allowTables: {
173
- advanced: true,
174
- },
175
- });
176
-
177
- await resizeColumn(page, { cellHandlePos: 14, resizeWidth: -200 });
178
-
179
- const doc = await page.$eval(editable, getDocFromElement);
180
- expect(doc).toMatchCustomDocSnapshot(testName);
181
- },
182
- );
183
-
184
- BrowserTestCase(
185
- 'Should stack columns to the right and go to overflow',
186
- {},
187
- async (client: any, testName: string) => {
188
- const page = await goToEditorTestingWDExample(
189
- client,
190
- 'editor-plugin-table',
191
- );
192
-
193
- await mountEditor(page, {
194
- appearance: fullpage.appearance,
195
- defaultValue: JSON.stringify(resizedTableWithStackedColumns),
196
- allowTables: {
197
- advanced: true,
198
- },
199
- });
200
-
201
- await resizeColumn(page, { cellHandlePos: 2, resizeWidth: 420 });
202
-
203
- const doc = await page.$eval(editable, getDocFromElement);
204
- expect(doc).toMatchCustomDocSnapshot(testName);
205
- },
206
- );
207
-
208
- BrowserTestCase(
209
- 'Should bulk resize 3 columns in 4 columns table',
210
- { skip: ['firefox', 'safari'] },
211
- async (client: any, testName: string) => {
212
- const page = await goToEditorTestingWDExample(
213
- client,
214
- 'editor-plugin-table',
215
- );
216
-
217
- await mountEditor(page, {
218
- appearance: fullpage.appearance,
219
- defaultValue: JSON.stringify(tableForBulkResize3Cols),
220
- allowTables: {
221
- advanced: true,
222
- },
223
- });
224
-
225
- await clickFirstCell(page);
226
- await selectTable(page);
227
- await resizeColumn(page, { cellHandlePos: 6, resizeWidth: -20 });
228
-
229
- const doc = await page.$eval(editable, getDocFromElement);
230
- expect(doc).toMatchCustomDocSnapshot(testName);
231
- },
232
- );
233
-
234
- BrowserTestCase(
235
- 'Should recover from overflow when number col is selected',
236
- { skip: ['firefox', 'safari'] },
237
- async (client: any, testName: string) => {
238
- const page = await goToEditorTestingWDExample(
239
- client,
240
- 'editor-plugin-table',
241
- );
242
-
243
- await mountEditor(page, {
244
- appearance: fullpage.appearance,
245
- defaultValue: JSON.stringify(tableForBulkResizeWithNumberCol),
246
- allowTables: {
247
- advanced: true,
248
- },
249
- });
250
-
251
- await clickFirstCell(page);
252
- await selectTable(page);
253
- await resizeColumn(page, { cellHandlePos: 2, resizeWidth: -20 });
254
-
255
- const doc = await page.$eval(editable, getDocFromElement);
256
- expect(doc).toMatchCustomDocSnapshot(testName);
257
- },
258
- );
259
-
260
- BrowserTestCase(
261
- 'Should bulk resize selected columns',
262
- { skip: ['firefox', 'safari'] },
263
- async (client: any, testName: string) => {
264
- const page = await goToEditorTestingWDExample(
265
- client,
266
- 'editor-plugin-table',
267
- );
268
-
269
- await mountEditor(page, {
270
- appearance: fullpage.appearance,
271
- defaultValue: JSON.stringify(tableForBulkResize),
272
- allowTables: {
273
- advanced: true,
274
- },
275
- });
276
-
277
- await clickFirstCell(page);
278
- await selectColumns(page, [0, 1]);
279
- await resizeColumn(page, { cellHandlePos: 2, resizeWidth: 52 });
280
-
281
- const doc = await page.$eval(editable, getDocFromElement);
282
- expect(doc).toMatchCustomDocSnapshot(testName);
283
- },
284
- );
285
-
286
- BrowserTestCase(
287
- 'Can resize normally while editor changes its appearance',
288
- { skip: ['firefox', 'safari'] },
289
- async (client: any, testName: string) => {
290
- const page = await goToEditorTestingWDExample(
291
- client,
292
- 'editor-plugin-table',
293
- );
294
-
295
- await mountEditor(page, {
296
- appearance: fullpage.appearance,
297
- defaultValue: JSON.stringify(tableForBulkResize),
298
- allowTables: {
299
- advanced: true,
300
- },
301
- });
302
-
303
- const resizeHandlePos = 2;
304
-
305
- // We grab the resize handle and then change editor appearance to full-widths
306
- // in which case we expect the editor not to throw
307
- await (page as any).browser.execute(
308
- (handlePos: number, pluginKey: PluginKey) => {
309
- const view = (window as any).__editorView;
310
- if (!view) {
311
- return;
312
- }
313
- view.dispatch(
314
- view.state.tr.setMeta(pluginKey, {
315
- type: 'SET_RESIZE_HANDLE_POSITION',
316
- data: {
317
- resizeHandlePos: handlePos,
318
- },
319
- }),
320
- );
321
- view.dom.dispatchEvent(
322
- new MouseEvent('mousedown', { clientX: handlePos }),
323
- );
324
- },
325
- resizeHandlePos,
326
- tableResizingPluginKey,
327
- );
328
-
329
- // doesn't reject the promise (throw)
330
- expect(updateEditorProps(page, { appearance: 'full-width' })).resolves
331
- .toBeUndefined;
332
- },
333
- );
@@ -1,70 +0,0 @@
1
- // eslint-disable-next-line import/no-extraneous-dependencies -- Removed import for fixing circular dependencies
2
- import {
3
- editable,
4
- fullpage,
5
- getDocFromElement,
6
- } from '@atlaskit/editor-test-helpers/integration/helpers';
7
- // eslint-disable-next-line import/no-extraneous-dependencies -- Removed import for fixing circular dependencies
8
- import {
9
- deleteColumn,
10
- insertColumn,
11
- } from '@atlaskit/editor-test-helpers/page-objects/table';
12
- // eslint-disable-next-line import/no-extraneous-dependencies -- Removed import for fixing circular dependencies
13
- import {
14
- goToEditorTestingWDExample,
15
- mountEditor,
16
- } from '@atlaskit/editor-test-helpers/testing-example-page';
17
- import { BrowserTestCase } from '@atlaskit/webdriver-runner/runner';
18
-
19
- import {
20
- tableInOverflow,
21
- tableWithManyMinWidthCols,
22
- } from './__fixtures__/scale';
23
-
24
- BrowserTestCase(
25
- 'Should scale remaining columns when adding a new column preventing from going to overflow',
26
- { skip: ['safari'] },
27
- async (client: any, testName: string) => {
28
- const page = await goToEditorTestingWDExample(
29
- client,
30
- 'editor-plugin-table',
31
- );
32
-
33
- await mountEditor(page, {
34
- appearance: fullpage.appearance,
35
- defaultValue: JSON.stringify(tableWithManyMinWidthCols),
36
- allowTables: {
37
- advanced: true,
38
- },
39
- });
40
-
41
- await insertColumn(page, 5, 'left');
42
-
43
- const doc = await page.$eval(editable, getDocFromElement);
44
- expect(doc).toMatchCustomDocSnapshot(testName);
45
- },
46
- );
47
-
48
- BrowserTestCase(
49
- 'Should scale remaining columns when deleting a column recovering table from overflow',
50
- { skip: [] },
51
- async (client: any, testName: string) => {
52
- const page = await goToEditorTestingWDExample(
53
- client,
54
- 'editor-plugin-table',
55
- );
56
-
57
- await mountEditor(page, {
58
- appearance: fullpage.appearance,
59
- defaultValue: JSON.stringify(tableInOverflow),
60
- allowTables: {
61
- advanced: true,
62
- },
63
- });
64
-
65
- await deleteColumn(page, 1);
66
-
67
- const doc = await page.$eval(editable, getDocFromElement);
68
- expect(doc).toMatchCustomDocSnapshot(testName);
69
- },
70
- );