@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
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @atlaskit/editor-plugin-table
2
2
 
3
+ ## 7.18.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [#113338](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/113338)
8
+ [`6b5439f51eab4`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/6b5439f51eab4) -
9
+ ECA11Y-5 remove FF from codebase
10
+
11
+ ## 7.18.3
12
+
13
+ ### Patch Changes
14
+
15
+ - [#115110](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/115110)
16
+ [`c6f8e2be84f70`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/c6f8e2be84f70) -
17
+ ECA11Y-20/ECA11Y-59 Make table cell options menu accessible for keyboard only users
18
+
3
19
  ## 7.18.2
4
20
 
5
21
  ### Patch Changes
@@ -71,9 +71,6 @@ var initiateKeyboardColumnResizing = exports.initiateKeyboardColumnResizing = fu
71
71
  var ariaNotify = _ref.ariaNotify,
72
72
  getIntl = _ref.getIntl;
73
73
  return function (state, dispatch, view) {
74
- if (!(0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-column-resizing_emcvz')) {
75
- return false;
76
- }
77
74
  var selection = state.selection;
78
75
  var selectionRect = (0, _utils.isSelectionType)(selection, 'cell') ? (0, _utils.getSelectionRect)(selection) : (0, _utils.findCellRectClosestToPos)(selection.$from);
79
76
  var cell = (0, _utils.findCellClosestToPos)(selection.$from);
@@ -93,9 +90,6 @@ var activateNextResizeArea = exports.activateNextResizeArea = function activateN
93
90
  ariaNotify = _ref2.ariaNotify,
94
91
  getIntl = _ref2.getIntl;
95
92
  return function (state, dispatch, view) {
96
- if (!(0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-column-resizing_emcvz')) {
97
- return false;
98
- }
99
93
  var _ref3 = (0, _pluginFactory2.getPluginState)(state) || {},
100
94
  resizeHandlePos = _ref3.resizeHandlePos;
101
95
  // If No resizing has initiated, skip to regular handler
@@ -168,9 +162,6 @@ var changeColumnWidthByStep = exports.changeColumnWidthByStep = function changeC
168
162
  var fakeDispatch = function fakeDispatch(tr) {
169
163
  customTr = tr;
170
164
  };
171
- if (!(0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-column-resizing_emcvz')) {
172
- return false;
173
- }
174
165
  var _getTableResizingPlug = (0, _pluginFactory2.getPluginState)(state),
175
166
  resizeHandlePos = _getTableResizingPlug.resizeHandlePos;
176
167
  var cell = (0, _utils.findCellClosestToPos)(state.selection.$from);
@@ -258,9 +249,6 @@ var stopKeyboardColumnResizing = exports.stopKeyboardColumnResizing = function s
258
249
  getIntl = _ref5.getIntl,
259
250
  originalTr = _ref5.originalTr;
260
251
  return function (state, dispatch) {
261
- if (!(0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-column-resizing_emcvz')) {
262
- return false;
263
- }
264
252
  var customTr = originalTr || state.tr;
265
253
  var fakeDispatch = function fakeDispatch(tr) {
266
254
  customTr = tr;
@@ -8,7 +8,6 @@ var _analytics = require("@atlaskit/editor-common/analytics");
8
8
  var _utils = require("@atlaskit/editor-prosemirror/utils");
9
9
  var _tableMap = require("@atlaskit/editor-tables/table-map");
10
10
  var _utils2 = require("@atlaskit/editor-tables/utils");
11
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
12
11
  var _commandsWithAnalytics = require("../commands-with-analytics");
13
12
  var _pluginFactory = require("../pm-plugins/plugin-factory");
14
13
  var _columnResize = require("./column-resize");
@@ -19,20 +18,18 @@ var TAB_BACKWARD_DIRECTION = -1;
19
18
  var goToNextCell = exports.goToNextCell = function goToNextCell(editorAnalyticsAPI, ariaNotify, getIntl) {
20
19
  return function (direction) {
21
20
  return function (state, dispatch, view) {
21
+ var _getPluginState;
22
22
  var table = (0, _utils2.findTable)(state.selection);
23
23
  if (!table) {
24
24
  return false;
25
25
  }
26
- if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-column-resizing_emcvz')) {
27
- var _getPluginState;
28
- var isColumnResizing = (_getPluginState = (0, _pluginFactory.getPluginState)(state)) === null || _getPluginState === void 0 ? void 0 : _getPluginState.isKeyboardResize;
29
- if (isColumnResizing) {
30
- (0, _columnResize.stopKeyboardColumnResizing)({
31
- ariaNotify: ariaNotify,
32
- getIntl: getIntl
33
- })(state, dispatch, view);
34
- return true;
35
- }
26
+ var isColumnResizing = (_getPluginState = (0, _pluginFactory.getPluginState)(state)) === null || _getPluginState === void 0 ? void 0 : _getPluginState.isKeyboardResize;
27
+ if (isColumnResizing) {
28
+ (0, _columnResize.stopKeyboardColumnResizing)({
29
+ ariaNotify: ariaNotify,
30
+ getIntl: getIntl
31
+ })(state, dispatch, view);
32
+ return true;
36
33
  }
37
34
  var map = _tableMap.TableMap.get(table.node);
38
35
  var _state$schema$nodes = state.schema.nodes,
@@ -165,6 +165,12 @@ Object.defineProperty(exports, "setEditorFocus", {
165
165
  return _misc.setEditorFocus;
166
166
  }
167
167
  });
168
+ Object.defineProperty(exports, "setFocusToCellMenu", {
169
+ enumerable: true,
170
+ get: function get() {
171
+ return _misc.setFocusToCellMenu;
172
+ }
173
+ });
168
174
  Object.defineProperty(exports, "setMultipleCellAttrs", {
169
175
  enumerable: true,
170
176
  get: function get() {
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.updateWidthToWidest = exports.updateResizeHandleDecorations = exports.triggerUnlessTableHeader = exports.transformSliceToRemoveColumnsWidths = exports.transformSliceToAddTableHeaders = exports.transformSliceRemoveCellBackgroundColor = exports.showInsertRowButton = exports.showInsertColumnButton = exports.setTableRef = exports.setTableAlignmentWithTableContentWithPos = exports.setTableAlignment = exports.setMultipleCellAttrs = exports.setEditorFocus = exports.setCellAttr = exports.selectRows = exports.selectRow = exports.selectColumns = exports.selectColumn = exports.removeResizeHandleDecorations = exports.moveCursorBackward = exports.isInsideFirstCellOfRowOrColumn = exports.hideInsertColumnOrRowButton = exports.getTableSelectionType = exports.getTableElementMoveTypeBySlice = exports.deleteTableIfSelected = exports.deleteTable = exports.countCellsInSlice = exports.convertFirstRowToHeader = exports.autoSizeTable = exports.addResizeHandleDecorations = exports.addBoldInEmptyHeaderCells = void 0;
7
+ exports.updateWidthToWidest = exports.updateResizeHandleDecorations = exports.triggerUnlessTableHeader = exports.transformSliceToRemoveColumnsWidths = exports.transformSliceToAddTableHeaders = exports.transformSliceRemoveCellBackgroundColor = exports.showInsertRowButton = exports.showInsertColumnButton = exports.setTableRef = exports.setTableAlignmentWithTableContentWithPos = exports.setTableAlignment = exports.setMultipleCellAttrs = exports.setFocusToCellMenu = exports.setEditorFocus = exports.setCellAttr = exports.selectRows = exports.selectRow = exports.selectColumns = exports.selectColumn = exports.removeResizeHandleDecorations = exports.moveCursorBackward = exports.isInsideFirstCellOfRowOrColumn = exports.hideInsertColumnOrRowButton = exports.getTableSelectionType = exports.getTableElementMoveTypeBySlice = exports.deleteTableIfSelected = exports.deleteTable = exports.countCellsInSlice = exports.convertFirstRowToHeader = exports.autoSizeTable = exports.addResizeHandleDecorations = exports.addBoldInEmptyHeaderCells = void 0;
8
8
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
9
9
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
10
  var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
@@ -626,4 +626,18 @@ var setTableAlignmentWithTableContentWithPos = exports.setTableAlignmentWithTabl
626
626
  tr.setNodeMarkup(tableNodeWithPos.pos, undefined, nextTableAttrs).setMeta('scrollIntoView', false);
627
627
  return tr;
628
628
  };
629
+ };
630
+ var setFocusToCellMenu = exports.setFocusToCellMenu = function setFocusToCellMenu() {
631
+ var isCellMenuOpenByKeyboard = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
632
+ var originalTr = arguments.length > 1 ? arguments[1] : undefined;
633
+ return (0, _pluginFactory.createCommand)(function () {
634
+ return {
635
+ type: 'SET_CELL_MENU_OPEN',
636
+ data: {
637
+ isCellMenuOpenByKeyboard: isCellMenuOpenByKeyboard
638
+ }
639
+ };
640
+ }, function (tr) {
641
+ return (originalTr || tr).setMeta('addToHistory', false);
642
+ });
629
643
  };
@@ -9,7 +9,6 @@ var _state = require("@atlaskit/editor-prosemirror/state");
9
9
  var _cellSelection = require("@atlaskit/editor-tables/cell-selection");
10
10
  var _tableMap = require("@atlaskit/editor-tables/table-map");
11
11
  var _utils = require("@atlaskit/editor-tables/utils");
12
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
13
12
  var _misc = require("../commands/misc");
14
13
  var _pluginFactory = require("../pm-plugins/plugin-factory");
15
14
  var _toolbar = require("../toolbar");
@@ -202,11 +201,8 @@ var arrowLeftFromText = function arrowLeftFromText(editorSelectionAPI) {
202
201
  var table = (0, _utils.findTable)(selection);
203
202
  if (table) {
204
203
  var $from = selection.$from;
205
- var isColumnResizing = false;
206
- if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-column-resizing_emcvz')) {
207
- var columResizePluginState = (0, _pluginFactory.getPluginState)(state) || {};
208
- isColumnResizing = Boolean(columResizePluginState === null || columResizePluginState === void 0 ? void 0 : columResizePluginState.isKeyboardResize);
209
- }
204
+ var columResizePluginState = (0, _pluginFactory.getPluginState)(state) || {};
205
+ var isColumnResizing = Boolean(columResizePluginState === null || columResizePluginState === void 0 ? void 0 : columResizePluginState.isKeyboardResize);
210
206
  if (isSelectionAtStartOfTable($from, selection) && $from.parent.type.name === 'paragraph' && $from.depth === table.depth + 3 &&
211
207
  // + 3 for: row, cell & paragraph nodes
212
208
  editorSelectionAPI && !isColumnResizing) {
@@ -236,11 +232,8 @@ var arrowRightFromText = function arrowRightFromText(editorSelectionAPI) {
236
232
  var table = (0, _utils.findTable)(selection);
237
233
  if (table) {
238
234
  var $to = selection.$to;
239
- var isColumnResizing = false;
240
- if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-column-resizing_emcvz')) {
241
- var columResizePluginState = (0, _pluginFactory.getPluginState)(state) || {};
242
- isColumnResizing = Boolean(columResizePluginState === null || columResizePluginState === void 0 ? void 0 : columResizePluginState.isKeyboardResize);
243
- }
235
+ var columResizePluginState = (0, _pluginFactory.getPluginState)(state) || {};
236
+ var isColumnResizing = Boolean(columResizePluginState === null || columResizePluginState === void 0 ? void 0 : columResizePluginState.isKeyboardResize);
244
237
  if (isSelectionAtEndOfTable($to, selection) && $to.parent.type.name === 'paragraph' && $to.depth === table.depth + 3 &&
245
238
  // + 3 for: row, cell & paragraph nodes
246
239
  !isColumnResizing) {
@@ -199,17 +199,13 @@ var handleMouseOut = exports.handleMouseOut = function handleMouseOut(view, mous
199
199
  if ((0, _utils3.isResizeHandleDecoration)(target) && !(0, _utils3.isResizeHandleDecoration)(relatedTarget)) {
200
200
  var _state2 = view.state,
201
201
  _dispatch3 = view.dispatch;
202
- if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-column-resizing_emcvz')) {
203
- var _getPluginState3 = (0, _pluginFactory2.getPluginState)(_state2),
204
- isKeyboardResize = _getPluginState3.isKeyboardResize;
205
- if (isKeyboardResize) {
206
- // no need to hide decoration if column resizing started by keyboard
207
- return false;
208
- }
209
- return (0, _commands.hideResizeHandleLine)()(_state2, _dispatch3);
210
- } else {
211
- return (0, _commands.hideResizeHandleLine)()(_state2, _dispatch3);
202
+ var _getPluginState3 = (0, _pluginFactory2.getPluginState)(_state2),
203
+ isKeyboardResize = _getPluginState3.isKeyboardResize;
204
+ if (isKeyboardResize) {
205
+ // no need to hide decoration if column resizing started by keyboard
206
+ return false;
212
207
  }
208
+ return (0, _commands.hideResizeHandleLine)()(_state2, _dispatch3);
213
209
  }
214
210
  return false;
215
211
  };
@@ -302,7 +298,7 @@ var handleMouseMoveDebounce = (0, _rafSchd.default)(function (view, event, offse
302
298
  var _getPluginState8 = (0, _pluginFactory2.getPluginState)(_state4),
303
299
  resizeHandleColumnIndex = _getPluginState8.resizeHandleColumnIndex,
304
300
  resizeHandleRowIndex = _getPluginState8.resizeHandleRowIndex;
305
- var isKeyboardResize = (0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-column-resizing_emcvz') ? (0, _pluginFactory2.getPluginState)(_state4).isKeyboardResize : false;
301
+ var isKeyboardResize = (0, _pluginFactory2.getPluginState)(_state4).isKeyboardResize;
306
302
  var tableCell = (0, _utils.closestElement)(element, 'td, th');
307
303
  var cellStartPosition = view.posAtDOM(tableCell, 0);
308
304
  var rect = (0, _utils2.findCellRectClosestToPos)(_state4.doc.resolve(cellStartPosition));
@@ -356,10 +356,11 @@ var tablesPlugin = function tablesPlugin(_ref) {
356
356
  isHeaderColumnEnabled = _ref18.isHeaderColumnEnabled,
357
357
  isHeaderRowEnabled = _ref18.isHeaderRowEnabled,
358
358
  isDragAndDropEnabled = _ref18.isDragAndDropEnabled,
359
- tableWrapperTarget = _ref18.tableWrapperTarget;
359
+ tableWrapperTarget = _ref18.tableWrapperTarget,
360
+ isCellMenuOpenByKeyboard = _ref18.isCellMenuOpenByKeyboard;
360
361
  var allowControls = pluginConfig.allowControls;
361
362
  var stickyHeader = stickyHeadersState ? (0, _stickyHeaders.findStickyHeaderForTable)(stickyHeadersState, tablePos) : undefined;
362
- return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, targetCellPosition && tableRef && !isResizing && options && options.allowContextualMenu && /*#__PURE__*/_react.default.createElement(_FloatingContextualButton.default, {
363
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, targetCellPosition && (tableRef || (0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-table-context-menu_y4c9c') && isCellMenuOpenByKeyboard) && !isResizing && options && options.allowContextualMenu && /*#__PURE__*/_react.default.createElement(_FloatingContextualButton.default, {
363
364
  isNumberColumnEnabled: tableNode && tableNode.attrs.isNumberColumnEnabled,
364
365
  editorView: editorView,
365
366
  tableNode: tableNode,
@@ -369,7 +370,8 @@ var tablesPlugin = function tablesPlugin(_ref) {
369
370
  dispatchAnalyticsEvent: dispatchAnalyticsEvent,
370
371
  isContextualMenuOpen: isContextualMenuOpen,
371
372
  stickyHeader: stickyHeader,
372
- tableWrapper: tableWrapperTarget
373
+ tableWrapper: tableWrapperTarget,
374
+ isCellMenuOpenByKeyboard: isCellMenuOpenByKeyboard
373
375
  }), allowControls && /*#__PURE__*/_react.default.createElement(_FloatingInsertButton.default, {
374
376
  tableNode: tableNode,
375
377
  tableRef: tableRef,
@@ -397,7 +399,8 @@ var tablesPlugin = function tablesPlugin(_ref) {
397
399
  pluginConfig: pluginConfig,
398
400
  editorAnalyticsAPI: editorAnalyticsAPI,
399
401
  getEditorContainerWidth: defaultGetEditorContainerWidth,
400
- getEditorFeatureFlags: (options === null || options === void 0 ? void 0 : options.getEditorFeatureFlags) || defaultGetEditorFeatureFlags
402
+ getEditorFeatureFlags: (options === null || options === void 0 ? void 0 : options.getEditorFeatureFlags) || defaultGetEditorFeatureFlags,
403
+ isCellMenuOpenByKeyboard: isCellMenuOpenByKeyboard
401
404
  }), isDragAndDropEnabled && /*#__PURE__*/_react.default.createElement(_FloatingDragMenu.default, {
402
405
  editorView: editorView,
403
406
  mountPoint: popupsMountPoint,
@@ -62,27 +62,28 @@ function keymapPlugin(getEditorContainerWidth, editorAnalyticsAPI, dragAndDropEn
62
62
  (0, _keymaps.bindKeymapWithCommand)(_keymaps.deleteColumn.common, (0, _commandsWithAnalytics.deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut)(editorAnalyticsAPI, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent), list);
63
63
  (0, _keymaps.bindKeymapWithCommand)(_keymaps.deleteRow.common, (0, _commandsWithAnalytics.deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut)(editorAnalyticsAPI, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent), list);
64
64
  }
65
- if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-column-resizing_emcvz')) {
66
- (0, _keymaps.bindKeymapWithCommand)(_keymaps.startColumnResizing.common, (0, _columnResize.initiateKeyboardColumnResizing)({
67
- ariaNotify: ariaNotifyPlugin,
68
- getIntl: getIntl
69
- }), list);
70
- (0, _keymaps.bindKeymapWithCommand)(_keymaps.moveRight.common, (0, _columnResize.activateNextResizeArea)({
71
- direction: 1,
72
- ariaNotify: ariaNotifyPlugin,
73
- getIntl: getIntl
74
- }), list);
75
- (0, _keymaps.bindKeymapWithCommand)(_keymaps.moveLeft.common, (0, _columnResize.activateNextResizeArea)({
76
- direction: -1,
77
- ariaNotify: ariaNotifyPlugin,
78
- getIntl: getIntl
79
- }), list);
80
- (0, _keymaps.bindKeymapWithCommand)(_keymaps.decreaseMediaSize.common, (0, _commandsWithAnalytics.changeColumnWidthByStepWithAnalytics)(editorAnalyticsAPI)(-10, getEditorContainerWidth, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, _analytics.INPUT_METHOD.SHORTCUT, ariaNotifyPlugin, getIntl), list);
81
- (0, _keymaps.bindKeymapWithCommand)(_keymaps.increaseMediaSize.common, (0, _commandsWithAnalytics.changeColumnWidthByStepWithAnalytics)(editorAnalyticsAPI)(10, getEditorContainerWidth, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, _analytics.INPUT_METHOD.SHORTCUT, ariaNotifyPlugin, getIntl), list);
82
- (0, _keymaps.bindKeymapWithCommand)(_keymaps.escape.common, (0, _columnResize.stopKeyboardColumnResizing)({
83
- ariaNotify: ariaNotifyPlugin,
84
- getIntl: getIntl
85
- }), list);
65
+ (0, _keymaps.bindKeymapWithCommand)(_keymaps.startColumnResizing.common, (0, _columnResize.initiateKeyboardColumnResizing)({
66
+ ariaNotify: ariaNotifyPlugin,
67
+ getIntl: getIntl
68
+ }), list);
69
+ (0, _keymaps.bindKeymapWithCommand)(_keymaps.moveRight.common, (0, _columnResize.activateNextResizeArea)({
70
+ direction: 1,
71
+ ariaNotify: ariaNotifyPlugin,
72
+ getIntl: getIntl
73
+ }), list);
74
+ (0, _keymaps.bindKeymapWithCommand)(_keymaps.moveLeft.common, (0, _columnResize.activateNextResizeArea)({
75
+ direction: -1,
76
+ ariaNotify: ariaNotifyPlugin,
77
+ getIntl: getIntl
78
+ }), list);
79
+ (0, _keymaps.bindKeymapWithCommand)(_keymaps.decreaseMediaSize.common, (0, _commandsWithAnalytics.changeColumnWidthByStepWithAnalytics)(editorAnalyticsAPI)(-10, getEditorContainerWidth, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, _analytics.INPUT_METHOD.SHORTCUT, ariaNotifyPlugin, getIntl), list);
80
+ (0, _keymaps.bindKeymapWithCommand)(_keymaps.increaseMediaSize.common, (0, _commandsWithAnalytics.changeColumnWidthByStepWithAnalytics)(editorAnalyticsAPI)(10, getEditorContainerWidth, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, _analytics.INPUT_METHOD.SHORTCUT, ariaNotifyPlugin, getIntl), list);
81
+ (0, _keymaps.bindKeymapWithCommand)(_keymaps.escape.common, (0, _columnResize.stopKeyboardColumnResizing)({
82
+ ariaNotify: ariaNotifyPlugin,
83
+ getIntl: getIntl
84
+ }), list);
85
+ if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-table-context-menu_y4c9c')) {
86
+ (0, _keymaps.bindKeymapWithCommand)(_keymaps.focusToContextMenuTrigger.common, (0, _commands2.setFocusToCellMenu)(), list);
86
87
  }
87
88
  return (0, _keymap.keymap)(list);
88
89
  }
@@ -117,31 +117,29 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatchAnalytic
117
117
  tableRef = parent.querySelector('table') || undefined;
118
118
  }
119
119
  var tableNode = (0, _utils3.findTable)(state.selection);
120
- if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-column-resizing_emcvz')) {
121
- // when keyboard cursor leaves the table we need to stop column resizing
122
- var pluginPrevState = (0, _pluginFactory.getPluginState)(prevState);
123
- var isStopKeyboardColumResizing = pluginPrevState.isResizeHandleWidgetAdded && pluginPrevState.isKeyboardResize;
124
- if (isStopKeyboardColumResizing) {
125
- var isTableNodesDifferent = (pluginPrevState === null || pluginPrevState === void 0 ? void 0 : pluginPrevState.tableNode) !== (tableNode === null || tableNode === void 0 ? void 0 : tableNode.node);
126
- if (pluginPrevState !== null && pluginPrevState !== void 0 && pluginPrevState.tableNode && tableNode && isTableNodesDifferent) {
127
- var oldRowsNumber = _editorTables.TableMap.get(pluginPrevState.tableNode).height;
128
- var newRowsNumber = _editorTables.TableMap.get(tableNode.node).height;
129
- if (oldRowsNumber !== newRowsNumber ||
130
- // Add/delete row
131
- tableNode.node.attrs.localId !== pluginPrevState.tableNode.attrs.localId) {
132
- // Jump to another table
133
- (0, _columnResize.stopKeyboardColumnResizing)({
134
- ariaNotify: ariaNotifyPlugin,
135
- getIntl: getIntl
136
- })(state, dispatch);
137
- }
138
- } else if (!tableNode) {
139
- // selection outside of table
120
+ // when keyboard cursor leaves the table we need to stop column resizing
121
+ var pluginPrevState = (0, _pluginFactory.getPluginState)(prevState);
122
+ var isStopKeyboardColumResizing = pluginPrevState.isResizeHandleWidgetAdded && pluginPrevState.isKeyboardResize;
123
+ if (isStopKeyboardColumResizing) {
124
+ var isTableNodesDifferent = (pluginPrevState === null || pluginPrevState === void 0 ? void 0 : pluginPrevState.tableNode) !== (tableNode === null || tableNode === void 0 ? void 0 : tableNode.node);
125
+ if (pluginPrevState !== null && pluginPrevState !== void 0 && pluginPrevState.tableNode && tableNode && isTableNodesDifferent) {
126
+ var oldRowsNumber = _editorTables.TableMap.get(pluginPrevState.tableNode).height;
127
+ var newRowsNumber = _editorTables.TableMap.get(tableNode.node).height;
128
+ if (oldRowsNumber !== newRowsNumber ||
129
+ // Add/delete row
130
+ tableNode.node.attrs.localId !== pluginPrevState.tableNode.attrs.localId) {
131
+ // Jump to another table
140
132
  (0, _columnResize.stopKeyboardColumnResizing)({
141
133
  ariaNotify: ariaNotifyPlugin,
142
134
  getIntl: getIntl
143
135
  })(state, dispatch);
144
136
  }
137
+ } else if (!tableNode) {
138
+ // selection outside of table
139
+ (0, _columnResize.stopKeyboardColumnResizing)({
140
+ ariaNotify: ariaNotifyPlugin,
141
+ getIntl: getIntl
142
+ })(state, dispatch);
145
143
  }
146
144
  }
147
145
  }
@@ -243,16 +241,14 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatchAnalytic
243
241
  handleTextInput: function handleTextInput(view, _from, _to, text) {
244
242
  var state = view.state,
245
243
  dispatch = view.dispatch;
246
- if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-column-resizing_emcvz')) {
247
- var _getPluginState = (0, _pluginFactory.getPluginState)(state),
248
- isKeyboardResize = _getPluginState.isKeyboardResize;
249
- if (isKeyboardResize) {
250
- (0, _columnResize.stopKeyboardColumnResizing)({
251
- ariaNotify: ariaNotifyPlugin,
252
- getIntl: getIntl
253
- })(state, dispatch);
254
- return false;
255
- }
244
+ var _getPluginState = (0, _pluginFactory.getPluginState)(state),
245
+ isKeyboardResize = _getPluginState.isKeyboardResize;
246
+ if (isKeyboardResize) {
247
+ (0, _columnResize.stopKeyboardColumnResizing)({
248
+ ariaNotify: ariaNotifyPlugin,
249
+ getIntl: getIntl
250
+ })(state, dispatch);
251
+ return false;
256
252
  }
257
253
  var tr = (0, _transforms2.replaceSelectedTable)(state, text, _analytics.INPUT_METHOD.KEYBOARD, editorAnalyticsAPI);
258
254
  if (tr.selectionSet) {
@@ -115,15 +115,11 @@ var handleMouseDown = exports.handleMouseDown = function handleMouseDown(view, e
115
115
 
116
116
  // If we let go in the same place we started, don't need to do anything.
117
117
  if (dragging && clientX === dragging.startX) {
118
- if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-column-resizing_emcvz')) {
119
- if (isKeyboardResize || !isTableHovered) {
120
- /** if column resize had started via keyboard but continued by mouse
121
- * or mouse pointer leaves the table but mouse button still pressed
122
- */
123
- return (0, _columnResize.stopKeyboardColumnResizing)({})(state, dispatch, view);
124
- } else {
125
- return (0, _commands.stopResizing)()(state, dispatch);
126
- }
118
+ if (isKeyboardResize || !isTableHovered) {
119
+ /** if column resize had started via keyboard but continued by mouse
120
+ * or mouse pointer leaves the table but mouse button still pressed
121
+ */
122
+ return (0, _columnResize.stopKeyboardColumnResizing)({})(state, dispatch, view);
127
123
  } else {
128
124
  return (0, _commands.stopResizing)()(state, dispatch);
129
125
  }
@@ -190,17 +186,13 @@ var handleMouseDown = exports.handleMouseDown = function handleMouseDown(view, e
190
186
  }
191
187
  })(tr);
192
188
  }
193
- if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-column-resizing_emcvz')) {
194
- if (isKeyboardResize || !isTableHovered) {
195
- /** if column resize had started via keyboard but continued by mouse
196
- * or mouse pointer leaves the table but mouse button still pressed
197
- */
198
- return (0, _columnResize.stopKeyboardColumnResizing)({
199
- originalTr: tr
200
- })(state, dispatch, view);
201
- } else {
202
- return (0, _commands.stopResizing)(tr)(state, dispatch);
203
- }
189
+ if (isKeyboardResize || !isTableHovered) {
190
+ /** if column resize had started via keyboard but continued by mouse
191
+ * or mouse pointer leaves the table but mouse button still pressed
192
+ */
193
+ return (0, _columnResize.stopKeyboardColumnResizing)({
194
+ originalTr: tr
195
+ })(state, dispatch, view);
204
196
  } else {
205
197
  return (0, _commands.stopResizing)(tr)(state, dispatch);
206
198
  }
@@ -215,7 +207,7 @@ var handleMouseDown = exports.handleMouseDown = function handleMouseDown(view, e
215
207
  resizeHandlePos = _getPluginState2.resizeHandlePos;
216
208
  var _getTablePluginState3 = (0, _pluginFactory.getPluginState)(state),
217
209
  isTableHovered = _getTablePluginState3.isTableHovered;
218
- if (!which || !dragging || resizeHandlePos === null || !(0, _utils3.pointsAtCell)(state.doc.resolve(resizeHandlePos)) || !isTableHovered && (0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-column-resizing_emcvz')) {
210
+ if (!which || !dragging || resizeHandlePos === null || !(0, _utils3.pointsAtCell)(state.doc.resolve(resizeHandlePos)) || !isTableHovered) {
219
211
  return finish(event);
220
212
  }
221
213
  var $cell = state.doc.resolve(resizeHandlePos);
@@ -8,7 +8,6 @@ exports.createPlugin = createPlugin;
8
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
9
  var _classnames2 = _interopRequireDefault(require("classnames"));
10
10
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
11
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
12
11
  var _types = require("../../types");
13
12
  var _pluginFactory = require("../plugin-factory");
14
13
  var _commands = require("./commands");
@@ -44,16 +43,14 @@ function createPlugin(dispatch, _ref, getEditorContainerWidth, getEditorFeatureF
44
43
  var _getPluginState = (0, _pluginFactory2.getPluginState)(state),
45
44
  dragging = _getPluginState.dragging;
46
45
  var isColumnKeyboardResizeStarted = false;
47
- if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-column-resizing_emcvz')) {
48
- /*
49
- We need to start listening mouse events if column resize started from keyboard.
50
- This will allow continue resizing via mouse
51
- */
52
- var _getTablePluginState = (0, _pluginFactory.getPluginState)(state),
53
- isKeyboardResize = _getTablePluginState.isKeyboardResize;
54
- if (isKeyboardResize) {
55
- isColumnKeyboardResizeStarted = isKeyboardResize;
56
- }
46
+ /*
47
+ We need to start listening mouse events if column resize started from keyboard.
48
+ This will allow continue resizing via mouse
49
+ */
50
+ var _getTablePluginState = (0, _pluginFactory.getPluginState)(state),
51
+ isKeyboardResize = _getTablePluginState.isKeyboardResize;
52
+ if (isKeyboardResize) {
53
+ isColumnKeyboardResizeStarted = isKeyboardResize;
57
54
  }
58
55
  if (resizeHandlePos !== null && (!dragging || isColumnKeyboardResizeStarted)) {
59
56
  if ((0, _eventHandlers.handleMouseDown)(view, event, resizeHandlePos, getEditorContainerWidth, getEditorFeatureFlags, isTableScalingEnabled || false, editorAnalyticsAPI, isNewColumnResizingEnabled)) {
@@ -102,6 +102,7 @@ var _default = exports.default = function _default(pluginState, action) {
102
102
  case 'HOVER_CELL':
103
103
  case 'SHOW_RESIZE_HANDLE_LINE':
104
104
  case 'SET_EDITOR_FOCUS':
105
+ case 'SET_CELL_MENU_OPEN':
105
106
  return _objectSpread(_objectSpread({}, pluginState), action.data);
106
107
  default:
107
108
  return pluginState;
@@ -1,11 +1,12 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _typeof = require("@babel/runtime/helpers/typeof");
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.default = _default;
8
- var _react = _interopRequireDefault(require("react"));
9
+ var _react = _interopRequireWildcard(require("react"));
9
10
  var _react2 = require("@emotion/react");
10
11
  var _reactIntlNext = require("react-intl-next");
11
12
  var _analytics = require("@atlaskit/editor-common/analytics");
@@ -16,10 +17,13 @@ var _uiMenu = require("@atlaskit/editor-common/ui-menu");
16
17
  var _utils = require("@atlaskit/editor-prosemirror/utils");
17
18
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
18
19
  var _chevronDown = _interopRequireDefault(require("@atlaskit/icon/glyph/chevron-down"));
20
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
19
21
  var _commands = require("../../commands");
20
22
  var _types = require("../../types");
21
23
  var _FixedButton = _interopRequireDefault(require("./FixedButton"));
22
24
  var _styles = require("./styles");
25
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
26
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
23
27
  /** @jsx jsx */
24
28
 
25
29
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
@@ -33,6 +37,7 @@ var FloatingContextualButtonInner = /*#__PURE__*/_react.default.memo(function (p
33
37
  stickyHeader = props.stickyHeader,
34
38
  tableWrapper = props.tableWrapper,
35
39
  targetCellPosition = props.targetCellPosition,
40
+ isCellMenuOpenByKeyboard = props.isCellMenuOpenByKeyboard,
36
41
  formatMessage = props.intl.formatMessage; // : Props & WrappedComponentProps
37
42
 
38
43
  var handleClick = function handleClick() {
@@ -50,6 +55,16 @@ var FloatingContextualButtonInner = /*#__PURE__*/_react.default.memo(function (p
50
55
  var domAtPos = editorView.domAtPos.bind(editorView);
51
56
  var targetCellRef;
52
57
  targetCellRef = (0, _utils.findDomRefAtPos)(targetCellPosition, domAtPos);
58
+ (0, _react.useEffect)(function () {
59
+ if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-table-context-menu_y4c9c')) {
60
+ if (isCellMenuOpenByKeyboard && !isContextualMenuOpen) {
61
+ var state = editorView.state,
62
+ dispatch = editorView.dispatch;
63
+ // open the menu when the keyboard shortcut is pressed
64
+ (0, _commands.toggleContextualMenu)()(state, dispatch);
65
+ }
66
+ }
67
+ }, [isCellMenuOpenByKeyboard, isContextualMenuOpen, editorView]);
53
68
  if (!targetCellRef || !(targetCellRef instanceof HTMLElement)) {
54
69
  return null;
55
70
  }
@@ -70,7 +85,8 @@ var FloatingContextualButtonInner = /*#__PURE__*/_react.default.memo(function (p
70
85
  iconBefore: (0, _react2.jsx)(_chevronDown.default, {
71
86
  label: ""
72
87
  }),
73
- "aria-label": labelCellOptions
88
+ "aria-label": labelCellOptions,
89
+ "aria-expanded": (0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-table-context-menu_y4c9c') ? isContextualMenuOpen : undefined
74
90
  }));
75
91
  var parentSticky = targetCellRef.parentElement && targetCellRef.parentElement.className.indexOf('sticky') > -1;
76
92
  if (stickyHeader && parentSticky && tableWrapper) {