@atlaskit/editor-plugin-table 7.18.2 → 7.18.4

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 +16 -0
  2. package/dist/cjs/commands/column-resize.js +0 -12
  3. package/dist/cjs/commands/go-to-next-cell.js +8 -11
  4. package/dist/cjs/commands/index.js +6 -0
  5. package/dist/cjs/commands/misc.js +15 -1
  6. package/dist/cjs/commands/selection.js +4 -11
  7. package/dist/cjs/event-handlers.js +7 -11
  8. package/dist/cjs/plugin.js +7 -4
  9. package/dist/cjs/pm-plugins/keymap.js +22 -21
  10. package/dist/cjs/pm-plugins/main.js +26 -30
  11. package/dist/cjs/pm-plugins/table-resizing/event-handlers.js +13 -21
  12. package/dist/cjs/pm-plugins/table-resizing/plugin.js +8 -11
  13. package/dist/cjs/reducer.js +1 -0
  14. package/dist/cjs/ui/FloatingContextualButton/index.js +18 -2
  15. package/dist/cjs/ui/FloatingContextualMenu/ContextualMenu.js +170 -35
  16. package/dist/cjs/ui/FloatingContextualMenu/index.js +4 -2
  17. package/dist/es2019/commands/column-resize.js +0 -12
  18. package/dist/es2019/commands/go-to-next-cell.js +8 -11
  19. package/dist/es2019/commands/index.js +1 -1
  20. package/dist/es2019/commands/misc.js +9 -1
  21. package/dist/es2019/commands/selection.js +4 -11
  22. package/dist/es2019/event-handlers.js +8 -12
  23. package/dist/es2019/plugin.js +7 -4
  24. package/dist/es2019/pm-plugins/keymap.js +24 -23
  25. package/dist/es2019/pm-plugins/main.js +27 -31
  26. package/dist/es2019/pm-plugins/table-resizing/event-handlers.js +13 -21
  27. package/dist/es2019/pm-plugins/table-resizing/plugin.js +9 -12
  28. package/dist/es2019/reducer.js +1 -0
  29. package/dist/es2019/ui/FloatingContextualButton/index.js +17 -2
  30. package/dist/es2019/ui/FloatingContextualMenu/ContextualMenu.js +159 -24
  31. package/dist/es2019/ui/FloatingContextualMenu/index.js +4 -2
  32. package/dist/esm/commands/column-resize.js +0 -12
  33. package/dist/esm/commands/go-to-next-cell.js +8 -11
  34. package/dist/esm/commands/index.js +1 -1
  35. package/dist/esm/commands/misc.js +14 -0
  36. package/dist/esm/commands/selection.js +4 -11
  37. package/dist/esm/event-handlers.js +7 -11
  38. package/dist/esm/plugin.js +7 -4
  39. package/dist/esm/pm-plugins/keymap.js +24 -23
  40. package/dist/esm/pm-plugins/main.js +26 -30
  41. package/dist/esm/pm-plugins/table-resizing/event-handlers.js +13 -21
  42. package/dist/esm/pm-plugins/table-resizing/plugin.js +8 -11
  43. package/dist/esm/reducer.js +1 -0
  44. package/dist/esm/ui/FloatingContextualButton/index.js +15 -2
  45. package/dist/esm/ui/FloatingContextualMenu/ContextualMenu.js +171 -40
  46. package/dist/esm/ui/FloatingContextualMenu/index.js +4 -2
  47. package/dist/types/commands/index.d.ts +1 -1
  48. package/dist/types/commands/misc.d.ts +1 -0
  49. package/dist/types/types.d.ts +6 -0
  50. package/dist/types/ui/FloatingContextualButton/index.d.ts +1 -0
  51. package/dist/types/ui/FloatingContextualMenu/ContextualMenu.d.ts +7 -3
  52. package/dist/types/ui/FloatingContextualMenu/index.d.ts +2 -1
  53. package/dist/types-ts4.5/commands/index.d.ts +1 -1
  54. package/dist/types-ts4.5/commands/misc.d.ts +1 -0
  55. package/dist/types-ts4.5/types.d.ts +6 -0
  56. package/dist/types-ts4.5/ui/FloatingContextualButton/index.d.ts +1 -0
  57. package/dist/types-ts4.5/ui/FloatingContextualMenu/ContextualMenu.d.ts +7 -3
  58. package/dist/types-ts4.5/ui/FloatingContextualMenu/index.d.ts +2 -1
  59. package/package.json +4 -4
  60. package/src/commands/column-resize.ts +0 -14
  61. package/src/commands/go-to-next-cell.ts +7 -10
  62. package/src/commands/index.ts +1 -0
  63. package/src/commands/misc.ts +13 -0
  64. package/src/commands/selection.ts +4 -11
  65. package/src/event-handlers.ts +6 -12
  66. package/src/plugin.tsx +6 -1
  67. package/src/pm-plugins/keymap.ts +65 -62
  68. package/src/pm-plugins/main.ts +27 -31
  69. package/src/pm-plugins/table-resizing/event-handlers.ts +11 -19
  70. package/src/pm-plugins/table-resizing/plugin.ts +7 -10
  71. package/src/reducer.ts +1 -0
  72. package/src/types.ts +8 -1
  73. package/src/ui/FloatingContextualButton/index.tsx +19 -1
  74. package/src/ui/FloatingContextualMenu/ContextualMenu.tsx +207 -30
  75. package/src/ui/FloatingContextualMenu/index.tsx +3 -0
