@atlaskit/editor-plugin-table 7.9.0 → 7.10.1

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 (77) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/commands/column-resize.js +25 -7
  3. package/dist/cjs/nodeviews/TableComponent.js +11 -3
  4. package/dist/cjs/nodeviews/TableRow.js +1 -1
  5. package/dist/cjs/pm-plugins/table-resizing/utils/colgroup.js +4 -4
  6. package/dist/cjs/pm-plugins/table-resizing/utils/misc.js +1 -1
  7. package/dist/cjs/pm-plugins/table-resizing/utils/resize-column.js +5 -3
  8. package/dist/cjs/pm-plugins/table-resizing/utils/resize-state.js +9 -7
  9. package/dist/cjs/transforms/column-width.js +3 -1
  10. package/dist/cjs/ui/TableFloatingControls/RowControls/DragControls.js +19 -6
  11. package/dist/cjs/utils/index.js +12 -0
  12. package/dist/cjs/utils/nodes.js +6 -1
  13. package/dist/cjs/utils/table.js +34 -1
  14. package/dist/es2019/commands/column-resize.js +25 -7
  15. package/dist/es2019/nodeviews/TableComponent.js +12 -4
  16. package/dist/es2019/nodeviews/TableRow.js +1 -1
  17. package/dist/es2019/pm-plugins/table-resizing/utils/colgroup.js +4 -4
  18. package/dist/es2019/pm-plugins/table-resizing/utils/misc.js +1 -1
  19. package/dist/es2019/pm-plugins/table-resizing/utils/resize-column.js +5 -3
  20. package/dist/es2019/pm-plugins/table-resizing/utils/resize-state.js +9 -7
  21. package/dist/es2019/transforms/column-width.js +3 -1
  22. package/dist/es2019/ui/TableFloatingControls/RowControls/DragControls.js +19 -6
  23. package/dist/es2019/utils/index.js +2 -2
  24. package/dist/es2019/utils/nodes.js +5 -0
  25. package/dist/es2019/utils/table.js +36 -1
  26. package/dist/esm/commands/column-resize.js +25 -7
  27. package/dist/esm/nodeviews/TableComponent.js +12 -4
  28. package/dist/esm/nodeviews/TableRow.js +1 -1
  29. package/dist/esm/pm-plugins/table-resizing/utils/colgroup.js +4 -4
  30. package/dist/esm/pm-plugins/table-resizing/utils/misc.js +1 -1
  31. package/dist/esm/pm-plugins/table-resizing/utils/resize-column.js +5 -3
  32. package/dist/esm/pm-plugins/table-resizing/utils/resize-state.js +9 -7
  33. package/dist/esm/transforms/column-width.js +3 -1
  34. package/dist/esm/ui/TableFloatingControls/RowControls/DragControls.js +19 -6
  35. package/dist/esm/utils/index.js +2 -2
  36. package/dist/esm/utils/nodes.js +5 -0
  37. package/dist/esm/utils/table.js +33 -0
  38. package/dist/types/commands/column-resize.d.ts +5 -4
  39. package/dist/types/nodeviews/TableComponent.d.ts +6 -54
  40. package/dist/types/plugin.d.ts +1 -1
  41. package/dist/types/pm-plugins/table-resizing/utils/colgroup.d.ts +1 -1
  42. package/dist/types/pm-plugins/table-resizing/utils/misc.d.ts +1 -1
  43. package/dist/types/pm-plugins/table-resizing/utils/resize-column.d.ts +1 -1
  44. package/dist/types/pm-plugins/table-resizing/utils/resize-state.d.ts +2 -2
  45. package/dist/types/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +16 -20
  46. package/dist/types/ui/TableFloatingControls/CornerControls/DragCornerControls.d.ts +32 -40
  47. package/dist/types/ui/TableFloatingControls/index.d.ts +16 -20
  48. package/dist/types/utils/index.d.ts +2 -2
  49. package/dist/types/utils/nodes.d.ts +1 -0
  50. package/dist/types/utils/table.d.ts +3 -0
  51. package/dist/types-ts4.5/commands/column-resize.d.ts +5 -4
  52. package/dist/types-ts4.5/nodeviews/TableComponent.d.ts +6 -54
  53. package/dist/types-ts4.5/plugin.d.ts +1 -1
  54. package/dist/types-ts4.5/pm-plugins/table-resizing/utils/colgroup.d.ts +1 -1
  55. package/dist/types-ts4.5/pm-plugins/table-resizing/utils/misc.d.ts +1 -1
  56. package/dist/types-ts4.5/pm-plugins/table-resizing/utils/resize-column.d.ts +1 -1
  57. package/dist/types-ts4.5/pm-plugins/table-resizing/utils/resize-state.d.ts +2 -2
  58. package/dist/types-ts4.5/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +16 -20
  59. package/dist/types-ts4.5/ui/TableFloatingControls/CornerControls/DragCornerControls.d.ts +32 -40
  60. package/dist/types-ts4.5/ui/TableFloatingControls/index.d.ts +16 -20
  61. package/dist/types-ts4.5/utils/index.d.ts +2 -2
  62. package/dist/types-ts4.5/utils/nodes.d.ts +1 -0
  63. package/dist/types-ts4.5/utils/table.d.ts +3 -0
  64. package/package.json +4 -1
  65. package/src/commands/column-resize.ts +42 -11
  66. package/src/nodeviews/TableComponent.tsx +21 -6
  67. package/src/nodeviews/TableRow.ts +2 -2
  68. package/src/plugin.tsx +1 -1
  69. package/src/pm-plugins/table-resizing/utils/colgroup.ts +5 -5
  70. package/src/pm-plugins/table-resizing/utils/misc.ts +2 -2
  71. package/src/pm-plugins/table-resizing/utils/resize-column.ts +7 -5
  72. package/src/pm-plugins/table-resizing/utils/resize-state.ts +16 -10
  73. package/src/transforms/column-width.ts +10 -2
  74. package/src/ui/TableFloatingControls/RowControls/DragControls.tsx +28 -11
  75. package/src/utils/index.ts +2 -1
  76. package/src/utils/nodes.ts +10 -0
  77. package/src/utils/table.ts +36 -0
