@atlaskit/editor-plugin-table 7.19.11 → 7.20.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 (75) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/dist/cjs/commands/column-resize.js +1 -1
  3. package/dist/cjs/commands/selection.js +25 -4
  4. package/dist/cjs/nodeviews/table.js +2 -4
  5. package/dist/cjs/plugin.js +59 -56
  6. package/dist/cjs/pm-plugins/drag-and-drop/commands-with-analytics.js +23 -9
  7. package/dist/cjs/pm-plugins/keymap.js +6 -6
  8. package/dist/cjs/pm-plugins/main.js +1 -1
  9. package/dist/cjs/pm-plugins/table-selection-keymap.js +6 -3
  10. package/dist/cjs/toolbar.js +8 -5
  11. package/dist/cjs/ui/FloatingDragMenu/DragMenu.js +3 -2
  12. package/dist/cjs/ui/FloatingDragMenu/index.js +5 -3
  13. package/dist/cjs/ui/TableFloatingControls/index.js +8 -2
  14. package/dist/cjs/utils/drag-menu.js +5 -1
  15. package/dist/es2019/commands/column-resize.js +2 -2
  16. package/dist/es2019/commands/selection.js +25 -4
  17. package/dist/es2019/nodeviews/table.js +3 -5
  18. package/dist/es2019/plugin.js +11 -7
  19. package/dist/es2019/pm-plugins/drag-and-drop/commands-with-analytics.js +18 -3
  20. package/dist/es2019/pm-plugins/keymap.js +7 -7
  21. package/dist/es2019/pm-plugins/main.js +2 -2
  22. package/dist/es2019/pm-plugins/table-selection-keymap.js +6 -3
  23. package/dist/es2019/toolbar.js +8 -5
  24. package/dist/es2019/ui/FloatingDragMenu/DragMenu.js +3 -2
  25. package/dist/es2019/ui/FloatingDragMenu/index.js +6 -4
  26. package/dist/es2019/ui/TableFloatingControls/index.js +9 -3
  27. package/dist/es2019/utils/drag-menu.js +6 -2
  28. package/dist/esm/commands/column-resize.js +2 -2
  29. package/dist/esm/commands/selection.js +25 -4
  30. package/dist/esm/nodeviews/table.js +3 -5
  31. package/dist/esm/plugin.js +60 -57
  32. package/dist/esm/pm-plugins/drag-and-drop/commands-with-analytics.js +23 -9
  33. package/dist/esm/pm-plugins/keymap.js +7 -7
  34. package/dist/esm/pm-plugins/main.js +2 -2
  35. package/dist/esm/pm-plugins/table-selection-keymap.js +6 -3
  36. package/dist/esm/toolbar.js +8 -5
  37. package/dist/esm/ui/FloatingDragMenu/DragMenu.js +3 -2
  38. package/dist/esm/ui/FloatingDragMenu/index.js +6 -4
  39. package/dist/esm/ui/TableFloatingControls/index.js +9 -3
  40. package/dist/esm/utils/drag-menu.js +5 -1
  41. package/dist/types/commands/selection.d.ts +4 -2
  42. package/dist/types/nodeviews/table.d.ts +1 -2
  43. package/dist/types/nodeviews/types.d.ts +1 -3
  44. package/dist/types/pm-plugins/drag-and-drop/commands-with-analytics.d.ts +4 -2
  45. package/dist/types/pm-plugins/main.d.ts +1 -2
  46. package/dist/types/pm-plugins/table-selection-keymap.d.ts +3 -3
  47. package/dist/types/toolbar.d.ts +2 -2
  48. package/dist/types/ui/FloatingDragMenu/DragMenu.d.ts +3 -1
  49. package/dist/types/ui/FloatingDragMenu/index.d.ts +3 -1
  50. package/dist/types/utils/drag-menu.d.ts +2 -1
  51. package/dist/types-ts4.5/commands/selection.d.ts +4 -2
  52. package/dist/types-ts4.5/nodeviews/table.d.ts +1 -2
  53. package/dist/types-ts4.5/nodeviews/types.d.ts +1 -3
  54. package/dist/types-ts4.5/pm-plugins/drag-and-drop/commands-with-analytics.d.ts +4 -2
  55. package/dist/types-ts4.5/pm-plugins/main.d.ts +1 -2
  56. package/dist/types-ts4.5/pm-plugins/table-selection-keymap.d.ts +3 -3
  57. package/dist/types-ts4.5/toolbar.d.ts +2 -2
  58. package/dist/types-ts4.5/ui/FloatingDragMenu/DragMenu.d.ts +3 -1
  59. package/dist/types-ts4.5/ui/FloatingDragMenu/index.d.ts +3 -1
  60. package/dist/types-ts4.5/utils/drag-menu.d.ts +2 -1
  61. package/package.json +8 -5
  62. package/src/commands/column-resize.ts +2 -2
  63. package/src/commands/selection.ts +49 -4
  64. package/src/nodeviews/table.tsx +3 -10
  65. package/src/nodeviews/types.ts +1 -3
  66. package/src/plugin.tsx +8 -7
  67. package/src/pm-plugins/drag-and-drop/commands-with-analytics.ts +43 -3
  68. package/src/pm-plugins/keymap.ts +23 -7
  69. package/src/pm-plugins/main.ts +3 -4
  70. package/src/pm-plugins/table-selection-keymap.ts +18 -6
  71. package/src/toolbar.tsx +7 -1
  72. package/src/ui/FloatingDragMenu/DragMenu.tsx +7 -0
  73. package/src/ui/FloatingDragMenu/index.tsx +9 -2
  74. package/src/ui/TableFloatingControls/index.tsx +12 -4
  75. package/src/utils/drag-menu.ts +8 -1
