@atlaskit/editor-plugin-table 5.7.9 → 5.8.0

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 (105) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/afm-cc/tsconfig.json +3 -0
  3. package/dist/cjs/commands/column-resize.js +155 -0
  4. package/dist/cjs/commands/go-to-next-cell.js +15 -0
  5. package/dist/cjs/commands/selection.js +16 -3
  6. package/dist/cjs/nodeviews/ExternalDropTargets.js +2 -1
  7. package/dist/cjs/plugin.js +2 -1
  8. package/dist/cjs/pm-plugins/drag-and-drop/commands.js +3 -3
  9. package/dist/cjs/pm-plugins/drag-and-drop/plugin.js +2 -1
  10. package/dist/cjs/pm-plugins/keymap.js +9 -0
  11. package/dist/cjs/pm-plugins/table-resizing/event-handlers.js +18 -7
  12. package/dist/cjs/pm-plugins/table-resizing/utils/index.js +6 -0
  13. package/dist/cjs/types.js +8 -1
  14. package/dist/cjs/ui/DragHandle/index.js +1 -1
  15. package/dist/cjs/ui/FloatingDragMenu/DragMenu.js +187 -17
  16. package/dist/cjs/ui/FloatingDragMenu/index.js +4 -2
  17. package/dist/cjs/ui/FloatingDragMenu/styles.js +19 -0
  18. package/dist/cjs/ui/TableFloatingColumnControls/ColumnControls/index.js +2 -2
  19. package/dist/cjs/ui/TableFloatingControls/RowControls/DragControls.js +2 -2
  20. package/dist/cjs/ui/consts.js +2 -1
  21. package/dist/cjs/ui/ui-styles.js +6 -2
  22. package/dist/cjs/utils/decoration.js +14 -4
  23. package/dist/es2019/commands/column-resize.js +149 -0
  24. package/dist/es2019/commands/go-to-next-cell.js +13 -0
  25. package/dist/es2019/commands/selection.js +16 -3
  26. package/dist/es2019/nodeviews/ExternalDropTargets.js +2 -1
  27. package/dist/es2019/plugin.js +2 -1
  28. package/dist/es2019/pm-plugins/drag-and-drop/commands.js +3 -3
  29. package/dist/es2019/pm-plugins/drag-and-drop/plugin.js +2 -1
  30. package/dist/es2019/pm-plugins/keymap.js +10 -1
  31. package/dist/es2019/pm-plugins/table-resizing/event-handlers.js +19 -8
  32. package/dist/es2019/pm-plugins/table-resizing/utils/index.js +1 -1
  33. package/dist/es2019/types.js +8 -1
  34. package/dist/es2019/ui/DragHandle/index.js +1 -1
  35. package/dist/es2019/ui/FloatingDragMenu/DragMenu.js +177 -7
  36. package/dist/es2019/ui/FloatingDragMenu/index.js +4 -2
  37. package/dist/es2019/ui/FloatingDragMenu/styles.js +62 -0
  38. package/dist/es2019/ui/TableFloatingColumnControls/ColumnControls/index.js +2 -2
  39. package/dist/es2019/ui/TableFloatingControls/RowControls/DragControls.js +2 -2
  40. package/dist/es2019/ui/consts.js +2 -1
  41. package/dist/es2019/ui/ui-styles.js +108 -65
  42. package/dist/es2019/utils/decoration.js +14 -4
  43. package/dist/esm/commands/column-resize.js +149 -0
  44. package/dist/esm/commands/go-to-next-cell.js +15 -0
  45. package/dist/esm/commands/selection.js +16 -3
  46. package/dist/esm/nodeviews/ExternalDropTargets.js +2 -1
  47. package/dist/esm/plugin.js +2 -1
  48. package/dist/esm/pm-plugins/drag-and-drop/commands.js +3 -3
  49. package/dist/esm/pm-plugins/drag-and-drop/plugin.js +2 -1
  50. package/dist/esm/pm-plugins/keymap.js +10 -1
  51. package/dist/esm/pm-plugins/table-resizing/event-handlers.js +19 -8
  52. package/dist/esm/pm-plugins/table-resizing/utils/index.js +1 -1
  53. package/dist/esm/types.js +8 -1
  54. package/dist/esm/ui/DragHandle/index.js +1 -1
  55. package/dist/esm/ui/FloatingDragMenu/DragMenu.js +177 -7
  56. package/dist/esm/ui/FloatingDragMenu/index.js +4 -2
  57. package/dist/esm/ui/FloatingDragMenu/styles.js +12 -0
  58. package/dist/esm/ui/TableFloatingColumnControls/ColumnControls/index.js +2 -2
  59. package/dist/esm/ui/TableFloatingControls/RowControls/DragControls.js +2 -2
  60. package/dist/esm/ui/consts.js +2 -1
  61. package/dist/esm/ui/ui-styles.js +7 -3
  62. package/dist/esm/utils/decoration.js +14 -4
  63. package/dist/types/commands/column-resize.d.ts +5 -0
  64. package/dist/types/pm-plugins/drag-and-drop/commands.d.ts +1 -1
  65. package/dist/types/pm-plugins/table-resizing/utils/index.d.ts +1 -1
  66. package/dist/types/types.d.ts +7 -0
  67. package/dist/types/ui/FloatingDragMenu/DragMenu.d.ts +1 -2
  68. package/dist/types/ui/FloatingDragMenu/index.d.ts +3 -2
  69. package/dist/types/ui/FloatingDragMenu/styles.d.ts +3 -0
  70. package/dist/types/ui/consts.d.ts +1 -1
  71. package/dist/types/utils/decoration.d.ts +2 -2
  72. package/dist/types-ts4.5/commands/column-resize.d.ts +5 -0
  73. package/dist/types-ts4.5/pm-plugins/drag-and-drop/commands.d.ts +1 -1
  74. package/dist/types-ts4.5/pm-plugins/table-resizing/utils/index.d.ts +1 -1
  75. package/dist/types-ts4.5/types.d.ts +7 -0
  76. package/dist/types-ts4.5/ui/FloatingDragMenu/DragMenu.d.ts +1 -2
  77. package/dist/types-ts4.5/ui/FloatingDragMenu/index.d.ts +3 -2
  78. package/dist/types-ts4.5/ui/FloatingDragMenu/styles.d.ts +3 -0
  79. package/dist/types-ts4.5/ui/consts.d.ts +1 -1
  80. package/dist/types-ts4.5/utils/decoration.d.ts +2 -2
  81. package/package.json +8 -4
  82. package/src/__tests__/unit/analytics.ts +5 -1
  83. package/src/__tests__/unit/ui/FloatingDragMenu.tsx +295 -0
  84. package/src/__tests__/unit/ui/RowDragControls.tsx +5 -4
  85. package/src/commands/column-resize.ts +257 -0
  86. package/src/commands/go-to-next-cell.ts +21 -0
  87. package/src/commands/selection.ts +19 -2
  88. package/src/nodeviews/ExternalDropTargets.tsx +1 -0
  89. package/src/plugin.tsx +1 -0
  90. package/src/pm-plugins/drag-and-drop/commands.ts +3 -2
  91. package/src/pm-plugins/drag-and-drop/plugin.ts +10 -4
  92. package/src/pm-plugins/keymap.ts +35 -0
  93. package/src/pm-plugins/table-resizing/event-handlers.ts +33 -21
  94. package/src/pm-plugins/table-resizing/utils/index.ts +1 -0
  95. package/src/types.ts +9 -0
  96. package/src/ui/DragHandle/index.tsx +1 -1
  97. package/src/ui/FloatingDragMenu/DragMenu.tsx +226 -7
  98. package/src/ui/FloatingDragMenu/index.tsx +4 -1
  99. package/src/ui/FloatingDragMenu/styles.ts +71 -0
  100. package/src/ui/TableFloatingColumnControls/ColumnControls/index.tsx +35 -37
  101. package/src/ui/TableFloatingControls/RowControls/DragControls.tsx +33 -33
  102. package/src/ui/consts.ts +6 -1
  103. package/src/ui/ui-styles.ts +115 -64
  104. package/src/utils/decoration.ts +27 -8
  105. package/tsconfig.app.json +3 -0