@@ -32,16 +32,6 @@ export declare const ColumnControls: ({ editorView, tableActive, tableRef, hover
32
32
  insertTableWithSize: (rowsCount: number, colsCount: number, inputMethod?: import("@atlaskit/editor-common/analytics").INPUT_METHOD.PICKER | undefined) => import("@atlaskit/editor-common/types").EditorCommand;
33
33
  };
34
34
  dependencies: [
35
- import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"accessibilityUtils", {
36
- dependencies: [
37
- ];
38
- actions: {
39
- ariaNotify: (message: string) => void;
40
- };
41
- sharedState: {
42
- message: string;
43
- };
44
- }, undefined>>,
45
35
  import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"analytics", {
46
36
  pluginConfiguration: import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions;
47
37
  sharedState: {
@@ -99,6 +89,14 @@ export declare const ColumnControls: ({ editorView, tableActive, tableRef, hover
99
89
  };
100
90
  sharedState: import("@atlaskit/editor-common/selection").SelectionSharedState;
101
91
  }, import("@atlaskit/editor-plugin-selection/types").SelectionPluginOptions | undefined>,
92
+ import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"accessibilityUtils", {
93
+ dependencies: [
94
+ ];
95
+ actions: {
96
+ ariaNotify: (message: string, ariaLiveElementAttributes?: import("@atlaskit/editor-plugin-accessibility-utils").AriaLiveElementAttributes | undefined) => void;
97
+ };
98
+ sharedState: import("@atlaskit/editor-plugin-accessibility-utils").AccessibilityUtilsPluginState;
99
+ }, undefined>>,
102
100
  import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"media", {
103
101
  pluginConfiguration: any;
104
102
  dependencies: any;
@@ -159,16 +157,6 @@ export declare const ColumnControls: ({ editorView, tableActive, tableRef, hover
159
157
  } | undefined>>
160
158
  ];
161
159
  }, import("../../../plugin").TablePluginOptions | undefined>,
162
- import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"accessibilityUtils", {
163
- dependencies: [
164
- ];
165
- actions: {
166
- ariaNotify: (message: string) => void;
167
- };
168
- sharedState: {
169
- message: string;
170
- };
171
- }, undefined>>,
172
160
  import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"analytics", {
173
161
  pluginConfiguration: import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions;
174
162
  sharedState: {
@@ -226,6 +214,14 @@ export declare const ColumnControls: ({ editorView, tableActive, tableRef, hover
226
214
  };
227
215
  sharedState: import("@atlaskit/editor-common/selection").SelectionSharedState;
228
216
  }, import("@atlaskit/editor-plugin-selection/types").SelectionPluginOptions | undefined>,
217
+ import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"accessibilityUtils", {
218
+ dependencies: [
219
+ ];
220
+ actions: {
221
+ ariaNotify: (message: string, ariaLiveElementAttributes?: import("@atlaskit/editor-plugin-accessibility-utils").AriaLiveElementAttributes | undefined) => void;
222
+ };
223
+ sharedState: import("@atlaskit/editor-plugin-accessibility-utils").AccessibilityUtilsPluginState;
224
+ }, undefined>>,
229
225
  import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"media", {
230
226
  pluginConfiguration: any;
231
227
  dependencies: any;
@@ -13,16 +13,6 @@ export declare const DragCornerControlsWithSelection: React.FC<import("react-int
13
13
  insertTableWithSize: (rowsCount: number, colsCount: number, inputMethod?: import("@atlaskit/editor-common/analytics").INPUT_METHOD.PICKER | undefined) => import("@atlaskit/editor-common/types").EditorCommand;
14
14
  };
15
15
  dependencies: [
16
- import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"accessibilityUtils", {
17
- dependencies: [
18
- ];
19
- actions: {
20
- ariaNotify: (message: string) => void;
21
- };
22
- sharedState: {
23
- message: string;
24
- };
25
- }, undefined>>,
26
16
  import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"analytics", {
27
17
  pluginConfiguration: import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions;
28
18
  sharedState: {
@@ -80,6 +70,14 @@ export declare const DragCornerControlsWithSelection: React.FC<import("react-int
80
70
  };
81
71
  sharedState: import("@atlaskit/editor-common/selection").SelectionSharedState;
82
72
  }, import("@atlaskit/editor-plugin-selection/types").SelectionPluginOptions | undefined>,
73
+ import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"accessibilityUtils", {
74
+ dependencies: [
75
+ ];
76
+ actions: {
77
+ ariaNotify: (message: string, ariaLiveElementAttributes?: import("@atlaskit/editor-plugin-accessibility-utils").AriaLiveElementAttributes | undefined) => void;
78
+ };
79
+ sharedState: import("@atlaskit/editor-plugin-accessibility-utils").AccessibilityUtilsPluginState;
80
+ }, undefined>>,
83
81
  import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"media", {
84
82
  pluginConfiguration: any;
85
83
  dependencies: any;
@@ -140,16 +138,6 @@ export declare const DragCornerControlsWithSelection: React.FC<import("react-int
140
138
  } | undefined>>
141
139
  ];
142
140
  }, import("../../../plugin").TablePluginOptions | undefined>,
143
- import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"accessibilityUtils", {
144
- dependencies: [
145
- ];
146
- actions: {
147
- ariaNotify: (message: string) => void;
148
- };
149
- sharedState: {
150
- message: string;
151
- };
152
- }, undefined>>,
153
141
  import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"analytics", {
154
142
  pluginConfiguration: import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions;
155
143
  sharedState: {
@@ -207,6 +195,14 @@ export declare const DragCornerControlsWithSelection: React.FC<import("react-int
207
195
  };
208
196
  sharedState: import("@atlaskit/editor-common/selection").SelectionSharedState;
209
197
  }, import("@atlaskit/editor-plugin-selection/types").SelectionPluginOptions | undefined>,
198
+ import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"accessibilityUtils", {
199
+ dependencies: [
200
+ ];
201
+ actions: {
202
+ ariaNotify: (message: string, ariaLiveElementAttributes?: import("@atlaskit/editor-plugin-accessibility-utils").AriaLiveElementAttributes | undefined) => void;
203
+ };
204
+ sharedState: import("@atlaskit/editor-plugin-accessibility-utils").AccessibilityUtilsPluginState;
205
+ }, undefined>>,
210
206
  import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"media", {
211
207
  pluginConfiguration: any;
212
208
  dependencies: any;
@@ -279,16 +275,6 @@ export declare const DragCornerControlsWithSelection: React.FC<import("react-int
279
275
  insertTableWithSize: (rowsCount: number, colsCount: number, inputMethod?: import("@atlaskit/editor-common/analytics").INPUT_METHOD.PICKER | undefined) => import("@atlaskit/editor-common/types").EditorCommand;
280
276
  };
281
277
  dependencies: [
282
- import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"accessibilityUtils", {
283
- dependencies: [
284
- ];
285
- actions: {
286
- ariaNotify: (message: string) => void;
287
- };
288
- sharedState: {
289
- message: string;
290
- };
291
- }, undefined>>,
292
278
  import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"analytics", {
293
279
  pluginConfiguration: import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions;
294
280
  sharedState: {
@@ -346,6 +332,14 @@ export declare const DragCornerControlsWithSelection: React.FC<import("react-int
346
332
  };
347
333
  sharedState: import("@atlaskit/editor-common/selection").SelectionSharedState;
348
334
  }, import("@atlaskit/editor-plugin-selection/types").SelectionPluginOptions | undefined>,
335
+ import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"accessibilityUtils", {
336
+ dependencies: [
337
+ ];
338
+ actions: {
339
+ ariaNotify: (message: string, ariaLiveElementAttributes?: import("@atlaskit/editor-plugin-accessibility-utils").AriaLiveElementAttributes | undefined) => void;
340
+ };
341
+ sharedState: import("@atlaskit/editor-plugin-accessibility-utils").AccessibilityUtilsPluginState;
342
+ }, undefined>>,
349
343
  import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"media", {
350
344
  pluginConfiguration: any;
351
345
  dependencies: any;
@@ -406,16 +400,6 @@ export declare const DragCornerControlsWithSelection: React.FC<import("react-int
406
400
  } | undefined>>
407
401
  ];
408
402
  }, import("../../../plugin").TablePluginOptions | undefined>,
409
- import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"accessibilityUtils", {
410
- dependencies: [
411
- ];
412
- actions: {
413
- ariaNotify: (message: string) => void;
414
- };
415
- sharedState: {
416
- message: string;
417
- };
418
- }, undefined>>,
419
403
  import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"analytics", {
420
404
  pluginConfiguration: import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions;
421
405
  sharedState: {
@@ -473,6 +457,14 @@ export declare const DragCornerControlsWithSelection: React.FC<import("react-int
473
457
  };
474
458
  sharedState: import("@atlaskit/editor-common/selection").SelectionSharedState;
475
459
  }, import("@atlaskit/editor-plugin-selection/types").SelectionPluginOptions | undefined>,
460
+ import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"accessibilityUtils", {
461
+ dependencies: [
462
+ ];
463
+ actions: {
464
+ ariaNotify: (message: string, ariaLiveElementAttributes?: import("@atlaskit/editor-plugin-accessibility-utils").AriaLiveElementAttributes | undefined) => void;
465
+ };
466
+ sharedState: import("@atlaskit/editor-plugin-accessibility-utils").AccessibilityUtilsPluginState;
467
+ }, undefined>>,
476
468
  import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"media", {
477
469
  pluginConfiguration: any;
478
470
  dependencies: any;
@@ -41,16 +41,6 @@ export declare const TableFloatingControls: ({ editorView, tableRef, tableNode,
41
41
  insertTableWithSize: (rowsCount: number, colsCount: number, inputMethod?: import("@atlaskit/editor-common/analytics").INPUT_METHOD.PICKER | undefined) => import("@atlaskit/editor-common/types").EditorCommand;
42
42
  };
43
43
  dependencies: [
44
- import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"accessibilityUtils", {
45
- dependencies: [
46
- ];
47
- actions: {
48
- ariaNotify: (message: string) => void;
49
- };
50
- sharedState: {
51
- message: string;
52
- };
53
- }, undefined>>,
54
44
  import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"analytics", {
55
45
  pluginConfiguration: import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions;
56
46
  sharedState: {
@@ -108,6 +98,14 @@ export declare const TableFloatingControls: ({ editorView, tableRef, tableNode,
108
98
  };
109
99
  sharedState: import("@atlaskit/editor-common/selection").SelectionSharedState;
110
100
  }, import("@atlaskit/editor-plugin-selection/types").SelectionPluginOptions | undefined>,
101
+ import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"accessibilityUtils", {
102
+ dependencies: [
103
+ ];
104
+ actions: {
105
+ ariaNotify: (message: string, ariaLiveElementAttributes?: import("@atlaskit/editor-plugin-accessibility-utils").AriaLiveElementAttributes | undefined) => void;
106
+ };
107
+ sharedState: import("@atlaskit/editor-plugin-accessibility-utils").AccessibilityUtilsPluginState;
108
+ }, undefined>>,
111
109
  import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"media", {
112
110
  pluginConfiguration: any;
113
111
  dependencies: any;
@@ -168,16 +166,6 @@ export declare const TableFloatingControls: ({ editorView, tableRef, tableNode,
168
166
  } | undefined>>
169
167
  ];
170
168
  }, import("../../plugin").TablePluginOptions | undefined>,
171
- import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"accessibilityUtils", {
172
- dependencies: [
173
- ];
174
- actions: {
175
- ariaNotify: (message: string) => void;
176
- };
177
- sharedState: {
178
- message: string;
179
- };
180
- }, undefined>>,
181
169
  import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"analytics", {
182
170
  pluginConfiguration: import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions;
183
171
  sharedState: {
@@ -235,6 +223,14 @@ export declare const TableFloatingControls: ({ editorView, tableRef, tableNode,
235
223
  };
236
224
  sharedState: import("@atlaskit/editor-common/selection").SelectionSharedState;
237
225
  }, import("@atlaskit/editor-plugin-selection/types").SelectionPluginOptions | undefined>,
226
+ import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"accessibilityUtils", {
227
+ dependencies: [
228
+ ];
229
+ actions: {
230
+ ariaNotify: (message: string, ariaLiveElementAttributes?: import("@atlaskit/editor-plugin-accessibility-utils").AriaLiveElementAttributes | undefined) => void;
231
+ };
232
+ sharedState: import("@atlaskit/editor-plugin-accessibility-utils").AccessibilityUtilsPluginState;
233
+ }, undefined>>,
238
234
  import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"media", {
239
235
  pluginConfiguration: any;
240
236
  dependencies: any;
@@ -1,13 +1,13 @@
1
1
  export { getSelectedColumnIndexes, getSelectedRowIndexes, normalizeSelection, isSelectionUpdated, } from './selection';
2
2
  export { findControlsHoverDecoration, createControlsHoverDecoration, createColumnControlsDecoration, createColumnSelectedDecoration, createCellHoverDecoration, updateDecorations, createResizeHandleDecoration, createColumnInsertLine, createColumnLineResize, createRowInsertLine, } from './decoration';
3
- export { isIsolating, containsHeaderColumn, containsHeaderRow, checkIfHeaderColumnEnabled, checkIfHeaderRowEnabled, checkIfNumberColumnEnabled, getTableWidth, tablesHaveDifferentColumnWidths, tablesHaveDifferentNoOfColumns, isTableNested, anyChildCellMergedAcrossRow, supportedHeaderRow, } from './nodes';
3
+ export { isIsolating, containsHeaderColumn, containsHeaderRow, checkIfHeaderColumnEnabled, checkIfHeaderRowEnabled, checkIfNumberColumnEnabled, getTableWidth, tablesHaveDifferentColumnWidths, tablesHaveDifferentNoOfColumns, tablesHaveDifferentNoOfRows, isTableNested, anyChildCellMergedAcrossRow, supportedHeaderRow, } from './nodes';
4
4
  export { unwrapContentFromTable, removeTableFromFirstChild, removeTableFromLastChild, transformSliceToRemoveOpenTable, transformSliceToCorrectEmptyTableCells, transformSliceToFixHardBreakProblemOnCopyFromCell, } from './paste';
5
5
  export { isCell, isCornerButton, isInsertRowButton, isColumnControlsDecorations, isTableControlsButton, isTableContainerOrWrapper, isRowControlsButton, isDragRowControlsButton, isDragColumnFloatingInsertDot, isDragRowFloatingInsertDot, isDragCornerButton, getColumnOrRowIndex, getMousePositionHorizontalRelativeByElement, getMousePositionVerticalRelativeByElement, isResizeHandleDecoration, hasResizeHandler, findNearestCellIndexToPoint, } from './dom';
6
6
  export { convertHTMLCellIndexToColumnIndex, getColumnsWidths, isColumnDeleteButtonVisible, getColumnDeleteButtonParams, getColumnClassNames, getColumnIndexMappedToColumnIndexInFirstRow, } from './column-controls';
7
7
  export { getRowHeights, isRowDeleteButtonVisible, getRowDeleteButtonParams, getRowsParams, getRowClassNames, copyPreviousRow, } from './row-controls';
8
8
  export type { RowParams } from './row-controls';
9
9
  export { getSelectedTableInfo, getSelectedCellInfo } from './analytics';
10
- export { getMergedCellsPositions } from './table';
10
+ export { getMergedCellsPositions, getAssistiveMessage } from './table';
11
11
  export { updatePluginStateDecorations } from './update-plugin-state-decorations';
12
12
  export { hasMergedCellsInColumn, hasMergedCellsInRow, hasMergedCellsInBetween, hasMergedCellsInSelection, findDuplicatePosition, checkEdgeHasMergedCells, } from './merged-cells';
13
13
  export { createTableWithWidth } from './create';
@@ -9,6 +9,7 @@ export declare const checkIfNumberColumnEnabled: (selection: Selection) => boole
9
9
  export declare const getTableWidth: (node: PmNode) => number;
10
10
  export declare const tablesHaveDifferentColumnWidths: (currentTable: PmNode, previousTable: PmNode) => boolean;
11
11
  export declare const tablesHaveDifferentNoOfColumns: (currentTable: PmNode, previousTable: PmNode) => boolean;
12
+ export declare const tablesHaveDifferentNoOfRows: (currentTable: PmNode, previousTable: PmNode) => boolean;
12
13
  export declare const isTableNested: (state: EditorState, tablePos?: number) => boolean;
13
14
  export declare const anyChildCellMergedAcrossRow: (node: PmNode) => boolean;
14
15
  /**
@@ -1,4 +1,7 @@
1
+ import type { IntlShape } from 'react-intl-next';
2
+ import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
1
3
  import type { Transaction } from '@atlaskit/editor-prosemirror/state';
2
4
  import type { Rect } from '@atlaskit/editor-tables/table-map';
3
5
  export declare const getMergedCellsPositions: (tr: Transaction) => number[];
4
6
  export declare const colsToRect: (cols: Array<number>, noOfRows: number) => Rect;
7
+ export declare const getAssistiveMessage: (prevTableNode: PmNode, currentTableNode: PmNode, intl: IntlShape) => string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "7.9.0",
3
+ "version": "7.10.1",
4
4
  "description": "Table plugin for the @atlaskit/editor",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -147,6 +147,9 @@
147
147
  },
148
148
  "platform.editor.table.colum-resizing-improvements": {
149
149
  "type": "boolean"
150
+ },
151
+ "platform.editor.explicit-html-element-check": {
152
+ "type": "boolean"
150
153
  }
151
154
  }
152
155
  }
@@ -6,6 +6,7 @@ import type {
6
6
  Command,
7
7
  GetEditorContainerWidth,
8
8
  } from '@atlaskit/editor-common/types';
9
+ import type { AriaLiveElementAttributes } from '@atlaskit/editor-plugin-accessibility-utils';
9
10
  import type { Transaction } from '@atlaskit/editor-prosemirror/state';
10
11
  import { TableMap } from '@atlaskit/editor-tables';
11
12
  import type { CellAttributes, Direction } from '@atlaskit/editor-tables/types';
@@ -129,7 +130,10 @@ export const initiateKeyboardColumnResizing =
129
130
  ariaNotify,
130
131
  getIntl,
131
132
  }: {
132
- ariaNotify?: (message: string) => void;
133
+ ariaNotify?: (
134
+ message: string,
135
+ ariaLiveElementAttributes?: AriaLiveElementAttributes,
136
+ ) => void;
133
137
  getIntl?: () => IntlShape;
134
138
  }): Command =>
135
139
  (state, dispatch, view) => {
@@ -144,7 +148,9 @@ export const initiateKeyboardColumnResizing =
144
148
  const cell = findCellClosestToPos(selection.$from);
145
149
 
146
150
  if (ariaNotify && getIntl) {
147
- ariaNotify(getIntl().formatMessage(messages.startedColumnResize));
151
+ ariaNotify(getIntl().formatMessage(messages.startedColumnResize), {
152
+ priority: 'important',
153
+ });
148
154
  }
149
155
 
150
156
  if (selectionRect && cell && view) {
@@ -164,7 +170,10 @@ export const activateNextResizeArea =
164
170
  getIntl,
165
171
  }: {
166
172
  direction: Direction;
167
- ariaNotify?: (message: string) => void;
173
+ ariaNotify?: (
174
+ message: string,
175
+ ariaLiveElementAttributes?: AriaLiveElementAttributes,
176
+ ) => void;
168
177
  getIntl?: () => IntlShape;
169
178
  }): Command =>
170
179
  (state, dispatch, view) => {
@@ -210,6 +219,7 @@ export const activateNextResizeArea =
210
219
  getIntl().formatMessage(messages.focusedOtherResize, {
211
220
  direction: 'right',
212
221
  }),
222
+ { priority: 'important' },
213
223
  );
214
224
  }
215
225
 
@@ -218,6 +228,7 @@ export const activateNextResizeArea =
218
228
  getIntl().formatMessage(messages.focusedOtherResize, {
219
229
  direction: 'left',
220
230
  }),
231
+ { priority: 'important' },
221
232
  );
222
233
  }
223
234
  }
@@ -275,7 +286,10 @@ export const changeColumnWidthByStep =
275
286
  stepSize: number;
276
287
  getEditorContainerWidth: GetEditorContainerWidth;
277
288
  isTableScalingEnabled: boolean;
278
- ariaNotify?: (message: string) => void;
289
+ ariaNotify?: (
290
+ message: string,
291
+ ariaLiveElementAttributes?: AriaLiveElementAttributes,
292
+ ) => void;
279
293
  getIntl?: () => IntlShape;
280
294
  originalTr?: Transaction;
281
295
  }): Command =>
@@ -305,11 +319,19 @@ export const changeColumnWidthByStep =
305
319
  ($cell.nodeAfter ? $cell.nodeAfter.attrs.colspan : 1) -
306
320
  1;
307
321
 
308
- let dom: HTMLTableElement = domAtPos(tableStartPosition)
309
- .node as HTMLTableElement;
322
+ let dom: HTMLTableElement | null = null;
323
+ if (getBooleanFF('platform.editor.explicit-html-element-check')) {
324
+ const domAtPosition = domAtPos(tableStartPosition);
325
+ dom =
326
+ domAtPosition.node instanceof HTMLTableElement
327
+ ? domAtPosition.node
328
+ : null;
329
+ } else {
330
+ dom = domAtPos(tableStartPosition).node as HTMLTableElement;
331
+ }
310
332
 
311
333
  if (dom && dom.nodeName !== 'TABLE') {
312
- dom = dom.closest('table') as HTMLTableElement;
334
+ dom = dom.closest('table');
313
335
  }
314
336
 
315
337
  const cellAttrs = cell?.node.attrs;
@@ -381,10 +403,14 @@ export const changeColumnWidthByStep =
381
403
 
382
404
  if (newResizeState.cols.length === colIndex + 1) {
383
405
  if (newResizeState.overflow === true) {
384
- ariaNotify(getIntl().formatMessage(messages.columnResizeLast));
406
+ ariaNotify(getIntl().formatMessage(messages.columnResizeLast), {
407
+ priority: 'important',
408
+ });
385
409
  }
386
410
  if (newResizeState.overflow === false) {
387
- ariaNotify(getIntl().formatMessage(messages.columnResizeOverflow));
411
+ ariaNotify(getIntl().formatMessage(messages.columnResizeOverflow), {
412
+ priority: 'important',
413
+ });
388
414
  }
389
415
  }
390
416
  }
@@ -398,7 +424,10 @@ export const stopKeyboardColumnResizing =
398
424
  getIntl,
399
425
  originalTr,
400
426
  }: {
401
- ariaNotify?: (message: string) => void;
427
+ ariaNotify?: (
428
+ message: string,
429
+ ariaLiveElementAttributes?: AriaLiveElementAttributes,
430
+ ) => void;
402
431
  getIntl?: () => IntlShape;
403
432
  originalTr?: Transaction;
404
433
  }): Command =>
@@ -439,7 +468,9 @@ export const stopKeyboardColumnResizing =
439
468
  () => customTr.setMeta('scrollIntoView', false),
440
469
  )(state, fakeDispatch);
441
470
  if (ariaNotify && getIntl) {
442
- ariaNotify(getIntl().formatMessage(messages.columnResizeStop));
471
+ ariaNotify(getIntl().formatMessage(messages.columnResizeStop), {
472
+ priority: 'important',
473
+ });
443
474
  }
444
475
 
445
476
  if (dispatch) {
@@ -4,6 +4,8 @@ import React from 'react';
4
4
  import classnames from 'classnames';
5
5
  import memoizeOne from 'memoize-one';
6
6
  import rafSchedule from 'raf-schd';
7
+ import type { IntlShape } from 'react-intl-next';
8
+ import { injectIntl } from 'react-intl-next';
7
9
 
8
10
  import type { TableColumnOrdering } from '@atlaskit/custom-steps';
9
11
  import {
@@ -61,9 +63,11 @@ import TableFloatingColumnControls from '../ui/TableFloatingColumnControls';
61
63
  import TableFloatingControls from '../ui/TableFloatingControls';
62
64
  import {
63
65
  containsHeaderRow,
66
+ getAssistiveMessage,
64
67
  isTableNested,
65
68
  tablesHaveDifferentColumnWidths,
66
69
  tablesHaveDifferentNoOfColumns,
70
+ tablesHaveDifferentNoOfRows,
67
71
  } from '../utils';
68
72
 
69
73
  import { ExternalDropTargets } from './ExternalDropTargets';
@@ -106,6 +110,7 @@ export interface ComponentProps {
106
110
  getEditorFeatureFlags: GetEditorFeatureFlags;
107
111
  dispatchAnalyticsEvent: DispatchAnalyticsEvent;
108
112
  pluginInjectionApi?: PluginInjectionAPI;
113
+ intl: IntlShape;
109
114
 
110
115
  // marking props as option to ensure backward compatibility when platform.editor.table.use-shared-state-hook disabled
111
116
  isInDanger?: boolean;
@@ -442,6 +447,21 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
442
447
  }
443
448
 
444
449
  const currentTable = getNode();
450
+ const previousTable = this.node;
451
+ const isNoOfColumnsChanged = tablesHaveDifferentNoOfColumns(
452
+ currentTable,
453
+ previousTable,
454
+ );
455
+ const isNoOfRowsChanged = tablesHaveDifferentNoOfRows(
456
+ currentTable,
457
+ previousTable,
458
+ );
459
+ if (isNoOfColumnsChanged || isNoOfRowsChanged) {
460
+ this.props.pluginInjectionApi?.accessibilityUtils?.actions.ariaNotify(
461
+ getAssistiveMessage(previousTable, currentTable, this.props.intl),
462
+ { priority: 'important' },
463
+ );
464
+ }
445
465
  if (currentTable.attrs.__autoSize) {
446
466
  // Wait for next tick to handle auto sizing, gives the browser time to do layout calc etc.
447
467
  this.handleAutoSizeDebounced();
@@ -451,11 +471,6 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
451
471
  else if (allowColumnResizing && this.table && !isMediaFullscreen) {
452
472
  // If col widths (e.g. via collab) or number of columns (e.g. delete a column) have changed,
453
473
  // re-draw colgroup.
454
- const previousTable = this.node;
455
- const isNoOfColumnsChanged = tablesHaveDifferentNoOfColumns(
456
- currentTable,
457
- previousTable,
458
- );
459
474
  if (
460
475
  tablesHaveDifferentColumnWidths(currentTable, previousTable) ||
461
476
  isNoOfColumnsChanged
@@ -1044,4 +1059,4 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
1044
1059
  private handleWindowResizeDebounced = rafSchedule(this.handleWindowResize);
1045
1060
  }
1046
1061
 
1047
- export default TableComponent;
1062
+ export default injectIntl(TableComponent);
@@ -494,8 +494,8 @@ export default class TableRow
494
494
 
495
495
  const { wrapper } = tree;
496
496
 
497
- const tableContainer = wrapper.parentElement!;
498
- const tableContentWrapper = tableContainer.parentElement;
497
+ const tableContainer = wrapper.parentElement;
498
+ const tableContentWrapper = tableContainer?.parentElement;
499
499
 
500
500
  const layoutContainer =
501
501
  tableContentWrapper && tableContentWrapper.parentElement;
package/src/plugin.tsx CHANGED
@@ -131,12 +131,12 @@ export type TablePlugin = NextEditorPlugin<
131
131
  ) => EditorCommand;
132
132
  };
133
133
  dependencies: [
134
- OptionalPlugin<AccessibilityUtilsPlugin>,
135
134
  AnalyticsPlugin,
136
135
  ContentInsertionPlugin,
137
136
  WidthPlugin,
138
137
  GuidelinePlugin,
139
138
  SelectionPlugin,
139
+ OptionalPlugin<AccessibilityUtilsPlugin>,
140
140
  OptionalPlugin<MediaPlugin>,
141
141
  OptionalPlugin<EditorViewModePlugin>,
142
142
  ];
@@ -69,22 +69,22 @@ export const generateColgroup = (table: PmNode, tableRef?: HTMLElement) => {
69
69
  };
70
70
 
71
71
  export const insertColgroupFromNode = (
72
- tableRef: HTMLTableElement,
72
+ tableRef: HTMLTableElement | null,
73
73
  table: PmNode,
74
74
  isTableScalingEnabled = false,
75
75
  shouldRemove = true,
76
76
  ): HTMLCollection => {
77
- let colgroup = tableRef.querySelector('colgroup') as HTMLElement;
77
+ let colgroup = tableRef?.querySelector('colgroup') as HTMLElement;
78
78
  if (colgroup && shouldRemove) {
79
- tableRef.removeChild(colgroup);
79
+ tableRef?.removeChild(colgroup);
80
80
  }
81
81
 
82
82
  colgroup = renderColgroupFromNode(
83
83
  table,
84
- isTableScalingEnabled ? tableRef : undefined,
84
+ isTableScalingEnabled ? tableRef ?? undefined : undefined,
85
85
  );
86
86
  if (shouldRemove) {
87
- tableRef.insertBefore(colgroup, tableRef.firstChild);
87
+ tableRef?.insertBefore(colgroup, tableRef?.firstChild);
88
88
  }
89
89
 
90
90
  return colgroup.children;
@@ -158,10 +158,10 @@ export const getTableContainerElementWidth = (table: PMNode) => {
158
158
 
159
159
  export const getTableScalingPercent = (
160
160
  table: PMNode,
161
- tableRef: HTMLElement,
161
+ tableRef: HTMLElement | null,
162
162
  ) => {
163
163
  const tableWidth = getTableContainerElementWidth(table);
164
- let renderWidth = tableRef.parentElement?.clientWidth || tableWidth;
164
+ let renderWidth = tableRef?.parentElement?.clientWidth || tableWidth;
165
165
  // minus 1 here to avoid any 1px scroll in Firefox
166
166
  let scalePercent = (renderWidth - 1) / tableWidth;
167
167
  scalePercent = Math.max(scalePercent, 1 - MAX_SCALING_PERCENT);
@@ -13,7 +13,7 @@ export const resizeColumn = (
13
13
  resizeState: ResizeState,
14
14
  colIndex: number,
15
15
  amount: number,
16
- tableRef: HTMLElement,
16
+ tableRef: HTMLElement | null,
17
17
  tableNode: PmNode,
18
18
  selectedColumns?: number[],
19
19
  isTableScalingEnabled = false,
@@ -25,7 +25,7 @@ export const resizeColumn = (
25
25
  if (getBooleanFF('platform.editor.table.colum-resizing-improvements')) {
26
26
  // when table initially not overflow, but enter overflow, we need to calculate the resize amount by two part, before and after overflow, before overflow should be double, after should not be double.
27
27
  const tableWidth = tableRef?.clientWidth;
28
- const tableContainerWidth = tableRef.closest('.resizer-item')?.clientWidth;
28
+ const tableContainerWidth = tableRef?.closest('.resizer-item')?.clientWidth;
29
29
 
30
30
  const isOverflowed = !!(
31
31
  tableWidth &&
@@ -92,18 +92,20 @@ export const resizeColumn = (
92
92
 
93
93
  const updateTable = (
94
94
  resizeAmount: number,
95
- tableRef: HTMLElement,
95
+ tableRef: HTMLElement | null,
96
96
  tableNode: PmNode,
97
97
  ) => {
98
98
  const currentWidth = getTableContainerElementWidth(tableNode);
99
- const resizingContainer = tableRef.closest(
99
+ const resizingContainer = tableRef?.closest(
100
100
  `.${ClassName.TABLE_RESIZER_CONTAINER}`,
101
101
  );
102
102
  const resizingItem = resizingContainer?.querySelector('.resizer-item');
103
103
 
104
104
  if (resizingContainer && resizingItem) {
105
105
  const newWidth = `${currentWidth + resizeAmount}px`;
106
- tableRef.style.width = newWidth;
106
+ if (tableRef) {
107
+ tableRef.style.width = newWidth;
108
+ }
107
109
  (resizingContainer as HTMLElement).style.width = newWidth;
108
110
  (resizingItem as HTMLElement).style.width = newWidth;
109
111
  }