@atlaskit/editor-plugin-table 7.2.2 → 7.2.3

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 (102) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/cjs/pm-plugins/drag-and-drop/commands-with-analytics.js +3 -19
  3. package/dist/cjs/utils/drag-menu.js +37 -23
  4. package/dist/cjs/utils/merged-cells.js +66 -1
  5. package/dist/es2019/pm-plugins/drag-and-drop/commands-with-analytics.js +4 -20
  6. package/dist/es2019/utils/drag-menu.js +38 -14
  7. package/dist/es2019/utils/merged-cells.js +73 -0
  8. package/dist/esm/pm-plugins/drag-and-drop/commands-with-analytics.js +4 -20
  9. package/dist/esm/utils/drag-menu.js +36 -22
  10. package/dist/esm/utils/merged-cells.js +65 -0
  11. package/dist/types/utils/drag-menu.d.ts +4 -1
  12. package/dist/types/utils/merged-cells.d.ts +2 -0
  13. package/dist/types-ts4.5/utils/drag-menu.d.ts +4 -1
  14. package/dist/types-ts4.5/utils/merged-cells.d.ts +2 -0
  15. package/package.json +9 -16
  16. package/src/pm-plugins/drag-and-drop/commands-with-analytics.ts +11 -32
  17. package/src/utils/drag-menu.ts +94 -20
  18. package/src/utils/merged-cells.ts +78 -0
  19. package/tsconfig.dev.json +0 -69
  20. package/tsconfig.json +2 -877
  21. package/examples/99-testing.tsx +0 -140
  22. package/examples/config.jsonc +0 -14
  23. package/src/__tests__/unit/analytics.ts +0 -888
  24. package/src/__tests__/unit/collab.ts +0 -93
  25. package/src/__tests__/unit/commands/go-to-next-cell.ts +0 -173
  26. package/src/__tests__/unit/commands/insert.ts +0 -137
  27. package/src/__tests__/unit/commands/misc.ts +0 -185
  28. package/src/__tests__/unit/commands/sort.ts +0 -128
  29. package/src/__tests__/unit/commands.ts +0 -745
  30. package/src/__tests__/unit/copy-button.ts +0 -22
  31. package/src/__tests__/unit/copy-paste.ts +0 -677
  32. package/src/__tests__/unit/event-handlers/index.ts +0 -125
  33. package/src/__tests__/unit/event-handlers.ts +0 -296
  34. package/src/__tests__/unit/fix-tables.ts +0 -164
  35. package/src/__tests__/unit/get-toolbar-config.ts +0 -127
  36. package/src/__tests__/unit/handlers.ts +0 -98
  37. package/src/__tests__/unit/hover-selection.ts +0 -230
  38. package/src/__tests__/unit/index-with-fake-timers.ts +0 -111
  39. package/src/__tests__/unit/index.ts +0 -912
  40. package/src/__tests__/unit/layout.ts +0 -146
  41. package/src/__tests__/unit/nodeviews/OverflowShadowsObserver.ts +0 -162
  42. package/src/__tests__/unit/nodeviews/TableComponent.tsx +0 -280
  43. package/src/__tests__/unit/nodeviews/TableContainer.tsx +0 -525
  44. package/src/__tests__/unit/nodeviews/cell.ts +0 -132
  45. package/src/__tests__/unit/nodeviews/table.ts +0 -129
  46. package/src/__tests__/unit/pm-plugins/analytics.ts +0 -327
  47. package/src/__tests__/unit/pm-plugins/decorations/column-controls.ts +0 -94
  48. package/src/__tests__/unit/pm-plugins/decorations/column-resizing.ts +0 -176
  49. package/src/__tests__/unit/pm-plugins/decorations/plugin.ts +0 -211
  50. package/src/__tests__/unit/pm-plugins/main.ts +0 -214
  51. package/src/__tests__/unit/pm-plugins/safari-delete-composition-text-issue-workaround.ts +0 -101
  52. package/src/__tests__/unit/pm-plugins/sticky-headers/tableRow.tsx +0 -562
  53. package/src/__tests__/unit/pm-plugins/table-local-id.ts +0 -507
  54. package/src/__tests__/unit/pm-plugins/table-resizing/colgroup.ts +0 -269
  55. package/src/__tests__/unit/pm-plugins/table-resizing/event-handlers.ts +0 -192
  56. package/src/__tests__/unit/pm-plugins/table-resizing/utils/resize-state.ts +0 -33
  57. package/src/__tests__/unit/pm-plugins/table-width.ts +0 -292
  58. package/src/__tests__/unit/sort-column.ts +0 -399
  59. package/src/__tests__/unit/toolbar.ts +0 -512
  60. package/src/__tests__/unit/transforms/delete-columns.ts +0 -597
  61. package/src/__tests__/unit/transforms/delete-rows.ts +0 -620
  62. package/src/__tests__/unit/transforms/merging.ts +0 -392
  63. package/src/__tests__/unit/ui/ContextualMenu.tsx +0 -71
  64. package/src/__tests__/unit/ui/CornerControls.tsx +0 -99
  65. package/src/__tests__/unit/ui/DeleteButton.tsx +0 -38
  66. package/src/__tests__/unit/ui/FixedButton.tsx +0 -217
  67. package/src/__tests__/unit/ui/FloatingContextualButton.tsx +0 -123
  68. package/src/__tests__/unit/ui/FloatingContextualMenu.tsx +0 -68
  69. package/src/__tests__/unit/ui/FloatingDeleteButton.tsx +0 -178
  70. package/src/__tests__/unit/ui/FloatingDragMenu.tsx +0 -511
  71. package/src/__tests__/unit/ui/FloatingInsertButton.tsx +0 -322
  72. package/src/__tests__/unit/ui/NumberColumn.tsx +0 -146
  73. package/src/__tests__/unit/ui/RowControls.tsx +0 -294
  74. package/src/__tests__/unit/ui/RowDragControls.tsx +0 -129
  75. package/src/__tests__/unit/ui/TableFloatingColumnControls.tsx +0 -189
  76. package/src/__tests__/unit/ui/TableFloatingControls.tsx +0 -118
  77. package/src/__tests__/unit/undo-redo.ts +0 -220
  78. package/src/__tests__/unit/utils/analytics.ts +0 -98
  79. package/src/__tests__/unit/utils/collapse.ts +0 -57
  80. package/src/__tests__/unit/utils/column-controls.ts +0 -205
  81. package/src/__tests__/unit/utils/dom.ts +0 -180
  82. package/src/__tests__/unit/utils/merged-cells.ts +0 -156
  83. package/src/__tests__/unit/utils/nodes.ts +0 -79
  84. package/src/__tests__/unit/utils/row-controls.ts +0 -195
  85. package/src/__tests__/unit/utils/table.ts +0 -96
  86. package/src/__tests__/unit/utils.ts +0 -670
  87. package/src/__tests__/visual-regression/__fixtures__/sticky-header-with-horizontal-scroll.json +0 -5228
  88. package/src/__tests__/visual-regression/__fixtures__/table-with-100-numbered-list-items.json +0 -20272
  89. package/src/__tests__/visual-regression/__image_snapshots__/cell-options-menu-ts-table-cell-options-menu-delete-column-menu-item-should-remove-the-table-column-on-click-1-snap.png +0 -3
  90. package/src/__tests__/visual-regression/__image_snapshots__/cell-options-menu-ts-table-cell-options-menu-delete-column-menu-item-visual-hints-should-be-added-to-the-table-column-on-hover-1-snap.png +0 -3
  91. package/src/__tests__/visual-regression/__image_snapshots__/cell-options-menu-ts-table-cell-options-menu-delete-row-menu-item-should-remove-the-table-row-on-click-1-snap.png +0 -3
  92. package/src/__tests__/visual-regression/__image_snapshots__/cell-options-menu-ts-table-cell-options-menu-delete-row-menu-item-visual-hints-should-be-added-to-the-table-row-on-hover-1-snap.png +0 -3
  93. package/src/__tests__/visual-regression/__image_snapshots__/copy-button-ts-floating-toolbar-copy-button-table-target-node-displays-blue-border-when-copy-button-is-hovered-1-snap.png +0 -3
  94. package/src/__tests__/visual-regression/__image_snapshots__/index-ts-snapshot-test-table-numbered-list-should-not-overflow-table-cell-when-there-are-more-than-100-ordered-list-items-1-snap.png +0 -3
  95. package/src/__tests__/visual-regression/__image_snapshots__/index-ts-snapshot-test-table-numbered-list-should-not-overflow-table-cell-when-there-are-more-than-100-ordered-list-items-2-snap.png +0 -3
  96. package/src/__tests__/visual-regression/__image_snapshots__/index-ts-snapshot-test-table-numbered-list-should-not-overflow-table-cell-when-there-are-more-than-100-ordered-list-items-3-snap.png +0 -3
  97. package/src/__tests__/visual-regression/__image_snapshots__/sticky-header-ts-snapshot-test-table-sticky-header-should-align-with-table-cell-when-active-1-snap.png +0 -3
  98. package/src/__tests__/visual-regression/__image_snapshots__/sticky-header-ts-snapshot-test-table-sticky-header-should-align-with-table-cell-when-active-2-snap.png +0 -3
  99. package/src/__tests__/visual-regression/cell-options-menu.ts +0 -101
  100. package/src/__tests__/visual-regression/copy-button.ts +0 -181
  101. package/src/__tests__/visual-regression/index.ts +0 -62
  102. package/src/__tests__/visual-regression/sticky-header.ts +0 -61
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:d1582b4c954f4ba9c81075284aa48ca466d712d2b3eefd5523de473a00b07cb8
3
- size 15412
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:50e4dd203bd2f40435517d45f06576978ae62076f1c94e635323ca6025b2bc18
3
- size 33063
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:564ceae63b3eeb8ba43f3a1dec9245df2ed74397b58209c78970139d73747e15
3
- size 15332
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:b6b00fe5974e24a0b66a3f2e4b61bbb6b776daa6996e89d942b4d2b37fa5b7f8
3
- size 33109
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:e7a36445c9b8e700ee0d8e54eac5975ad2a0cafebc8cdf1202e7d2048363c4d9
3
- size 16964
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:cd8e2c95766f1e96a0cfbf489e2e245a668e3f1f6fa5d2c31d8e96fdf6985470
3
- size 36160
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:184672baa2f0310a00eb5720e0ef9656917b50e6777285039f649c9277f37ecf
3
- size 34670
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:f5c7da08c9289a8dd0b2311a705a8ca16234efe58c7519167826805c694aa937
3
- size 42951
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:9572ae92d83265064e906f6413efa2b4290988f90ef39a8b4839d6f0638024b5
3
- size 22041
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:7854cb7000b2220a6f4d4e03e581158c2170947f6c038eb037a2d7d13dd3db2b
3
- size 21239
@@ -1,101 +0,0 @@
1
- // eslint-disable-next-line import/no-extraneous-dependencies -- Removed import for fixing circular dependencies
2
- import { insertTable } from '@atlaskit/editor-test-helpers/page-objects/table';
3
- // eslint-disable-next-line import/no-extraneous-dependencies -- Removed import for fixing circular dependencies
4
- import {
5
- initFullPageEditorWithAdf,
6
- snapshot,
7
- } from '@atlaskit/editor-test-helpers/vr-utils/base-utils';
8
- import type { PuppeteerPage } from '@atlaskit/visual-regression/helper';
9
-
10
- const firstCellSelector = 'table tbody th p';
11
- const cellOptionsSelector = '[aria-label="Cell options"]';
12
- const deleteColumnCellOptionSelector = '[aria-label="Delete column"]';
13
- const deleteRowCellOptionSelector = '[aria-label="Delete row"]';
14
-
15
- const emptyDocAdf = {
16
- version: 1,
17
- type: 'doc',
18
- content: [],
19
- };
20
-
21
- describe('Table cell options menu', () => {
22
- let page: PuppeteerPage;
23
-
24
- beforeEach(async () => {
25
- page = global.page;
26
- await initFullPageEditorWithAdf(
27
- page,
28
- emptyDocAdf,
29
- undefined,
30
- undefined,
31
- {},
32
- undefined,
33
- undefined,
34
- true,
35
- false,
36
- undefined,
37
- {
38
- group: 'editor',
39
- packageName: 'editor-plugin-table',
40
- exampleName: 'testing',
41
- },
42
- );
43
- await insertTable(page);
44
- page.waitForSelector(firstCellSelector);
45
-
46
- // move the focus to the first table cell
47
- await page.type(firstCellSelector, 'focus table cell');
48
- });
49
-
50
- describe('delete column menu item', () => {
51
- it('visual hints should be added to the table column on hover', async () => {
52
- // open the table cell options menu
53
- await page.waitForSelector(cellOptionsSelector);
54
- await page.click(cellOptionsSelector);
55
-
56
- // hover over the table cell options Delete column entry
57
- await page.waitForSelector(deleteColumnCellOptionSelector);
58
- await page.hover(deleteColumnCellOptionSelector);
59
-
60
- await snapshot(page);
61
- });
62
-
63
- it('should remove the table column on click', async () => {
64
- // open the table cell options menu
65
- await page.waitForSelector(cellOptionsSelector);
66
- await page.click(cellOptionsSelector);
67
-
68
- // click the table cell options Delete column entry
69
- await page.waitForSelector(deleteColumnCellOptionSelector);
70
- await page.click(deleteColumnCellOptionSelector);
71
-
72
- await snapshot(page);
73
- });
74
- });
75
-
76
- describe('delete row menu item', () => {
77
- it('visual hints should be added to the table row on hover', async () => {
78
- // open the table cell options menu
79
- await page.waitForSelector(cellOptionsSelector);
80
- await page.click(cellOptionsSelector);
81
-
82
- // hover over the table cell options Delete row entry
83
- await page.waitForSelector(deleteRowCellOptionSelector);
84
- await page.hover(deleteRowCellOptionSelector);
85
-
86
- await snapshot(page);
87
- });
88
-
89
- it('should remove the table row on click', async () => {
90
- // open the table cell options menu
91
- await page.waitForSelector(cellOptionsSelector);
92
- await page.click(cellOptionsSelector);
93
-
94
- // click the table cell options Delete row entry
95
- await page.waitForSelector(deleteColumnCellOptionSelector);
96
- await page.click(deleteRowCellOptionSelector);
97
-
98
- await snapshot(page);
99
- });
100
- });
101
- });
@@ -1,181 +0,0 @@
1
- export {};
2
-
3
- it.skip('TODO: restore vr `packages/editor/editor-plugin-table/src/__tests__/visual-regression/copy-button.ts`', () => {});
4
-
5
- // import { _getCopyButtonTestSuite } from '../../../copy-button/__tests__/visual-regression/_getCopyButtonTestSuite';
6
-
7
- // _getCopyButtonTestSuite({
8
- // nodeName: 'Table',
9
- // editorOptions: {
10
- // allowTables: {
11
- // advanced: true,
12
- // },
13
- // defaultValue: {
14
- // version: 1,
15
- // type: 'doc',
16
- // content: [
17
- // {
18
- // type: 'table',
19
- // attrs: {
20
- // isNumberColumnEnabled: false,
21
- // layout: 'default',
22
- // localId: '15804638-b946-4591-b64c-beffe5122733',
23
- // },
24
- // content: [
25
- // {
26
- // type: 'tableRow',
27
- // content: [
28
- // {
29
- // type: 'tableHeader',
30
- // attrs: {},
31
- // content: [
32
- // {
33
- // type: 'paragraph',
34
- // content: [
35
- // {
36
- // type: 'text',
37
- // text: '1',
38
- // },
39
- // ],
40
- // },
41
- // ],
42
- // },
43
- // {
44
- // type: 'tableHeader',
45
- // attrs: {},
46
- // content: [
47
- // {
48
- // type: 'paragraph',
49
- // content: [
50
- // {
51
- // type: 'text',
52
- // text: '2',
53
- // },
54
- // ],
55
- // },
56
- // ],
57
- // },
58
- // {
59
- // type: 'tableHeader',
60
- // attrs: {},
61
- // content: [
62
- // {
63
- // type: 'paragraph',
64
- // content: [
65
- // {
66
- // type: 'text',
67
- // text: '3',
68
- // },
69
- // ],
70
- // },
71
- // ],
72
- // },
73
- // ],
74
- // },
75
- // {
76
- // type: 'tableRow',
77
- // content: [
78
- // {
79
- // type: 'tableCell',
80
- // attrs: {},
81
- // content: [
82
- // {
83
- // type: 'paragraph',
84
- // content: [
85
- // {
86
- // type: 'text',
87
- // text: '4',
88
- // },
89
- // ],
90
- // },
91
- // ],
92
- // },
93
- // {
94
- // type: 'tableCell',
95
- // attrs: {},
96
- // content: [
97
- // {
98
- // type: 'paragraph',
99
- // content: [
100
- // {
101
- // type: 'text',
102
- // text: '5',
103
- // },
104
- // ],
105
- // },
106
- // ],
107
- // },
108
- // {
109
- // type: 'tableCell',
110
- // attrs: {},
111
- // content: [
112
- // {
113
- // type: 'paragraph',
114
- // content: [
115
- // {
116
- // type: 'text',
117
- // text: '6',
118
- // },
119
- // ],
120
- // },
121
- // ],
122
- // },
123
- // ],
124
- // },
125
- // {
126
- // type: 'tableRow',
127
- // content: [
128
- // {
129
- // type: 'tableCell',
130
- // attrs: {},
131
- // content: [
132
- // {
133
- // type: 'paragraph',
134
- // content: [
135
- // {
136
- // type: 'text',
137
- // text: '7',
138
- // },
139
- // ],
140
- // },
141
- // ],
142
- // },
143
- // {
144
- // type: 'tableCell',
145
- // attrs: {},
146
- // content: [
147
- // {
148
- // type: 'paragraph',
149
- // content: [
150
- // {
151
- // type: 'text',
152
- // text: '8',
153
- // },
154
- // ],
155
- // },
156
- // ],
157
- // },
158
- // {
159
- // type: 'tableCell',
160
- // attrs: {},
161
- // content: [
162
- // {
163
- // type: 'paragraph',
164
- // content: [
165
- // {
166
- // type: 'text',
167
- // text: '9',
168
- // },
169
- // ],
170
- // },
171
- // ],
172
- // },
173
- // ],
174
- // },
175
- // ],
176
- // },
177
- // ],
178
- // },
179
- // },
180
- // nodeSelector: '.pm-table-cell-content-wrap',
181
- // });
@@ -1,62 +0,0 @@
1
- // eslint-disable-next-line import/no-extraneous-dependencies -- Removed import for fixing circular dependencies
2
- import {
3
- scrollToBottom,
4
- scrollToElement,
5
- } from '@atlaskit/editor-test-helpers/page-objects/editor';
6
- // eslint-disable-next-line import/no-extraneous-dependencies -- Removed import for fixing circular dependencies
7
- import {
8
- initFullPageEditorWithAdf,
9
- snapshot,
10
- } from '@atlaskit/editor-test-helpers/vr-utils/base-utils';
11
- // eslint-disable-next-line import/no-extraneous-dependencies -- Removed import for fixing circular dependencies
12
- import { Device } from '@atlaskit/editor-test-helpers/vr-utils/device-viewport';
13
- import type { PuppeteerPage } from '@atlaskit/visual-regression/helper';
14
-
15
- import tableWith100ListItemsADF from './__fixtures__/table-with-100-numbered-list-items.json';
16
-
17
- async function initEditor(page: PuppeteerPage, adf: Object) {
18
- await initFullPageEditorWithAdf(
19
- page,
20
- adf,
21
- Device.LaptopMDPI,
22
- undefined,
23
- {},
24
- undefined,
25
- undefined,
26
- true,
27
- false,
28
- undefined,
29
- {
30
- group: 'editor',
31
- packageName: 'editor-plugin-table',
32
- exampleName: 'testing',
33
- },
34
- );
35
- }
36
-
37
- describe('Snapshot Test: Table', () => {
38
- let page: PuppeteerPage;
39
-
40
- beforeAll(async () => {
41
- page = global.page;
42
- });
43
-
44
- describe('numbered list', () => {
45
- // FIXME: Skipping this test as it is flaky
46
- // Build link: https://bitbucket.org/atlassian/atlassian-frontend/pipelines/results/2289567
47
- it.skip('should not overflow table cell, when there are more than 100 ordered list items', async () => {
48
- await initEditor(page, tableWith100ListItemsADF);
49
-
50
- // initial elements
51
- await snapshot(page);
52
-
53
- // 100th elements
54
- await scrollToElement(page, 'ol > li:nth-of-type(120)');
55
- await snapshot(page);
56
-
57
- // 1000th elements
58
- await scrollToBottom(page);
59
- await snapshot(page);
60
- });
61
- });
62
- });
@@ -1,61 +0,0 @@
1
- // eslint-disable-next-line import/no-extraneous-dependencies -- Removed import for fixing circular dependencies
2
- import { scrollToElement } from '@atlaskit/editor-test-helpers/page-objects/editor';
3
- // eslint-disable-next-line import/no-extraneous-dependencies -- Removed import for fixing circular dependencies
4
- import { clickFirstCell } from '@atlaskit/editor-test-helpers/page-objects/table';
5
- // eslint-disable-next-line import/no-extraneous-dependencies -- Removed import for fixing circular dependencies
6
- import {
7
- Appearance,
8
- initEditorWithAdf,
9
- snapshot,
10
- } from '@atlaskit/editor-test-helpers/vr-utils/base-utils';
11
- import type { PuppeteerPage } from '@atlaskit/visual-regression/helper';
12
-
13
- import stickyHeaderWithHorizontalScroll from './__fixtures__/sticky-header-with-horizontal-scroll.json';
14
-
15
- const initEditor = async (page: PuppeteerPage, adf: any) => {
16
- await initEditorWithAdf(
17
- page,
18
- {
19
- appearance: Appearance.fullPage,
20
- adf,
21
- viewport: { width: 1280, height: 868 },
22
- editorProps: {
23
- allowTables: {
24
- stickyHeaders: true,
25
- allowColumnResizing: true,
26
- },
27
- },
28
- },
29
- {
30
- group: 'editor',
31
- packageName: 'editor-plugin-table',
32
- exampleName: 'testing',
33
- },
34
- );
35
- };
36
-
37
- describe('Snapshot Test: Table', () => {
38
- let page: PuppeteerPage;
39
-
40
- beforeEach(async () => {
41
- page = global.page;
42
- });
43
-
44
- describe('sticky header', () => {
45
- it('should align with table cell when active', async () => {
46
- await initEditor(page, stickyHeaderWithHorizontalScroll);
47
-
48
- await clickFirstCell(page, true);
49
- // Mouse was inside the table and would cause the column resizer to trigger occasionally
50
- await page.mouse.move(0, 0);
51
-
52
- // scroll to bottom center to see scroll shadows
53
- await scrollToElement(page, 'ol > li');
54
- await snapshot(page);
55
-
56
- // scroll to bottom right
57
- await scrollToElement(page, 'ul > li');
58
- await snapshot(page);
59
- });
60
- });
61
- });