@@ -305,6 +305,8 @@ export declare const TableCssClassName: {
305
305
  DRAG_HANDLE_DISABLED: string;
306
306
  /** minimised handle class */
307
307
  DRAG_HANDLE_MINIMISED: string;
308
+ DRAG_SUBMENU: string;
309
+ DRAG_SUBMENU_ICON: string;
308
310
  /** Other classes */
309
311
  NUMBERED_COLUMN: string;
310
312
  NUMBERED_COLUMN_BUTTON: string;
@@ -338,12 +340,17 @@ export declare const TableCssClassName: {
338
340
  TOP_LEFT_CELL: string;
339
341
  LAST_ITEM_IN_CELL: string;
340
342
  WITH_COLUMN_INSERT_LINE: string;
343
+ WITH_COLUMN_INSERT_LINE_INACTIVE: string;
341
344
  WITH_FIRST_COLUMN_INSERT_LINE: string;
345
+ WITH_FIRST_COLUMN_INSERT_LINE_INACTIVE: string;
342
346
  WITH_LAST_COLUMN_INSERT_LINE: string;
347
+ WITH_LAST_COLUMN_INSERT_LINE_INACTIVE: string;
343
348
  WITH_RESIZE_LINE: string;
344
349
  WITH_RESIZE_LINE_LAST_COLUMN: string;
345
350
  WITH_ROW_INSERT_LINE: string;
351
+ WITH_ROW_INSERT_LINE_INACTIVE: string;
346
352
  WITH_LAST_ROW_INSERT_LINE: string;
353
+ WITH_LAST_ROW_INSERT_LINE_INACTIVE: string;
347
354
  TABLE_CONTAINER: string;
348
355
  TABLE_NODE_WRAPPER: string;
349
356
  TABLE_LEFT_SHADOW: string;
@@ -1,4 +1,3 @@
1
- /** @jsx jsx */
2
1
  import { jsx } from '@emotion/react';
3
2
  import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
4
3
  import type { GetEditorContainerWidth } from '@atlaskit/editor-common/types';
@@ -21,5 +20,5 @@ type DragMenuProps = {
21
20
  canDrag?: boolean;
22
21
  editorAnalyticsAPI?: EditorAnalyticsAPI;
23
22
  };
24
- export declare const DragMenu: ({ direction, index, isOpen, editorView, tableNode, mountPoint, boundariesElement, scrollableElement, targetCellPosition, getEditorContainerWidth, canDrag, editorAnalyticsAPI, }: DragMenuProps) => jsx.JSX.Element | null;
23
+ export declare const DragMenu: ({ direction, index, isOpen, editorView, tableNode, mountPoint, boundariesElement, scrollableElement, targetCellPosition, getEditorContainerWidth, canDrag, editorAnalyticsAPI, pluginConfig, }: DragMenuProps) => jsx.JSX.Element | null;
25
24
  export {};
@@ -4,7 +4,7 @@ import type { GetEditorContainerWidth } from '@atlaskit/editor-common/types';
4
4
  import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
5
5
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
6
6
  import type { RowStickyState } from '../../pm-plugins/sticky-headers';
7
- import type { TableDirection } from '../../types';
7
+ import type { PluginConfig, TableDirection } from '../../types';
8
8
  export interface Props {
9
9
  editorView: EditorView;
10
10
  isOpen: boolean;
@@ -20,9 +20,10 @@ export interface Props {
20
20
  canDrag?: boolean;
21
21
  editorAnalyticsAPI?: EditorAnalyticsAPI;
22
22
  stickyHeaders?: RowStickyState;
23
+ pluginConfig?: PluginConfig;
23
24
  }
24
25
  declare const FloatingDragMenu: {
25
- ({ mountPoint, boundariesElement, scrollableElement, editorView, isOpen, tableNode, direction, index, targetCellPosition, getEditorContainerWidth, canDrag, editorAnalyticsAPI, stickyHeaders, }: Props): JSX.Element | null;
26
+ ({ mountPoint, boundariesElement, scrollableElement, editorView, isOpen, tableNode, direction, index, targetCellPosition, getEditorContainerWidth, canDrag, editorAnalyticsAPI, stickyHeaders, pluginConfig, }: Props): JSX.Element | null;
26
27
  displayName: string;
27
28
  };
28
29
  export default FloatingDragMenu;
@@ -0,0 +1,3 @@
1
+ export declare const cellColourPreviewStyles: (selectedColor: string) => import("@emotion/react").SerializedStyles;
2
+ export declare const dragMenuBackgroundColorStyles: import("@emotion/react").SerializedStyles;
3
+ export declare const toggleStyles: import("@emotion/react").SerializedStyles;
@@ -40,7 +40,7 @@ export declare const resizeHandlerAreaWidth: number;
40
40
  export declare const resizeLineWidth = 2;
41
41
  export declare const resizeHandlerZIndex: number;
42
42
  export declare const contextualMenuTriggerSize = 16;
43
- export declare const contextualMenuDropdownWidth = 180;
43
+ export declare const contextualMenuDropdownWidth: number;
44
44
  export declare const stickyRowZIndex: number;
45
45
  export declare const stickyRowOffsetTop = 8;
46
46
  export declare const stickyHeaderBorderBottomWidth = 1;
@@ -17,5 +17,5 @@ export declare const createResizeHandleDecoration: (tr: Transaction | ReadonlyTr
17
17
  Decoration[]
18
18
  ];
19
19
  export declare const createColumnLineResize: (selection: Selection, cellColumnPositioning: Omit<CellColumnPositioning, 'left'>) => Decoration[];
20
- export declare const createColumnInsertLine: (columnIndex: number, selection: Selection) => Decoration[];
21
- export declare const createRowInsertLine: (rowIndex: number, selection: Selection) => Decoration[];
20
+ export declare const createColumnInsertLine: (columnIndex: number, selection: Selection, hasMergedCells: boolean) => Decoration[];
21
+ export declare const createRowInsertLine: (rowIndex: number, selection: Selection, hasMergedCells: boolean) => Decoration[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "5.7.9",
3
+ "version": "5.8.0",
4
4
  "description": "Table plugin for the @atlaskit/editor",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -30,7 +30,7 @@
30
30
  "dependencies": {
31
31
  "@atlaskit/adf-schema": "^35.3.0",
32
32
  "@atlaskit/custom-steps": "^0.0.11",
33
- "@atlaskit/editor-common": "^76.35.0",
33
+ "@atlaskit/editor-common": "^76.38.0",
34
34
  "@atlaskit/editor-palette": "1.5.2",
35
35
  "@atlaskit/editor-plugin-analytics": "^0.4.0",
36
36
  "@atlaskit/editor-plugin-content-insertion": "^0.1.0",
@@ -45,8 +45,9 @@
45
45
  "@atlaskit/pragmatic-drag-and-drop": "^0.25.0",
46
46
  "@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^0.8.0",
47
47
  "@atlaskit/pragmatic-drag-and-drop-hitbox": "^0.12.0",
48
- "@atlaskit/primitives": "^1.16.0",
48
+ "@atlaskit/primitives": "^1.17.0",
49
49
  "@atlaskit/theme": "^12.6.0",
50
+ "@atlaskit/toggle": "^13.0.0",
50
51
  "@atlaskit/tokens": "^1.33.0",
51
52
  "@atlaskit/tooltip": "^18.1.0",
52
53
  "@babel/runtime": "^7.0.0",
@@ -67,7 +68,7 @@
67
68
  "@atlaskit/editor-plugin-decorations": "^0.2.0",
68
69
  "@atlaskit/editor-plugin-feature-flags": "^1.0.0",
69
70
  "@atlaskit/editor-plugin-grid": "^0.3.0",
70
- "@atlaskit/editor-plugin-hyperlink": "^0.6.0",
71
+ "@atlaskit/editor-plugin-hyperlink": "^0.8.0",
71
72
  "@atlaskit/visual-regression": "*",
72
73
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
73
74
  "@atlassian/feature-flags-test-utils": "^0.1.2",
@@ -144,6 +145,9 @@
144
145
  },
145
146
  "platform.editor.table.in-danger-hover-merged-cells-fix": {
146
147
  "type": "boolean"
148
+ },
149
+ "platform.editor.a11y-column-resizing_emcvz": {
150
+ "type": "boolean"
147
151
  }
148
152
  }
149
153
  }
@@ -802,7 +802,11 @@ describe('Table analytic events', () => {
802
802
  beforeEach(() => {
803
803
  editorView = editor(defaultTableDoc).editorView;
804
804
  // Note: we cannot clean a drop target, util one has been set.
805
- setDropTarget('column', 0)(editorView.state, editorView.dispatch);
805
+ setDropTarget(
806
+ 'column',
807
+ 0,
808
+ false,
809
+ )(editorView.state, editorView.dispatch);
806
810
  });
807
811
 
808
812
  it.each([
@@ -188,5 +188,300 @@ describe('FloatingDragMenu', () => {
188
188
  ]
189
189
  `);
190
190
  });
191
+ // first row menu item check
192
+ ffTest(
193
+ 'platform.editor.table.new-cell-context-menu-styling',
194
+ () => {
195
+ // Run test case when FF platform.editor.table.new-cell-context-menu-styling is true
196
+
197
+ const tableRef = editorView.dom.querySelector('table');
198
+ const editorRef = {
199
+ current: document.createElement('div'),
200
+ };
201
+ render(
202
+ <ReactEditorViewContext.Provider
203
+ value={{
204
+ editorRef,
205
+ }}
206
+ >
207
+ <div id="drag-handle-button-row">dragmenu anchor</div>
208
+ <DragMenu
209
+ editorView={editorView}
210
+ isOpen={true}
211
+ getEditorContainerWidth={jest.fn()}
212
+ tableRef={tableRef as HTMLTableElement}
213
+ tableNode={tableNode?.node}
214
+ direction="row"
215
+ index={0}
216
+ />
217
+ </ReactEditorViewContext.Provider>,
218
+ );
219
+
220
+ const items = screen.getAllByRole('menuitem');
221
+ const menuitemTextArray = items.map((item) => item.textContent);
222
+ expect(menuitemTextArray).toMatchInlineSnapshot(`
223
+ Array [
224
+ "Add row aboveCtrl+Alt+↑",
225
+ "Add row belowCtrl+Alt+↓",
226
+ "Clear cells⌫",
227
+ "Delete rowCtrl+⌫",
228
+ "Move row upCtrl+Alt+Shift+↑",
229
+ "Move row downCtrl+Alt+Shift+↓",
230
+ "Header row",
231
+ "Row numbers",
232
+ ]
233
+ `);
234
+ },
235
+ () => {
236
+ // Run test case when FF platform.editor.table.new-cell-context-menu-styling is false
237
+ const tableRef = editorView.dom.querySelector('table');
238
+ const editorRef = {
239
+ current: document.createElement('div'),
240
+ };
241
+ render(
242
+ <ReactEditorViewContext.Provider
243
+ value={{
244
+ editorRef,
245
+ }}
246
+ >
247
+ <div id="drag-handle-button-row">dragmenu anchor</div>
248
+ <DragMenu
249
+ editorView={editorView}
250
+ isOpen={true}
251
+ getEditorContainerWidth={jest.fn()}
252
+ tableRef={tableRef as HTMLTableElement}
253
+ tableNode={tableNode?.node}
254
+ direction="row"
255
+ index={0}
256
+ />
257
+ </ReactEditorViewContext.Provider>,
258
+ );
259
+
260
+ const items = screen.getAllByRole('menuitem');
261
+ const menuitemTextArray = items.map((item) => item.textContent);
262
+ expect(menuitemTextArray).toMatchInlineSnapshot(`
263
+ Array [
264
+ "Add row aboveCtrl+Alt+↑",
265
+ "Add row belowCtrl+Alt+↓",
266
+ "Clear cells⌫",
267
+ "Delete rowCtrl+⌫",
268
+ "Move row upCtrl+Alt+Shift+↑",
269
+ "Move row downCtrl+Alt+Shift+↓",
270
+ ]
271
+ `);
272
+ },
273
+ );
274
+ // second row menu item check
275
+ ffTest(
276
+ 'platform.editor.table.new-cell-context-menu-styling',
277
+ () => {
278
+ // Run test case when FF platform.editor.table.new-cell-context-menu-styling is true
279
+
280
+ const tableRef = editorView.dom.querySelector('table');
281
+ const editorRef = {
282
+ current: document.createElement('div'),
283
+ };
284
+ render(
285
+ <ReactEditorViewContext.Provider
286
+ value={{
287
+ editorRef,
288
+ }}
289
+ >
290
+ <div id="drag-handle-button-row">dragmenu anchor</div>
291
+ <DragMenu
292
+ editorView={editorView}
293
+ isOpen={true}
294
+ getEditorContainerWidth={jest.fn()}
295
+ tableRef={tableRef as HTMLTableElement}
296
+ tableNode={tableNode?.node}
297
+ direction="row"
298
+ index={1}
299
+ />
300
+ </ReactEditorViewContext.Provider>,
301
+ );
302
+
303
+ const items = screen.getAllByRole('menuitem');
304
+ const menuitemTextArray = items.map((item) => item.textContent);
305
+ expect(menuitemTextArray).toMatchInlineSnapshot(`
306
+ Array [
307
+ "Add row aboveCtrl+Alt+↑",
308
+ "Add row belowCtrl+Alt+↓",
309
+ "Clear cells⌫",
310
+ "Delete rowCtrl+⌫",
311
+ "Move row upCtrl+Alt+Shift+↑",
312
+ "Move row downCtrl+Alt+Shift+↓",
313
+ "Row numbers",
314
+ ]
315
+ `);
316
+ },
317
+ () => {
318
+ // Run test case when FF platform.editor.table.new-cell-context-menu-styling is false
319
+ const tableRef = editorView.dom.querySelector('table');
320
+ const editorRef = {
321
+ current: document.createElement('div'),
322
+ };
323
+ render(
324
+ <ReactEditorViewContext.Provider
325
+ value={{
326
+ editorRef,
327
+ }}
328
+ >
329
+ <div id="drag-handle-button-row">dragmenu anchor</div>
330
+ <DragMenu
331
+ editorView={editorView}
332
+ isOpen={true}
333
+ getEditorContainerWidth={jest.fn()}
334
+ tableRef={tableRef as HTMLTableElement}
335
+ tableNode={tableNode?.node}
336
+ direction="row"
337
+ index={1}
338
+ />
339
+ </ReactEditorViewContext.Provider>,
340
+ );
341
+
342
+ const items = screen.getAllByRole('menuitem');
343
+ const menuitemTextArray = items.map((item) => item.textContent);
344
+ expect(menuitemTextArray).toMatchInlineSnapshot(`
345
+ Array [
346
+ "Add row aboveCtrl+Alt+↑",
347
+ "Add row belowCtrl+Alt+↓",
348
+ "Clear cells⌫",
349
+ "Delete rowCtrl+⌫",
350
+ "Move row upCtrl+Alt+Shift+↑",
351
+ "Move row downCtrl+Alt+Shift+↓",
352
+ ]
353
+ `);
354
+ },
355
+ );
356
+ // first column menu item check
357
+ ffTest(
358
+ 'platform.editor.table.new-cell-context-menu-styling',
359
+ () => {
360
+ // Run test case when FF platform.editor.table.new-cell-context-menu-styling is true
361
+
362
+ const tableRef = editorView.dom.querySelector('table');
363
+ const editorRef = {
364
+ current: document.createElement('div'),
365
+ };
366
+ render(
367
+ <ReactEditorViewContext.Provider
368
+ value={{
369
+ editorRef,
370
+ }}
371
+ >
372
+ <div id="drag-handle-button-row">dragmenu anchor</div>
373
+ <DragMenu
374
+ editorView={editorView}
375
+ isOpen={true}
376
+ getEditorContainerWidth={jest.fn()}
377
+ tableRef={tableRef as HTMLTableElement}
378
+ tableNode={tableNode?.node}
379
+ direction="column"
380
+ index={0}
381
+ />
382
+ </ReactEditorViewContext.Provider>,
383
+ );
384
+
385
+ const items = screen.getAllByRole('menuitem');
386
+ const menuitemTextArray = items.map((item) => item.textContent);
387
+ expect(menuitemTextArray).toMatchInlineSnapshot(`
388
+ Array [
389
+ "Add column leftCtrl+Alt+←",
390
+ "Add column rightCtrl+Alt+→",
391
+ "Distribute columns",
392
+ "Clear cells⌫",
393
+ "Delete columnCtrl+⌫",
394
+ "Move column leftCtrl+Alt+Shift+←",
395
+ "Move column rightCtrl+Alt+Shift+→",
396
+ "Sort increasing",
397
+ "Sort decreasing",
398
+ "Header column",
399
+ ]
400
+ `);
401
+ },
402
+ () => {
403
+ // Run test case when FF platform.editor.table.new-cell-context-menu-styling is false
404
+ const tableRef = editorView.dom.querySelector('table');
405
+ const editorRef = {
406
+ current: document.createElement('div'),
407
+ };
408
+ render(
409
+ <ReactEditorViewContext.Provider
410
+ value={{
411
+ editorRef,
412
+ }}
413
+ >
414
+ <div id="drag-handle-button-row">dragmenu anchor</div>
415
+ <DragMenu
416
+ editorView={editorView}
417
+ isOpen={true}
418
+ getEditorContainerWidth={jest.fn()}
419
+ tableRef={tableRef as HTMLTableElement}
420
+ tableNode={tableNode?.node}
421
+ direction="column"
422
+ index={0}
423
+ />
424
+ </ReactEditorViewContext.Provider>,
425
+ );
426
+
427
+ const items = screen.getAllByRole('menuitem');
428
+ const menuitemTextArray = items.map((item) => item.textContent);
429
+ expect(menuitemTextArray).toMatchInlineSnapshot(`
430
+ Array [
431
+ "Add column leftCtrl+Alt+←",
432
+ "Add column rightCtrl+Alt+→",
433
+ "Distribute columns",
434
+ "Clear cells⌫",
435
+ "Delete columnCtrl+⌫",
436
+ "Move column leftCtrl+Alt+Shift+←",
437
+ "Move column rightCtrl+Alt+Shift+→",
438
+ "Sort increasing",
439
+ "Sort decreasing",
440
+ ]
441
+ `);
442
+ },
443
+ );
444
+ // second column menu item check
445
+ ffTest('platform.editor.table.new-cell-context-menu-styling', () => {
446
+ // Run test case when FF platform.editor.table.new-cell-context-menu-styling is true
447
+ const tableRef = editorView.dom.querySelector('table');
448
+ const editorRef = {
449
+ current: document.createElement('div'),
450
+ };
451
+ render(
452
+ <ReactEditorViewContext.Provider
453
+ value={{
454
+ editorRef,
455
+ }}
456
+ >
457
+ <div id="drag-handle-button-row">dragmenu anchor</div>
458
+ <DragMenu
459
+ editorView={editorView}
460
+ isOpen={true}
461
+ getEditorContainerWidth={jest.fn()}
462
+ tableRef={tableRef as HTMLTableElement}
463
+ tableNode={tableNode?.node}
464
+ direction="column"
465
+ index={1}
466
+ />
467
+ </ReactEditorViewContext.Provider>,
468
+ );
469
+
470
+ const items = screen.getAllByRole('menuitem');
471
+ const menuitemTextArray = items.map((item) => item.textContent);
472
+ expect(menuitemTextArray).toMatchInlineSnapshot(`
473
+ Array [
474
+ "Add column leftCtrl+Alt+←",
475
+ "Add column rightCtrl+Alt+→",
476
+ "Distribute columns",
477
+ "Clear cells⌫",
478
+ "Delete columnCtrl+⌫",
479
+ "Move column leftCtrl+Alt+Shift+←",
480
+ "Move column rightCtrl+Alt+Shift+→",
481
+ "Sort increasing",
482
+ "Sort decreasing",
483
+ ]
484
+ `);
485
+ });
191
486
  });
192
487
  });
@@ -30,10 +30,9 @@ import {
30
30
 
31
31
  import tablePlugin from '../../../plugin';
32
32
  import { pluginKey } from '../../../pm-plugins/plugin-key';
33
- // import { TableCssClassName as ClassName } from '../../../types';
34
33
  import { DragControls } from '../../../ui/TableFloatingControls/RowControls';
35
34
 
36
- describe('NumberColumn', () => {
35
+ describe('RowDragControls', () => {
37
36
  const createEditor = createProsemirrorEditorFactory();
38
37
 
39
38
  const editor = (doc: DocBuilder, tableOptions = {}) =>
@@ -81,7 +80,9 @@ describe('NumberColumn', () => {
81
80
  </IntlProvider>,
82
81
  );
83
82
 
84
- const dragHandle = screen.getAllByTestId('table-floating-row-drag-handle');
83
+ const dragHandle = screen.getAllByTestId(
84
+ /^table-floating-row-\d-drag-handle$/,
85
+ );
85
86
 
86
87
  expect(dragHandle.length).toBe(1);
87
88
  });
@@ -120,7 +121,7 @@ describe('NumberColumn', () => {
120
121
  );
121
122
 
122
123
  const dragHandle = screen.queryAllByTestId(
123
- 'table-floating-row-drag-handle',
124
+ /^table-floating-row-\d-drag-handle$/,
124
125
  );
125
126
 
126
127
  expect(dragHandle.length).toBe(0);