@atlaskit/editor-plugin-table 7.9.0 → 7.10.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 (41) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/cjs/commands/column-resize.js +18 -6
  3. package/dist/cjs/nodeviews/TableComponent.js +11 -3
  4. package/dist/cjs/utils/index.js +12 -0
  5. package/dist/cjs/utils/nodes.js +6 -1
  6. package/dist/cjs/utils/table.js +34 -1
  7. package/dist/es2019/commands/column-resize.js +18 -6
  8. package/dist/es2019/nodeviews/TableComponent.js +12 -4
  9. package/dist/es2019/utils/index.js +2 -2
  10. package/dist/es2019/utils/nodes.js +5 -0
  11. package/dist/es2019/utils/table.js +36 -1
  12. package/dist/esm/commands/column-resize.js +18 -6
  13. package/dist/esm/nodeviews/TableComponent.js +12 -4
  14. package/dist/esm/utils/index.js +2 -2
  15. package/dist/esm/utils/nodes.js +5 -0
  16. package/dist/esm/utils/table.js +33 -0
  17. package/dist/types/commands/column-resize.d.ts +5 -4
  18. package/dist/types/nodeviews/TableComponent.d.ts +6 -54
  19. package/dist/types/plugin.d.ts +1 -1
  20. package/dist/types/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +16 -20
  21. package/dist/types/ui/TableFloatingControls/CornerControls/DragCornerControls.d.ts +32 -40
  22. package/dist/types/ui/TableFloatingControls/index.d.ts +16 -20
  23. package/dist/types/utils/index.d.ts +2 -2
  24. package/dist/types/utils/nodes.d.ts +1 -0
  25. package/dist/types/utils/table.d.ts +3 -0
  26. package/dist/types-ts4.5/commands/column-resize.d.ts +5 -4
  27. package/dist/types-ts4.5/nodeviews/TableComponent.d.ts +6 -54
  28. package/dist/types-ts4.5/plugin.d.ts +1 -1
  29. package/dist/types-ts4.5/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +16 -20
  30. package/dist/types-ts4.5/ui/TableFloatingControls/CornerControls/DragCornerControls.d.ts +32 -40
  31. package/dist/types-ts4.5/ui/TableFloatingControls/index.d.ts +16 -20
  32. package/dist/types-ts4.5/utils/index.d.ts +2 -2
  33. package/dist/types-ts4.5/utils/nodes.d.ts +1 -0
  34. package/dist/types-ts4.5/utils/table.d.ts +3 -0
  35. package/package.json +1 -1
  36. package/src/commands/column-resize.ts +31 -8
  37. package/src/nodeviews/TableComponent.tsx +21 -6
  38. package/src/plugin.tsx +1 -1
  39. package/src/utils/index.ts +2 -1
  40. package/src/utils/nodes.ts +10 -0
  41. package/src/utils/table.ts +36 -0
@@ -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.0",
4
4
  "description": "Table plugin for the @atlaskit/editor",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -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 =>
@@ -381,10 +395,14 @@ export const changeColumnWidthByStep =
381
395
 
382
396
  if (newResizeState.cols.length === colIndex + 1) {
383
397
  if (newResizeState.overflow === true) {
384
- ariaNotify(getIntl().formatMessage(messages.columnResizeLast));
398
+ ariaNotify(getIntl().formatMessage(messages.columnResizeLast), {
399
+ priority: 'important',
400
+ });
385
401
  }
386
402
  if (newResizeState.overflow === false) {
387
- ariaNotify(getIntl().formatMessage(messages.columnResizeOverflow));
403
+ ariaNotify(getIntl().formatMessage(messages.columnResizeOverflow), {
404
+ priority: 'important',
405
+ });
388
406
  }
389
407
  }
390
408
  }
@@ -398,7 +416,10 @@ export const stopKeyboardColumnResizing =
398
416
  getIntl,
399
417
  originalTr,
400
418
  }: {
401
- ariaNotify?: (message: string) => void;
419
+ ariaNotify?: (
420
+ message: string,
421
+ ariaLiveElementAttributes?: AriaLiveElementAttributes,
422
+ ) => void;
402
423
  getIntl?: () => IntlShape;
403
424
  originalTr?: Transaction;
404
425
  }): Command =>