@@ -5,7 +5,6 @@ import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
5
5
  import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
6
6
  import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
7
7
  import { type PortalProviderAPI } from '@atlaskit/editor-common/portal';
8
- import type { LegacyPortalProviderAPI } from '@atlaskit/editor-common/portal-provider';
9
8
  import ReactNodeView from '@atlaskit/editor-common/react-node-view';
10
9
  import type {
11
10
  GetEditorContainerWidth,
@@ -20,7 +19,7 @@ import type { EditorState, PluginKey } from '@atlaskit/editor-prosemirror/state'
20
19
  import type { EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
21
20
  import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
22
21
  import { TableMap } from '@atlaskit/editor-tables/table-map';
23
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
22
+ import { fg } from '@atlaskit/platform-feature-flags';
24
23
 
25
24
  import { pluginConfig as getPluginConfig } from '../create-plugin-config';
26
25
  import { pluginKey as tableDragAndDropPluginKey } from '../pm-plugins/drag-and-drop';
@@ -102,10 +101,6 @@ export default class TableView extends ReactNodeView<Props> {
102
101
  props.portalProviderAPI,
103
102
  props.eventDispatcher,
104
103
  props,
105
- undefined,
106
- undefined,
107
- undefined,
108
- props.hasIntlContext,
109
104
  );
110
105
  this.getPos = props.getPos;
111
106
  this.eventDispatcher = props.eventDispatcher;
@@ -183,7 +178,7 @@ export default class TableView extends ReactNodeView<Props> {
183
178
  };
184
179
 
185
180
  render(props: Props, forwardRef: ForwardRef) {
186
- if (getBooleanFF('platform.editor.table.use-shared-state-hook')) {
181
+ if (fg('platform.editor.table.use-shared-state-hook')) {
187
182
  return (
188
183
  <TableComponentWithSharedState
189
184
  forwardRef={forwardRef}
@@ -358,7 +353,7 @@ export const createTableView = (
358
353
  node: PmNode,
359
354
  view: EditorView,
360
355
  getPos: getPosHandler,
361
- portalProviderAPI: LegacyPortalProviderAPI | PortalProviderAPI,
356
+ portalProviderAPI: PortalProviderAPI,
362
357
  eventDispatcher: EventDispatcher,
363
358
  getEditorContainerWidth: GetEditorContainerWidth,
364
359
  getEditorFeatureFlags: GetEditorFeatureFlags,
@@ -375,7 +370,6 @@ export const createTableView = (
375
370
  isTableScalingEnabled, // same as options.isTableScalingEnabled
376
371
  } = getPluginState(view.state);
377
372
  const { allowColumnResizing, allowControls } = getPluginConfig(pluginConfig);
378
- const hasIntlContext = true;
379
373
 
380
374
  return new TableView({
381
375
  node,
@@ -396,7 +390,6 @@ export const createTableView = (
396
390
  getEditorContainerWidth,
397
391
  getEditorFeatureFlags,
398
392
  dispatchAnalyticsEvent,
399
- hasIntlContext,
400
393
  pluginInjectionApi,
401
394
  }).init();
402
395
  };
@@ -1,7 +1,6 @@
1
1
  import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
2
2
  import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
3
3
  import { type PortalProviderAPI } from '@atlaskit/editor-common/portal';
4
- import type { LegacyPortalProviderAPI } from '@atlaskit/editor-common/portal-provider';
5
4
  import type { GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
6
5
  import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
7
6
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
@@ -23,13 +22,12 @@ export interface Props {
23
22
  allowColumnResizing?: boolean;
24
23
  allowControls?: boolean;
25
24
  cellMinWidth?: number;
26
- portalProviderAPI: LegacyPortalProviderAPI | PortalProviderAPI;
25
+ portalProviderAPI: PortalProviderAPI;
27
26
  eventDispatcher: EventDispatcher;
28
27
  getPos: () => number | undefined;
29
28
  options?: TableOptions;
30
29
  getEditorContainerWidth: GetEditorContainerWidth;
31
30
  getEditorFeatureFlags: GetEditorFeatureFlags;
32
31
  dispatchAnalyticsEvent: DispatchAnalyticsEvent;
33
- hasIntlContext: boolean;
34
32
  pluginInjectionApi?: PluginInjectionAPI;
35
33
  }
package/src/plugin.tsx CHANGED
@@ -38,7 +38,7 @@ import type { Transaction } from '@atlaskit/editor-prosemirror/state';
38
38
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
39
39
  import { akEditorFloatingPanelZIndex } from '@atlaskit/editor-shared-styles';
40
40
  import { tableEditing } from '@atlaskit/editor-tables/pm-plugins';
41
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
41
+ import { fg } from '@atlaskit/platform-feature-flags';
42
42
 
43
43
  import { insertTableWithSize } from './commands/insert';
44
44
  import { pluginConfig } from './create-plugin-config';
@@ -155,13 +155,14 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
155
155
  );
156
156
  };
157
157
  const editorAnalyticsAPI = api?.analytics?.actions;
158
+ const ariaNotifyPlugin = api?.accessibilityUtils?.actions.ariaNotify;
158
159
 
159
160
  const isTableFixedColumnWidthsOptionEnabled =
160
161
  options?.getEditorFeatureFlags?.().tableWithFixedColumnWidthsOption || false;
161
162
  const shouldUseIncreasedScalingPercent =
162
163
  options?.isTableScalingEnabled &&
163
164
  isTableFixedColumnWidthsOptionEnabled &&
164
- getBooleanFF('platform.editor.table.use-increased-scaling-percent');
165
+ fg('platform.editor.table.use-increased-scaling-percent');
165
166
 
166
167
  const isCellBackgroundDuplicated =
167
168
  options?.getEditorFeatureFlags?.().tableDuplicateCellColouring || false;
@@ -353,7 +354,7 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
353
354
  },
354
355
  {
355
356
  name: 'tableSelectionKeymap',
356
- plugin: () => tableSelectionKeymapPlugin(api?.selection),
357
+ plugin: ({ getIntl }) => tableSelectionKeymapPlugin(api, getIntl),
357
358
  },
358
359
  {
359
360
  name: 'tableEditing',
@@ -399,8 +400,7 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
399
400
  {
400
401
  name: 'tableViewModeSort',
401
402
  plugin: () => {
402
- return getBooleanFF('platform.editor.table.live-pages-sorting_4malx') &&
403
- api?.editorViewMode
403
+ return api?.editorViewMode && fg('platform.editor.table.live-pages-sorting_4malx')
404
404
  ? createViewModeSortPlugin(api.editorViewMode)
405
405
  : undefined;
406
406
  },
@@ -530,8 +530,8 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
530
530
  <>
531
531
  {targetCellPosition &&
532
532
  (tableRef ||
533
- (getBooleanFF('platform.editor.a11y-table-context-menu_y4c9c') &&
534
- isCellMenuOpenByKeyboard)) &&
533
+ (isCellMenuOpenByKeyboard &&
534
+ fg('platform.editor.a11y-table-context-menu_y4c9c'))) &&
535
535
  !isResizing &&
536
536
  options &&
537
537
  options.allowContextualMenu && (
@@ -607,6 +607,7 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
607
607
  getEditorFeatureFlags={
608
608
  options?.getEditorFeatureFlags || defaultGetEditorFeatureFlags
609
609
  }
610
+ ariaNotifyPlugin={ariaNotifyPlugin}
610
611
  />
611
612
  )}
612
613
  {allowControls && !isDragAndDropEnabled && !isResizing && (
@@ -1,3 +1,5 @@
1
+ import { type IntlShape } from 'react-intl-next/src/types';
2
+
1
3
  import {
2
4
  ACTION_SUBJECT,
3
5
  EVENT_TYPE,
@@ -6,7 +8,9 @@ import {
6
8
  TABLE_STATUS,
7
9
  } from '@atlaskit/editor-common/analytics';
8
10
  import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
11
+ import { tableMessages as messages } from '@atlaskit/editor-common/messages';
9
12
  import type { Command } from '@atlaskit/editor-common/types';
13
+ import type { AriaLiveElementAttributes } from '@atlaskit/editor-plugin-accessibility-utils';
10
14
  import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
11
15
  import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
12
16
  import { findCellRectClosestToPos, getSelectionRect } from '@atlaskit/editor-tables/utils';
@@ -52,7 +56,11 @@ export const clearDropTargetWithAnalytics =
52
56
  };
53
57
 
54
58
  export const moveSourceWithAnalytics =
55
- (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) =>
59
+ (
60
+ editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null,
61
+ ariaNotify?: (message: string, ariaLiveElementAttributes?: AriaLiveElementAttributes) => void,
62
+ getIntl?: () => IntlShape,
63
+ ) =>
56
64
  (
57
65
  inputMethod:
58
66
  | INPUT_METHOD.TABLE_CONTEXT_MENU
@@ -88,13 +96,45 @@ export const moveSourceWithAnalytics =
88
96
  })(editorAnalyticsAPI)((state, dispatch) => {
89
97
  if (dispatch) {
90
98
  moveSource(sourceType, sourceIndexes, targetIndex, tr)(state, dispatch);
99
+ // Only considering single row/column movement for screen reader as only single row/column selection is supported via keyboard atm.
100
+ if (
101
+ (inputMethod === INPUT_METHOD.TABLE_CONTEXT_MENU || INPUT_METHOD.SHORTCUT) &&
102
+ sourceIndexes.length === 1 &&
103
+ ariaNotify &&
104
+ getIntl
105
+ ) {
106
+ const direction = sourceIndexes[0] > targetIndex ? -1 : 1; // -1 for left/up , 1 for right/down
107
+ const { totalRowCount, totalColumnCount } = getSelectedTableInfo(state.selection);
108
+ ariaNotify(
109
+ getIntl().formatMessage(
110
+ sourceType === 'table-row'
111
+ ? direction > 0
112
+ ? messages.rowMovedDown
113
+ : messages.rowMovedUp
114
+ : direction > 0
115
+ ? messages.columnMovedRight
116
+ : messages.columnMovedLeft,
117
+ {
118
+ index: targetIndex + 1,
119
+ total: sourceType === 'table-row' ? totalRowCount : totalColumnCount,
120
+ },
121
+ ),
122
+ {
123
+ priority: 'important',
124
+ },
125
+ );
126
+ }
91
127
  }
92
128
  return true;
93
129
  });
94
130
  };
95
131
 
96
132
  export const moveSourceWithAnalyticsViaShortcut =
97
- (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) =>
133
+ (
134
+ editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null,
135
+ ariaNotify?: (message: string, ariaLiveElementAttributes?: AriaLiveElementAttributes) => void,
136
+ getIntl?: () => IntlShape,
137
+ ) =>
98
138
  (sourceType: DraggableType, direction: DraggableData['direction']): Command =>
99
139
  (state, dispatch) => {
100
140
  const { selection } = state;
@@ -130,7 +170,7 @@ export const moveSourceWithAnalyticsViaShortcut =
130
170
 
131
171
  const targetIndex = getTargetIndex(selectedIndexes, direction);
132
172
 
133
- return moveSourceWithAnalytics(editorAnalyticsAPI)(
173
+ return moveSourceWithAnalytics(editorAnalyticsAPI, ariaNotify, getIntl)(
134
174
  INPUT_METHOD.SHORTCUT,
135
175
  sourceType,
136
176
  selectedIndexes,
@@ -34,7 +34,7 @@ import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
34
34
  import type { GetEditorContainerWidth } from '@atlaskit/editor-common/types';
35
35
  import { chainCommands } from '@atlaskit/editor-prosemirror/commands';
36
36
  import { keymap } from '@atlaskit/editor-prosemirror/keymap';
37
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
37
+ import { fg } from '@atlaskit/platform-feature-flags';
38
38
 
39
39
  import { goToNextCell, moveCursorBackward, setFocusToCellMenu } from '../commands';
40
40
  import {
@@ -139,7 +139,7 @@ export function keymapPlugin(
139
139
  list,
140
140
  );
141
141
 
142
- if (getBooleanFF('platform.editor.a11y-help-dialog-shortcut-keys-position_aghfg')) {
142
+ if (fg('platform.editor.a11y-help-dialog-shortcut-keys-position_aghfg')) {
143
143
  bindKeymapWithCommand(
144
144
  addRowBeforeVO.common!,
145
145
  addRowAroundSelection(editorAnalyticsAPI)('TOP'),
@@ -186,25 +186,41 @@ export function keymapPlugin(
186
186
 
187
187
  bindKeymapWithCommand(
188
188
  moveRowDown.common!,
189
- moveSourceWithAnalyticsViaShortcut(editorAnalyticsAPI)('table-row', 1),
189
+ moveSourceWithAnalyticsViaShortcut(
190
+ editorAnalyticsAPI,
191
+ ariaNotifyPlugin,
192
+ getIntl,
193
+ )('table-row', 1),
190
194
  list,
191
195
  );
192
196
 
193
197
  bindKeymapWithCommand(
194
198
  moveRowUp.common!,
195
- moveSourceWithAnalyticsViaShortcut(editorAnalyticsAPI)('table-row', -1),
199
+ moveSourceWithAnalyticsViaShortcut(
200
+ editorAnalyticsAPI,
201
+ ariaNotifyPlugin,
202
+ getIntl,
203
+ )('table-row', -1),
196
204
  list,
197
205
  );
198
206
 
199
207
  bindKeymapWithCommand(
200
208
  moveColumnLeft.common!,
201
- moveSourceWithAnalyticsViaShortcut(editorAnalyticsAPI)('table-column', -1),
209
+ moveSourceWithAnalyticsViaShortcut(
210
+ editorAnalyticsAPI,
211
+ ariaNotifyPlugin,
212
+ getIntl,
213
+ )('table-column', -1),
202
214
  list,
203
215
  );
204
216
 
205
217
  bindKeymapWithCommand(
206
218
  moveColumnRight.common!,
207
- moveSourceWithAnalyticsViaShortcut(editorAnalyticsAPI)('table-column', 1),
219
+ moveSourceWithAnalyticsViaShortcut(
220
+ editorAnalyticsAPI,
221
+ ariaNotifyPlugin,
222
+ getIntl,
223
+ )('table-column', 1),
208
224
  list,
209
225
  );
210
226
 
@@ -297,7 +313,7 @@ export function keymapPlugin(
297
313
  list,
298
314
  );
299
315
 
300
- if (getBooleanFF('platform.editor.a11y-table-context-menu_y4c9c')) {
316
+ if (fg('platform.editor.a11y-table-context-menu_y4c9c')) {
301
317
  bindKeymapWithCommand(focusToContextMenuTrigger.common!, setFocusToCellMenu(), list);
302
318
  }
303
319
 
@@ -10,7 +10,6 @@ import type { DispatchAnalyticsEvent, EditorAnalyticsAPI } from '@atlaskit/edito
10
10
  import { insideTable } from '@atlaskit/editor-common/core-utils';
11
11
  import type { Dispatch, EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
12
12
  import { type PortalProviderAPI } from '@atlaskit/editor-common/portal';
13
- import type { LegacyPortalProviderAPI } from '@atlaskit/editor-common/portal-provider';
14
13
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
15
14
  import {
16
15
  transformSliceToRemoveOpenBodiedExtension,
@@ -26,7 +25,7 @@ import { findParentDomRefOfType, findParentNodeOfType } from '@atlaskit/editor-p
26
25
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
27
26
  import { TableMap } from '@atlaskit/editor-tables';
28
27
  import { findTable } from '@atlaskit/editor-tables/utils';
29
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
28
+ import { fg } from '@atlaskit/platform-feature-flags';
30
29
 
31
30
  import { addBoldInEmptyHeaderCells, clearHoverSelection, setTableRef } from '../commands';
32
31
  import { stopKeyboardColumnResizing } from '../commands/column-resize';
@@ -79,7 +78,7 @@ import { pluginKey } from './plugin-key';
79
78
  export const createPlugin = (
80
79
  dispatchAnalyticsEvent: DispatchAnalyticsEvent,
81
80
  dispatch: Dispatch,
82
- portalProviderAPI: LegacyPortalProviderAPI | PortalProviderAPI,
81
+ portalProviderAPI: PortalProviderAPI,
83
82
  eventDispatcher: EventDispatcher,
84
83
  pluginConfig: PluginConfig,
85
84
  getEditorContainerWidth: GetEditorContainerWidth,
@@ -292,7 +291,7 @@ export const createPlugin = (
292
291
  }
293
292
 
294
293
  // If a partial paste of nested expand, paste only nested-expand's content */
295
- if (getBooleanFF('platform.editor.transform-slice-for-nested-expand')) {
294
+ if (fg('platform.editor.transform-slice-for-nested-expand')) {
296
295
  slice = transformSliceToRemoveOpenNestedExpand(slice, schema);
297
296
  }
298
297
 
@@ -1,3 +1,5 @@
1
+ import { type IntlShape } from 'react-intl-next/src/types';
2
+
1
3
  import {
2
4
  bindKeymapArrayWithCommand,
3
5
  bindKeymapWithCommand,
@@ -9,7 +11,6 @@ import {
9
11
  shiftArrowUp,
10
12
  } from '@atlaskit/editor-common/keymaps';
11
13
  import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
12
- import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
13
14
  import { keymap } from '@atlaskit/editor-prosemirror/keymap';
14
15
 
15
16
  import {
@@ -20,20 +21,31 @@ import {
20
21
  selectRows,
21
22
  shiftArrowUpFromTable,
22
23
  } from '../commands/selection';
23
- import type tablePlugin from '../plugin';
24
+ import { type PluginInjectionAPI } from '../types';
24
25
 
25
26
  export function tableSelectionKeymapPlugin(
26
- editorSelectionAPI: ExtractInjectionAPI<typeof tablePlugin>['selection'] | undefined,
27
+ pluginInjectionApi?: PluginInjectionAPI,
28
+ getIntl?: () => IntlShape,
27
29
  ): SafePlugin {
28
30
  const list = {};
31
+ const editorSelectionAPI = pluginInjectionApi?.selection;
32
+ const ariaNotifyPlugin = pluginInjectionApi?.accessibilityUtils?.actions.ariaNotify;
29
33
 
30
34
  bindKeymapWithCommand(moveRight.common!, arrowRightFromTable(editorSelectionAPI)(), list);
31
35
 
32
36
  bindKeymapWithCommand(moveLeft.common!, arrowLeftFromTable(editorSelectionAPI)(), list);
33
37
 
34
- bindKeymapArrayWithCommand(selectColumn, selectColumns(editorSelectionAPI)(true), list);
35
-
36
- bindKeymapArrayWithCommand(selectRow, selectRows(editorSelectionAPI)(true), list);
38
+ bindKeymapArrayWithCommand(
39
+ selectColumn,
40
+ selectColumns(editorSelectionAPI, ariaNotifyPlugin, getIntl)(true),
41
+ list,
42
+ );
43
+
44
+ bindKeymapArrayWithCommand(
45
+ selectRow,
46
+ selectRows(editorSelectionAPI, ariaNotifyPlugin, getIntl)(true),
47
+ list,
48
+ );
37
49
 
38
50
  bindKeymapWithCommand(shiftArrowUp.common!, shiftArrowUpFromTable(editorSelectionAPI)(), list);
39
51
 
package/src/toolbar.tsx CHANGED
@@ -521,6 +521,7 @@ export const getToolbarConfig =
521
521
  getDomRef,
522
522
  editorView,
523
523
  shouldUseIncreasedScalingPercent,
524
+ options?.fullWidthEnabled,
524
525
  )
525
526
  : [];
526
527
 
@@ -852,6 +853,7 @@ export const getAlignmentOptionsConfig = (
852
853
  getDomRef: (editorView: EditorView) => HTMLElement | undefined,
853
854
  editorView: EditorView | null,
854
855
  shouldUseIncreasedScalingPercent: boolean,
856
+ isFullWidthEditor?: boolean,
855
857
  ): Array<FloatingToolbarDropdown<Command>> => {
856
858
  const tableObject = findTable(editorState.selection);
857
859
 
@@ -900,6 +902,7 @@ export const getAlignmentOptionsConfig = (
900
902
  getDomRef,
901
903
  editorView,
902
904
  shouldUseIncreasedScalingPercent,
905
+ isFullWidthEditor,
903
906
  ) && {
904
907
  disabled: value !== 'center',
905
908
  }),
@@ -942,6 +945,7 @@ export const isLayoutOptionDisabled = (
942
945
  getDomRef: (editorView: EditorView) => HTMLElement | undefined,
943
946
  editorView: EditorView | null,
944
947
  shouldUseIncreasedScalingPercent: boolean,
948
+ isFullWidthEditor: boolean | undefined,
945
949
  ) => {
946
950
  const { lineLength } = getEditorContainerWidth();
947
951
  let tableContainerWidth = getTableContainerWidth(selectedNode);
@@ -958,7 +962,9 @@ export const isLayoutOptionDisabled = (
958
962
  tableContainerWidth = tableContainerWidth * scalePercent;
959
963
  }
960
964
 
961
- if (selectedNode && lineLength && tableContainerWidth > lineLength) {
965
+ // If fixed-width editor, we disable 'left-alignment' when table width is 760px.
966
+ // tableContainerWidth +1 here because tableContainerWidth is 759 in fixed-width editor
967
+ if (selectedNode && !isFullWidthEditor && lineLength && tableContainerWidth + 1 >= lineLength) {
962
968
  return true;
963
969
  }
964
970
 
@@ -27,6 +27,7 @@ import {
27
27
  import type { MenuItem } from '@atlaskit/editor-common/ui-menu';
28
28
  import { closestElement } from '@atlaskit/editor-common/utils';
29
29
  import { hexToEditorBackgroundPaletteColor } from '@atlaskit/editor-palette';
30
+ import type { AriaLiveElementAttributes } from '@atlaskit/editor-plugin-accessibility-utils';
30
31
  import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
31
32
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
32
33
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
@@ -93,6 +94,10 @@ type DragMenuProps = {
93
94
  shouldUseIncreasedScalingPercent?: boolean;
94
95
  isTableFixedColumnWidthsOptionEnabled?: boolean;
95
96
  tableSortColumnReorder?: boolean;
97
+ ariaNotifyPlugin?: (
98
+ message: string,
99
+ ariaLiveElementAttributes?: AriaLiveElementAttributes,
100
+ ) => void;
96
101
  };
97
102
 
98
103
  type PluralOptionType = 'noOfCols' | 'noOfRows' | 'noOfCells' | null;
@@ -275,6 +280,7 @@ export const DragMenu = React.memo(
275
280
  shouldUseIncreasedScalingPercent,
276
281
  isTableFixedColumnWidthsOptionEnabled,
277
282
  tableSortColumnReorder,
283
+ ariaNotifyPlugin,
278
284
  }: DragMenuProps & WrappedComponentProps) => {
279
285
  const { state, dispatch } = editorView;
280
286
  const { selection } = state;
@@ -305,6 +311,7 @@ export const DragMenu = React.memo(
305
311
  isTableFixedColumnWidthsOptionEnabled,
306
312
  shouldUseIncreasedScalingPercent,
307
313
  tableSortColumnReorder,
314
+ ariaNotifyPlugin,
308
315
  );
309
316
 
310
317
  const { menuItems, menuCallback } = convertToDropdownItems(
@@ -3,6 +3,7 @@ import React from 'react';
3
3
  import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
4
4
  import type { GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
5
5
  import { Popup } from '@atlaskit/editor-common/ui';
6
+ import type { AriaLiveElementAttributes } from '@atlaskit/editor-plugin-accessibility-utils';
6
7
  import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
7
8
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
8
9
  import {
@@ -10,7 +11,7 @@ import {
10
11
  akEditorFloatingOverlapPanelZIndex,
11
12
  } from '@atlaskit/editor-shared-styles';
12
13
  import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
13
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
14
+ import { fg } from '@atlaskit/platform-feature-flags';
14
15
 
15
16
  import type { RowStickyState } from '../../pm-plugins/sticky-headers';
16
17
  import type { PluginConfig, TableDirection } from '../../types';
@@ -35,6 +36,10 @@ export interface Props {
35
36
  pluginConfig?: PluginConfig;
36
37
  isTableScalingEnabled?: boolean;
37
38
  getEditorFeatureFlags?: GetEditorFeatureFlags;
39
+ ariaNotifyPlugin?: (
40
+ message: string,
41
+ ariaLiveElementAttributes?: AriaLiveElementAttributes,
42
+ ) => void;
38
43
  }
39
44
 
40
45
  const FloatingDragMenu = ({
@@ -53,6 +58,7 @@ const FloatingDragMenu = ({
53
58
  pluginConfig,
54
59
  isTableScalingEnabled,
55
60
  getEditorFeatureFlags,
61
+ ariaNotifyPlugin,
56
62
  }: Props) => {
57
63
  if (!isOpen || !targetCellPosition || editorView.state.doc.nodeSize <= targetCellPosition) {
58
64
  return null;
@@ -79,7 +85,7 @@ const FloatingDragMenu = ({
79
85
  const shouldUseIncreasedScalingPercent =
80
86
  isTableScalingEnabled &&
81
87
  tableWithFixedColumnWidthsOption &&
82
- getBooleanFF('platform.editor.table.use-increased-scaling-percent');
88
+ fg('platform.editor.table.use-increased-scaling-percent');
83
89
 
84
90
  return (
85
91
  <Popup
@@ -120,6 +126,7 @@ const FloatingDragMenu = ({
120
126
  shouldUseIncreasedScalingPercent={shouldUseIncreasedScalingPercent}
121
127
  isTableFixedColumnWidthsOptionEnabled={tableWithFixedColumnWidthsOption}
122
128
  tableSortColumnReorder={tableSortColumnReorder}
129
+ ariaNotifyPlugin={ariaNotifyPlugin}
123
130
  />
124
131
  </Popup>
125
132
  );
@@ -7,13 +7,15 @@ import { browser } from '@atlaskit/editor-common/utils';
7
7
  import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
8
8
  import type { Selection } from '@atlaskit/editor-prosemirror/state';
9
9
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
10
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
10
+ import { findTable } from '@atlaskit/editor-tables/utils';
11
+ import { fg } from '@atlaskit/platform-feature-flags';
11
12
 
12
13
  import { hoverCell, hoverRows, selectRow, selectRows } from '../../commands';
13
14
  import type { TablePlugin } from '../../plugin';
14
15
  import type { RowStickyState } from '../../pm-plugins/sticky-headers';
15
16
  import { TableCssClassName as ClassName } from '../../types';
16
17
  import type { CellHoverMeta } from '../../types';
18
+ import { isTableNested } from '../../utils/nodes';
17
19
 
18
20
  import {
19
21
  CornerControls,
@@ -127,6 +129,12 @@ export const TableFloatingControls = ({
127
129
  ? ClassName.DRAG_ROW_CONTROLS_WRAPPER
128
130
  : ClassName.ROW_CONTROLS_WRAPPER;
129
131
 
132
+ const tablePos = findTable(editorView.state.selection)?.pos;
133
+ const isNested = tablePos !== undefined && isTableNested(editorView.state, tablePos!);
134
+ const shouldShowCornerControls = fg('platform_editor_element_drag_and_drop_ed_24041')
135
+ ? !featureFlagsState?.elementDragAndDrop || isNested
136
+ : !featureFlagsState?.elementDragAndDrop;
137
+
130
138
  return (
131
139
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
132
140
  <div className={wrapperClassName}>
@@ -152,8 +160,8 @@ export const TableFloatingControls = ({
152
160
  <>
153
161
  {isDragAndDropEnabled ? (
154
162
  <>
155
- {!featureFlagsState?.elementDragAndDrop &&
156
- (getBooleanFF('platform.editor.table.use-shared-state-hook') ? (
163
+ {shouldShowCornerControls &&
164
+ (fg('platform.editor.table.use-shared-state-hook') ? (
157
165
  <DragCornerControlsWithSelection
158
166
  editorView={editorView}
159
167
  tableRef={tableRef}
@@ -185,7 +193,7 @@ export const TableFloatingControls = ({
185
193
  updateCellHoverLocation={updateCellHoverLocation}
186
194
  />
187
195
  </>
188
- ) : getBooleanFF('platform.editor.table.use-shared-state-hook') ? (
196
+ ) : fg('platform.editor.table.use-shared-state-hook') ? (
189
197
  <FloatingControlsWithSelection
190
198
  editorView={editorView}
191
199
  tableRef={tableRef}
@@ -22,6 +22,7 @@ import type {
22
22
  GetEditorContainerWidth,
23
23
  IconProps,
24
24
  } from '@atlaskit/editor-common/types';
25
+ import type { AriaLiveElementAttributes } from '@atlaskit/editor-plugin-accessibility-utils';
25
26
  import type { EditorState, Selection } from '@atlaskit/editor-prosemirror/state';
26
27
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
27
28
  import type { Rect, TableMap } from '@atlaskit/editor-tables/table-map';
@@ -45,6 +46,7 @@ import {
45
46
  sortColumnWithAnalytics,
46
47
  } from '../commands-with-analytics';
47
48
  import { moveSourceWithAnalytics } from '../pm-plugins/drag-and-drop/commands-with-analytics';
49
+ import { getPluginState as getTablePluginState } from '../pm-plugins/plugin-factory';
48
50
  import { getNewResizeStateFromSelectedColumns } from '../pm-plugins/table-resizing/utils/resize-state';
49
51
  import { getClosestSelectionRect } from '../toolbar';
50
52
  import type { DraggableData, DraggableType, TableDirection } from '../types';
@@ -148,8 +150,13 @@ export const getDragMenuConfig = (
148
150
  isTableFixedColumnWidthsOptionEnabled = false,
149
151
  shouldUseIncreasedScalingPercent = false,
150
152
  tableSortColumnReorder = false,
153
+ ariaNotifyPlugin?: (
154
+ message: string,
155
+ ariaLiveElementAttributes?: AriaLiveElementAttributes,
156
+ ) => void,
151
157
  ): DragMenuConfig[] => {
152
158
  const { selection } = editorView.state;
159
+ const { getIntl } = getTablePluginState(editorView.state);
153
160
  const addOptions =
154
161
  direction === 'row'
155
162
  ? [
@@ -358,7 +365,7 @@ export const getDragMenuConfig = (
358
365
  onClick: (state: EditorState, dispatch?: CommandDispatch) => {
359
366
  if (canMove) {
360
367
  requestAnimationFrame(() => {
361
- moveSourceWithAnalytics(editorAnalyticsAPI)(
368
+ moveSourceWithAnalytics(editorAnalyticsAPI, ariaNotifyPlugin, getIntl)(
362
369
  INPUT_METHOD.TABLE_CONTEXT_MENU,
363
370
  `table-${direction}`,
364
371
  getOriginIndexes(selectionRect!),