@@ -65,9 +65,6 @@ export var initiateKeyboardColumnResizing = function initiateKeyboardColumnResiz
65
65
  var ariaNotify = _ref.ariaNotify,
66
66
  getIntl = _ref.getIntl;
67
67
  return function (state, dispatch, view) {
68
- if (!getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
69
- return false;
70
- }
71
68
  var selection = state.selection;
72
69
  var selectionRect = isSelectionType(selection, 'cell') ? getSelectionRect(selection) : findCellRectClosestToPos(selection.$from);
73
70
  var cell = findCellClosestToPos(selection.$from);
@@ -87,9 +84,6 @@ export var activateNextResizeArea = function activateNextResizeArea(_ref2) {
87
84
  ariaNotify = _ref2.ariaNotify,
88
85
  getIntl = _ref2.getIntl;
89
86
  return function (state, dispatch, view) {
90
- if (!getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
91
- return false;
92
- }
93
87
  var _ref3 = getTableResizingPluginState(state) || {},
94
88
  resizeHandlePos = _ref3.resizeHandlePos;
95
89
  // If No resizing has initiated, skip to regular handler
@@ -162,9 +156,6 @@ export var changeColumnWidthByStep = function changeColumnWidthByStep(_ref4) {
162
156
  var fakeDispatch = function fakeDispatch(tr) {
163
157
  customTr = tr;
164
158
  };
165
- if (!getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
166
- return false;
167
- }
168
159
  var _getTableResizingPlug = getTableResizingPluginState(state),
169
160
  resizeHandlePos = _getTableResizingPlug.resizeHandlePos;
170
161
  var cell = findCellClosestToPos(state.selection.$from);
@@ -252,9 +243,6 @@ export var stopKeyboardColumnResizing = function stopKeyboardColumnResizing(_ref
252
243
  getIntl = _ref5.getIntl,
253
244
  originalTr = _ref5.originalTr;
254
245
  return function (state, dispatch) {
255
- if (!getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
256
- return false;
257
- }
258
246
  var customTr = originalTr || state.tr;
259
247
  var fakeDispatch = function fakeDispatch(tr) {
260
248
  customTr = tr;
@@ -4,7 +4,6 @@ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
4
4
  import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
5
5
  import { TableMap } from '@atlaskit/editor-tables/table-map';
6
6
  import { goToNextCell as baseGotoNextCell, findTable } from '@atlaskit/editor-tables/utils';
7
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
8
7
  import { insertRowWithAnalytics } from '../commands-with-analytics';
9
8
  import { getPluginState } from '../pm-plugins/plugin-factory';
10
9
  import { stopKeyboardColumnResizing } from './column-resize';
@@ -13,20 +12,18 @@ var TAB_BACKWARD_DIRECTION = -1;
13
12
  export var goToNextCell = function goToNextCell(editorAnalyticsAPI, ariaNotify, getIntl) {
14
13
  return function (direction) {
15
14
  return function (state, dispatch, view) {
15
+ var _getPluginState;
16
16
  var table = findTable(state.selection);
17
17
  if (!table) {
18
18
  return false;
19
19
  }
20
- if (getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
21
- var _getPluginState;
22
- var isColumnResizing = (_getPluginState = getPluginState(state)) === null || _getPluginState === void 0 ? void 0 : _getPluginState.isKeyboardResize;
23
- if (isColumnResizing) {
24
- stopKeyboardColumnResizing({
25
- ariaNotify: ariaNotify,
26
- getIntl: getIntl
27
- })(state, dispatch, view);
28
- return true;
29
- }
20
+ var isColumnResizing = (_getPluginState = getPluginState(state)) === null || _getPluginState === void 0 ? void 0 : _getPluginState.isKeyboardResize;
21
+ if (isColumnResizing) {
22
+ stopKeyboardColumnResizing({
23
+ ariaNotify: ariaNotify,
24
+ getIntl: getIntl
25
+ })(state, dispatch, view);
26
+ return true;
30
27
  }
31
28
  var map = TableMap.get(table.node);
32
29
  var _state$schema$nodes = state.schema.nodes,
@@ -2,7 +2,7 @@ export { hoverColumns, hoverRows, hoverTable, hoverCell, hoverMergedCells, clear
2
2
  export { insertColumn, insertRow, createTable } from './insert';
3
3
  export { getNextLayout, toggleContextualMenu, toggleHeaderColumn, toggleHeaderRow, toggleNumberColumn, toggleTableLayout } from './toggle';
4
4
  export { clearMultipleCells } from './clear';
5
- export { autoSizeTable, convertFirstRowToHeader, deleteTable, hideInsertColumnOrRowButton, moveCursorBackward, selectColumn, selectColumns, selectRow, selectRows, setCellAttr, setEditorFocus, setMultipleCellAttrs, setTableRef, showInsertColumnButton, showInsertRowButton, transformSliceToAddTableHeaders, triggerUnlessTableHeader, addBoldInEmptyHeaderCells, addResizeHandleDecorations, updateWidthToWidest } from './misc';
5
+ export { autoSizeTable, convertFirstRowToHeader, deleteTable, hideInsertColumnOrRowButton, moveCursorBackward, selectColumn, selectColumns, selectRow, selectRows, setCellAttr, setEditorFocus, setMultipleCellAttrs, setTableRef, showInsertColumnButton, showInsertRowButton, transformSliceToAddTableHeaders, triggerUnlessTableHeader, addBoldInEmptyHeaderCells, addResizeHandleDecorations, updateWidthToWidest, setFocusToCellMenu } from './misc';
6
6
  export { sortByColumn } from './sort';
7
7
  export { goToNextCell } from './go-to-next-cell';
8
8
  export { removeDescendantNodes } from './referentiality';
@@ -619,4 +619,18 @@ export var setTableAlignmentWithTableContentWithPos = function setTableAlignment
619
619
  tr.setNodeMarkup(tableNodeWithPos.pos, undefined, nextTableAttrs).setMeta('scrollIntoView', false);
620
620
  return tr;
621
621
  };
622
+ };
623
+ export var setFocusToCellMenu = function setFocusToCellMenu() {
624
+ var isCellMenuOpenByKeyboard = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
625
+ var originalTr = arguments.length > 1 ? arguments[1] : undefined;
626
+ return createCommand(function () {
627
+ return {
628
+ type: 'SET_CELL_MENU_OPEN',
629
+ data: {
630
+ isCellMenuOpenByKeyboard: isCellMenuOpenByKeyboard
631
+ }
632
+ };
633
+ }, function (tr) {
634
+ return (originalTr || tr).setMeta('addToHistory', false);
635
+ });
622
636
  };
@@ -3,7 +3,6 @@ import { Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
3
3
  import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
4
4
  import { TableMap } from '@atlaskit/editor-tables/table-map';
5
5
  import { findTable, isColumnSelected, isRowSelected, isTableSelected, selectedRect } from '@atlaskit/editor-tables/utils';
6
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
7
6
  import { selectColumn, selectRow } from '../commands/misc';
8
7
  import { getPluginState } from '../pm-plugins/plugin-factory';
9
8
  import { getClosestSelectionRect } from '../toolbar';
@@ -196,11 +195,8 @@ var arrowLeftFromText = function arrowLeftFromText(editorSelectionAPI) {
196
195
  var table = findTable(selection);
197
196
  if (table) {
198
197
  var $from = selection.$from;
199
- var isColumnResizing = false;
200
- if (getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
201
- var columResizePluginState = getPluginState(state) || {};
202
- isColumnResizing = Boolean(columResizePluginState === null || columResizePluginState === void 0 ? void 0 : columResizePluginState.isKeyboardResize);
203
- }
198
+ var columResizePluginState = getPluginState(state) || {};
199
+ var isColumnResizing = Boolean(columResizePluginState === null || columResizePluginState === void 0 ? void 0 : columResizePluginState.isKeyboardResize);
204
200
  if (isSelectionAtStartOfTable($from, selection) && $from.parent.type.name === 'paragraph' && $from.depth === table.depth + 3 &&
205
201
  // + 3 for: row, cell & paragraph nodes
206
202
  editorSelectionAPI && !isColumnResizing) {
@@ -230,11 +226,8 @@ var arrowRightFromText = function arrowRightFromText(editorSelectionAPI) {
230
226
  var table = findTable(selection);
231
227
  if (table) {
232
228
  var $to = selection.$to;
233
- var isColumnResizing = false;
234
- if (getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
235
- var columResizePluginState = getPluginState(state) || {};
236
- isColumnResizing = Boolean(columResizePluginState === null || columResizePluginState === void 0 ? void 0 : columResizePluginState.isKeyboardResize);
237
- }
229
+ var columResizePluginState = getPluginState(state) || {};
230
+ var isColumnResizing = Boolean(columResizePluginState === null || columResizePluginState === void 0 ? void 0 : columResizePluginState.isKeyboardResize);
238
231
  if (isSelectionAtEndOfTable($to, selection) && $to.parent.type.name === 'paragraph' && $to.depth === table.depth + 3 &&
239
232
  // + 3 for: row, cell & paragraph nodes
240
233
  !isColumnResizing) {
@@ -190,17 +190,13 @@ export var handleMouseOut = function handleMouseOut(view, mouseEvent) {
190
190
  if (isResizeHandleDecoration(target) && !isResizeHandleDecoration(relatedTarget)) {
191
191
  var _state2 = view.state,
192
192
  _dispatch3 = view.dispatch;
193
- if (getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
194
- var _getPluginState3 = getPluginState(_state2),
195
- isKeyboardResize = _getPluginState3.isKeyboardResize;
196
- if (isKeyboardResize) {
197
- // no need to hide decoration if column resizing started by keyboard
198
- return false;
199
- }
200
- return hideResizeHandleLine()(_state2, _dispatch3);
201
- } else {
202
- return hideResizeHandleLine()(_state2, _dispatch3);
193
+ var _getPluginState3 = getPluginState(_state2),
194
+ isKeyboardResize = _getPluginState3.isKeyboardResize;
195
+ if (isKeyboardResize) {
196
+ // no need to hide decoration if column resizing started by keyboard
197
+ return false;
203
198
  }
199
+ return hideResizeHandleLine()(_state2, _dispatch3);
204
200
  }
205
201
  return false;
206
202
  };
@@ -293,7 +289,7 @@ var handleMouseMoveDebounce = rafSchedule(function (view, event, offsetX) {
293
289
  var _getPluginState8 = getPluginState(_state4),
294
290
  resizeHandleColumnIndex = _getPluginState8.resizeHandleColumnIndex,
295
291
  resizeHandleRowIndex = _getPluginState8.resizeHandleRowIndex;
296
- var isKeyboardResize = getBooleanFF('platform.editor.a11y-column-resizing_emcvz') ? getPluginState(_state4).isKeyboardResize : false;
292
+ var isKeyboardResize = getPluginState(_state4).isKeyboardResize;
297
293
  var tableCell = closestElement(element, 'td, th');
298
294
  var cellStartPosition = view.posAtDOM(tableCell, 0);
299
295
  var rect = findCellRectClosestToPos(_state4.doc.resolve(cellStartPosition));
@@ -349,10 +349,11 @@ var tablesPlugin = function tablesPlugin(_ref) {
349
349
  isHeaderColumnEnabled = _ref18.isHeaderColumnEnabled,
350
350
  isHeaderRowEnabled = _ref18.isHeaderRowEnabled,
351
351
  isDragAndDropEnabled = _ref18.isDragAndDropEnabled,
352
- tableWrapperTarget = _ref18.tableWrapperTarget;
352
+ tableWrapperTarget = _ref18.tableWrapperTarget,
353
+ isCellMenuOpenByKeyboard = _ref18.isCellMenuOpenByKeyboard;
353
354
  var allowControls = pluginConfig.allowControls;
354
355
  var stickyHeader = stickyHeadersState ? findStickyHeaderForTable(stickyHeadersState, tablePos) : undefined;
355
- return /*#__PURE__*/React.createElement(React.Fragment, null, targetCellPosition && tableRef && !isResizing && options && options.allowContextualMenu && /*#__PURE__*/React.createElement(FloatingContextualButton, {
356
+ return /*#__PURE__*/React.createElement(React.Fragment, null, targetCellPosition && (tableRef || getBooleanFF('platform.editor.a11y-table-context-menu_y4c9c') && isCellMenuOpenByKeyboard) && !isResizing && options && options.allowContextualMenu && /*#__PURE__*/React.createElement(FloatingContextualButton, {
356
357
  isNumberColumnEnabled: tableNode && tableNode.attrs.isNumberColumnEnabled,
357
358
  editorView: editorView,
358
359
  tableNode: tableNode,
@@ -362,7 +363,8 @@ var tablesPlugin = function tablesPlugin(_ref) {
362
363
  dispatchAnalyticsEvent: dispatchAnalyticsEvent,
363
364
  isContextualMenuOpen: isContextualMenuOpen,
364
365
  stickyHeader: stickyHeader,
365
- tableWrapper: tableWrapperTarget
366
+ tableWrapper: tableWrapperTarget,
367
+ isCellMenuOpenByKeyboard: isCellMenuOpenByKeyboard
366
368
  }), allowControls && /*#__PURE__*/React.createElement(FloatingInsertButton, {
367
369
  tableNode: tableNode,
368
370
  tableRef: tableRef,
@@ -390,7 +392,8 @@ var tablesPlugin = function tablesPlugin(_ref) {
390
392
  pluginConfig: pluginConfig,
391
393
  editorAnalyticsAPI: editorAnalyticsAPI,
392
394
  getEditorContainerWidth: defaultGetEditorContainerWidth,
393
- getEditorFeatureFlags: (options === null || options === void 0 ? void 0 : options.getEditorFeatureFlags) || defaultGetEditorFeatureFlags
395
+ getEditorFeatureFlags: (options === null || options === void 0 ? void 0 : options.getEditorFeatureFlags) || defaultGetEditorFeatureFlags,
396
+ isCellMenuOpenByKeyboard: isCellMenuOpenByKeyboard
394
397
  }), isDragAndDropEnabled && /*#__PURE__*/React.createElement(FloatingDragMenu, {
395
398
  editorView: editorView,
396
399
  mountPoint: popupsMountPoint,
@@ -1,9 +1,9 @@
1
1
  import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
2
- import { addColumnAfter, addColumnAfterVO, addColumnBefore, addColumnBeforeVO, addRowAfter, addRowAfterVO, addRowBefore, addRowBeforeVO, backspace, bindKeymapWithCommand, decreaseMediaSize, deleteColumn, deleteRow, escape, increaseMediaSize, moveColumnLeft, moveColumnRight, moveLeft, moveRight, moveRowDown, moveRowUp, nextCell, previousCell, startColumnResizing, toggleTable } from '@atlaskit/editor-common/keymaps';
2
+ import { addColumnAfter, addColumnAfterVO, addColumnBefore, addColumnBeforeVO, addRowAfter, addRowAfterVO, addRowBefore, addRowBeforeVO, backspace, bindKeymapWithCommand, decreaseMediaSize, deleteColumn, deleteRow, escape, focusToContextMenuTrigger, increaseMediaSize, moveColumnLeft, moveColumnRight, moveLeft, moveRight, moveRowDown, moveRowUp, nextCell, previousCell, startColumnResizing, toggleTable } from '@atlaskit/editor-common/keymaps';
3
3
  import { chainCommands } from '@atlaskit/editor-prosemirror/commands';
4
4
  import { keymap } from '@atlaskit/editor-prosemirror/keymap';
5
5
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
6
- import { goToNextCell, moveCursorBackward } from '../commands';
6
+ import { goToNextCell, moveCursorBackward, setFocusToCellMenu } from '../commands';
7
7
  import { addRowAroundSelection, changeColumnWidthByStepWithAnalytics, deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut, deleteTableIfSelectedWithAnalytics, emptyMultipleCellsWithAnalytics } from '../commands-with-analytics';
8
8
  import { activateNextResizeArea, initiateKeyboardColumnResizing, stopKeyboardColumnResizing } from '../commands/column-resize';
9
9
  import { addColumnAfter as addColumnAfterCommand, addColumnBefore as addColumnBeforeCommand, createTable } from '../commands/insert';
@@ -55,27 +55,28 @@ export function keymapPlugin(getEditorContainerWidth, editorAnalyticsAPI, dragAn
55
55
  bindKeymapWithCommand(deleteColumn.common, deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut(editorAnalyticsAPI, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent), list);
56
56
  bindKeymapWithCommand(deleteRow.common, deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut(editorAnalyticsAPI, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent), list);
57
57
  }
58
- if (getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
59
- bindKeymapWithCommand(startColumnResizing.common, initiateKeyboardColumnResizing({
60
- ariaNotify: ariaNotifyPlugin,
61
- getIntl: getIntl
62
- }), list);
63
- bindKeymapWithCommand(moveRight.common, activateNextResizeArea({
64
- direction: 1,
65
- ariaNotify: ariaNotifyPlugin,
66
- getIntl: getIntl
67
- }), list);
68
- bindKeymapWithCommand(moveLeft.common, activateNextResizeArea({
69
- direction: -1,
70
- ariaNotify: ariaNotifyPlugin,
71
- getIntl: getIntl
72
- }), list);
73
- bindKeymapWithCommand(decreaseMediaSize.common, changeColumnWidthByStepWithAnalytics(editorAnalyticsAPI)(-10, getEditorContainerWidth, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, INPUT_METHOD.SHORTCUT, ariaNotifyPlugin, getIntl), list);
74
- bindKeymapWithCommand(increaseMediaSize.common, changeColumnWidthByStepWithAnalytics(editorAnalyticsAPI)(10, getEditorContainerWidth, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, INPUT_METHOD.SHORTCUT, ariaNotifyPlugin, getIntl), list);
75
- bindKeymapWithCommand(escape.common, stopKeyboardColumnResizing({
76
- ariaNotify: ariaNotifyPlugin,
77
- getIntl: getIntl
78
- }), list);
58
+ bindKeymapWithCommand(startColumnResizing.common, initiateKeyboardColumnResizing({
59
+ ariaNotify: ariaNotifyPlugin,
60
+ getIntl: getIntl
61
+ }), list);
62
+ bindKeymapWithCommand(moveRight.common, activateNextResizeArea({
63
+ direction: 1,
64
+ ariaNotify: ariaNotifyPlugin,
65
+ getIntl: getIntl
66
+ }), list);
67
+ bindKeymapWithCommand(moveLeft.common, activateNextResizeArea({
68
+ direction: -1,
69
+ ariaNotify: ariaNotifyPlugin,
70
+ getIntl: getIntl
71
+ }), list);
72
+ bindKeymapWithCommand(decreaseMediaSize.common, changeColumnWidthByStepWithAnalytics(editorAnalyticsAPI)(-10, getEditorContainerWidth, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, INPUT_METHOD.SHORTCUT, ariaNotifyPlugin, getIntl), list);
73
+ bindKeymapWithCommand(increaseMediaSize.common, changeColumnWidthByStepWithAnalytics(editorAnalyticsAPI)(10, getEditorContainerWidth, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, INPUT_METHOD.SHORTCUT, ariaNotifyPlugin, getIntl), list);
74
+ bindKeymapWithCommand(escape.common, stopKeyboardColumnResizing({
75
+ ariaNotify: ariaNotifyPlugin,
76
+ getIntl: getIntl
77
+ }), list);
78
+ if (getBooleanFF('platform.editor.a11y-table-context-menu_y4c9c')) {
79
+ bindKeymapWithCommand(focusToContextMenuTrigger.common, setFocusToCellMenu(), list);
79
80
  }
80
81
  return keymap(list);
81
82
  }
@@ -110,31 +110,29 @@ export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch
110
110
  tableRef = parent.querySelector('table') || undefined;
111
111
  }
112
112
  var tableNode = findTable(state.selection);
113
- if (getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
114
- // when keyboard cursor leaves the table we need to stop column resizing
115
- var pluginPrevState = getPluginState(prevState);
116
- var isStopKeyboardColumResizing = pluginPrevState.isResizeHandleWidgetAdded && pluginPrevState.isKeyboardResize;
117
- if (isStopKeyboardColumResizing) {
118
- var isTableNodesDifferent = (pluginPrevState === null || pluginPrevState === void 0 ? void 0 : pluginPrevState.tableNode) !== (tableNode === null || tableNode === void 0 ? void 0 : tableNode.node);
119
- if (pluginPrevState !== null && pluginPrevState !== void 0 && pluginPrevState.tableNode && tableNode && isTableNodesDifferent) {
120
- var oldRowsNumber = TableMap.get(pluginPrevState.tableNode).height;
121
- var newRowsNumber = TableMap.get(tableNode.node).height;
122
- if (oldRowsNumber !== newRowsNumber ||
123
- // Add/delete row
124
- tableNode.node.attrs.localId !== pluginPrevState.tableNode.attrs.localId) {
125
- // Jump to another table
126
- stopKeyboardColumnResizing({
127
- ariaNotify: ariaNotifyPlugin,
128
- getIntl: getIntl
129
- })(state, dispatch);
130
- }
131
- } else if (!tableNode) {
132
- // selection outside of table
113
+ // when keyboard cursor leaves the table we need to stop column resizing
114
+ var pluginPrevState = getPluginState(prevState);
115
+ var isStopKeyboardColumResizing = pluginPrevState.isResizeHandleWidgetAdded && pluginPrevState.isKeyboardResize;
116
+ if (isStopKeyboardColumResizing) {
117
+ var isTableNodesDifferent = (pluginPrevState === null || pluginPrevState === void 0 ? void 0 : pluginPrevState.tableNode) !== (tableNode === null || tableNode === void 0 ? void 0 : tableNode.node);
118
+ if (pluginPrevState !== null && pluginPrevState !== void 0 && pluginPrevState.tableNode && tableNode && isTableNodesDifferent) {
119
+ var oldRowsNumber = TableMap.get(pluginPrevState.tableNode).height;
120
+ var newRowsNumber = TableMap.get(tableNode.node).height;
121
+ if (oldRowsNumber !== newRowsNumber ||
122
+ // Add/delete row
123
+ tableNode.node.attrs.localId !== pluginPrevState.tableNode.attrs.localId) {
124
+ // Jump to another table
133
125
  stopKeyboardColumnResizing({
134
126
  ariaNotify: ariaNotifyPlugin,
135
127
  getIntl: getIntl
136
128
  })(state, dispatch);
137
129
  }
130
+ } else if (!tableNode) {
131
+ // selection outside of table
132
+ stopKeyboardColumnResizing({
133
+ ariaNotify: ariaNotifyPlugin,
134
+ getIntl: getIntl
135
+ })(state, dispatch);
138
136
  }
139
137
  }
140
138
  }
@@ -236,16 +234,14 @@ export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch
236
234
  handleTextInput: function handleTextInput(view, _from, _to, text) {
237
235
  var state = view.state,
238
236
  dispatch = view.dispatch;
239
- if (getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
240
- var _getPluginState = getPluginState(state),
241
- isKeyboardResize = _getPluginState.isKeyboardResize;
242
- if (isKeyboardResize) {
243
- stopKeyboardColumnResizing({
244
- ariaNotify: ariaNotifyPlugin,
245
- getIntl: getIntl
246
- })(state, dispatch);
247
- return false;
248
- }
237
+ var _getPluginState = getPluginState(state),
238
+ isKeyboardResize = _getPluginState.isKeyboardResize;
239
+ if (isKeyboardResize) {
240
+ stopKeyboardColumnResizing({
241
+ ariaNotify: ariaNotifyPlugin,
242
+ getIntl: getIntl
243
+ })(state, dispatch);
244
+ return false;
249
245
  }
250
246
  var tr = replaceSelectedTable(state, text, INPUT_METHOD.KEYBOARD, editorAnalyticsAPI);
251
247
  if (tr.selectionSet) {
@@ -109,15 +109,11 @@ export var handleMouseDown = function handleMouseDown(view, event, localResizeHa
109
109
 
110
110
  // If we let go in the same place we started, don't need to do anything.
111
111
  if (dragging && clientX === dragging.startX) {
112
- if (getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
113
- if (isKeyboardResize || !isTableHovered) {
114
- /** if column resize had started via keyboard but continued by mouse
115
- * or mouse pointer leaves the table but mouse button still pressed
116
- */
117
- return stopKeyboardColumnResizing({})(state, dispatch, view);
118
- } else {
119
- return stopResizing()(state, dispatch);
120
- }
112
+ if (isKeyboardResize || !isTableHovered) {
113
+ /** if column resize had started via keyboard but continued by mouse
114
+ * or mouse pointer leaves the table but mouse button still pressed
115
+ */
116
+ return stopKeyboardColumnResizing({})(state, dispatch, view);
121
117
  } else {
122
118
  return stopResizing()(state, dispatch);
123
119
  }
@@ -184,17 +180,13 @@ export var handleMouseDown = function handleMouseDown(view, event, localResizeHa
184
180
  }
185
181
  })(tr);
186
182
  }
187
- if (getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
188
- if (isKeyboardResize || !isTableHovered) {
189
- /** if column resize had started via keyboard but continued by mouse
190
- * or mouse pointer leaves the table but mouse button still pressed
191
- */
192
- return stopKeyboardColumnResizing({
193
- originalTr: tr
194
- })(state, dispatch, view);
195
- } else {
196
- return stopResizing(tr)(state, dispatch);
197
- }
183
+ if (isKeyboardResize || !isTableHovered) {
184
+ /** if column resize had started via keyboard but continued by mouse
185
+ * or mouse pointer leaves the table but mouse button still pressed
186
+ */
187
+ return stopKeyboardColumnResizing({
188
+ originalTr: tr
189
+ })(state, dispatch, view);
198
190
  } else {
199
191
  return stopResizing(tr)(state, dispatch);
200
192
  }
@@ -209,7 +201,7 @@ export var handleMouseDown = function handleMouseDown(view, event, localResizeHa
209
201
  resizeHandlePos = _getPluginState2.resizeHandlePos;
210
202
  var _getTablePluginState3 = getTablePluginState(state),
211
203
  isTableHovered = _getTablePluginState3.isTableHovered;
212
- if (!which || !dragging || resizeHandlePos === null || !pointsAtCell(state.doc.resolve(resizeHandlePos)) || !isTableHovered && getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
204
+ if (!which || !dragging || resizeHandlePos === null || !pointsAtCell(state.doc.resolve(resizeHandlePos)) || !isTableHovered) {
213
205
  return finish(event);
214
206
  }
215
207
  var $cell = state.doc.resolve(resizeHandlePos);
@@ -1,7 +1,6 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import classnames from 'classnames';
3
3
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
4
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
5
4
  import { TableCssClassName as ClassName } from '../../types';
6
5
  import { getPluginState as getTablePluginState } from '../plugin-factory';
7
6
  import { setResizeHandlePos } from './commands';
@@ -37,16 +36,14 @@ export function createPlugin(dispatch, _ref, getEditorContainerWidth, getEditorF
37
36
  var _getPluginState = getPluginState(state),
38
37
  dragging = _getPluginState.dragging;
39
38
  var isColumnKeyboardResizeStarted = false;
40
- if (getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
41
- /*
42
- We need to start listening mouse events if column resize started from keyboard.
43
- This will allow continue resizing via mouse
44
- */
45
- var _getTablePluginState = getTablePluginState(state),
46
- isKeyboardResize = _getTablePluginState.isKeyboardResize;
47
- if (isKeyboardResize) {
48
- isColumnKeyboardResizeStarted = isKeyboardResize;
49
- }
39
+ /*
40
+ We need to start listening mouse events if column resize started from keyboard.
41
+ This will allow continue resizing via mouse
42
+ */
43
+ var _getTablePluginState = getTablePluginState(state),
44
+ isKeyboardResize = _getTablePluginState.isKeyboardResize;
45
+ if (isKeyboardResize) {
46
+ isColumnKeyboardResizeStarted = isKeyboardResize;
50
47
  }
51
48
  if (resizeHandlePos !== null && (!dragging || isColumnKeyboardResizeStarted)) {
52
49
  if (handleMouseDown(view, event, resizeHandlePos, getEditorContainerWidth, getEditorFeatureFlags, isTableScalingEnabled || false, editorAnalyticsAPI, isNewColumnResizingEnabled)) {
@@ -95,6 +95,7 @@ export default (function (pluginState, action) {
95
95
  case 'HOVER_CELL':
96
96
  case 'SHOW_RESIZE_HANDLE_LINE':
97
97
  case 'SET_EDITOR_FOCUS':
98
+ case 'SET_CELL_MENU_OPEN':
98
99
  return _objectSpread(_objectSpread({}, pluginState), action.data);
99
100
  default:
100
101
  return pluginState;
@@ -1,5 +1,5 @@
1
1
  /** @jsx jsx */
2
- import React from 'react';
2
+ import React, { useEffect } from 'react';
3
3
 
4
4
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
5
5
  import { jsx } from '@emotion/react';
@@ -12,6 +12,7 @@ import { ToolbarButton } from '@atlaskit/editor-common/ui-menu';
12
12
  import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
13
13
  import { akEditorSmallZIndex } from '@atlaskit/editor-shared-styles';
14
14
  import ExpandIcon from '@atlaskit/icon/glyph/chevron-down';
15
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
15
16
  import { toggleContextualMenu } from '../../commands';
16
17
  import { TableCssClassName as ClassName } from '../../types';
17
18
  import FixedButton from './FixedButton';
@@ -25,6 +26,7 @@ var FloatingContextualButtonInner = /*#__PURE__*/React.memo(function (props) {
25
26
  stickyHeader = props.stickyHeader,
26
27
  tableWrapper = props.tableWrapper,
27
28
  targetCellPosition = props.targetCellPosition,
29
+ isCellMenuOpenByKeyboard = props.isCellMenuOpenByKeyboard,
28
30
  formatMessage = props.intl.formatMessage; // : Props & WrappedComponentProps
29
31
 
30
32
  var handleClick = function handleClick() {
@@ -42,6 +44,16 @@ var FloatingContextualButtonInner = /*#__PURE__*/React.memo(function (props) {
42
44
  var domAtPos = editorView.domAtPos.bind(editorView);
43
45
  var targetCellRef;
44
46
  targetCellRef = findDomRefAtPos(targetCellPosition, domAtPos);
47
+ useEffect(function () {
48
+ if (getBooleanFF('platform.editor.a11y-table-context-menu_y4c9c')) {
49
+ if (isCellMenuOpenByKeyboard && !isContextualMenuOpen) {
50
+ var state = editorView.state,
51
+ dispatch = editorView.dispatch;
52
+ // open the menu when the keyboard shortcut is pressed
53
+ toggleContextualMenu()(state, dispatch);
54
+ }
55
+ }
56
+ }, [isCellMenuOpenByKeyboard, isContextualMenuOpen, editorView]);
45
57
  if (!targetCellRef || !(targetCellRef instanceof HTMLElement)) {
46
58
  return null;
47
59
  }
@@ -62,7 +74,8 @@ var FloatingContextualButtonInner = /*#__PURE__*/React.memo(function (props) {
62
74
  iconBefore: jsx(ExpandIcon, {
63
75
  label: ""
64
76
  }),
65
- "aria-label": labelCellOptions
77
+ "aria-label": labelCellOptions,
78
+ "aria-expanded": getBooleanFF('platform.editor.a11y-table-context-menu_y4c9c') ? isContextualMenuOpen : undefined
66
79
  }));
67
80
  var parentSticky = targetCellRef.parentElement && targetCellRef.parentElement.className.indexOf('sticky') > -1;
68
81
  if (stickyHeader && parentSticky && tableWrapper) {