@@ -439,7 +460,9 @@ export const stopKeyboardColumnResizing =
439
460
  () => customTr.setMeta('scrollIntoView', false),
440
461
  )(state, fakeDispatch);
441
462
  if (ariaNotify && getIntl) {
442
- ariaNotify(getIntl().formatMessage(messages.columnResizeStop));
463
+ ariaNotify(getIntl().formatMessage(messages.columnResizeStop), {
464
+ priority: 'important',
465
+ });
443
466
  }
444
467
 
445
468
  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);
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
  ];
@@ -26,6 +26,7 @@ export {
26
26
  getTableWidth,
27
27
  tablesHaveDifferentColumnWidths,
28
28
  tablesHaveDifferentNoOfColumns,
29
+ tablesHaveDifferentNoOfRows,
29
30
  isTableNested,
30
31
  anyChildCellMergedAcrossRow,
31
32
  supportedHeaderRow,
@@ -75,7 +76,7 @@ export {
75
76
  } from './row-controls';
76
77
  export type { RowParams } from './row-controls';
77
78
  export { getSelectedTableInfo, getSelectedCellInfo } from './analytics';
78
- export { getMergedCellsPositions } from './table';
79
+ export { getMergedCellsPositions, getAssistiveMessage } from './table';
79
80
  export { updatePluginStateDecorations } from './update-plugin-state-decorations';
80
81
  export {
81
82
  hasMergedCellsInColumn,
@@ -94,6 +94,16 @@ export const tablesHaveDifferentNoOfColumns = (
94
94
  return prevMap.width !== currentMap.width;
95
95
  };
96
96
 
97
+ export const tablesHaveDifferentNoOfRows = (
98
+ currentTable: PmNode,
99
+ previousTable: PmNode,
100
+ ): boolean => {
101
+ const prevMap = TableMap.get(previousTable);
102
+ const currentMap = TableMap.get(currentTable);
103
+
104
+ return prevMap.height !== currentMap.height;
105
+ };
106
+
97
107
  function filterNearSelection<T, U>(
98
108
  selection: Selection,
99
109
  findNode: (selection: Selection) => { pos: number; node: PmNode } | undefined,
@@ -1,3 +1,7 @@
1
+ import type { IntlShape } from 'react-intl-next';
2
+
3
+ import { tableMessages as messages } from '@atlaskit/editor-common/messages';
4
+ import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
1
5
  import type { Transaction } from '@atlaskit/editor-prosemirror/state';
2
6
  import type { Rect } from '@atlaskit/editor-tables/table-map';
3
7
  import { TableMap } from '@atlaskit/editor-tables/table-map';
@@ -30,3 +34,35 @@ export const colsToRect = (cols: Array<number>, noOfRows: number): Rect => ({
30
34
  top: 0,
31
35
  bottom: noOfRows,
32
36
  });
37
+
38
+ export const getAssistiveMessage = (
39
+ prevTableNode: PmNode,
40
+ currentTableNode: PmNode,
41
+ intl: IntlShape,
42
+ ) => {
43
+ const { formatMessage } = intl;
44
+ const prevTableMap = TableMap.get(prevTableNode);
45
+ const currentTableMap = TableMap.get(currentTableNode);
46
+
47
+ if (currentTableMap.width !== prevTableMap.width) {
48
+ const diff = Math.abs(currentTableMap.width - prevTableMap.width);
49
+ if (currentTableMap.width > prevTableMap.width) {
50
+ return formatMessage(messages.columnsAreInserted, { count: diff });
51
+ }
52
+ if (currentTableMap.width < prevTableMap.width) {
53
+ return formatMessage(messages.columnsAreRemoved, { count: diff });
54
+ }
55
+ }
56
+
57
+ if (currentTableMap.height !== prevTableMap.height) {
58
+ const diff = Math.abs(currentTableMap.height - prevTableMap.height);
59
+ if (currentTableMap.height > prevTableMap.height) {
60
+ return formatMessage(messages.rowsAreInserted, { count: diff });
61
+ }
62
+ if (currentTableMap.height < prevTableMap.height) {
63
+ return formatMessage(messages.rowsAreRemoved, { count: diff });
64
+ }
65
+ }
66
+
67
+ return '';
68
+ };