@atlaskit/editor-plugin-table 22.4.18 → 22.4.19

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 (115) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/cjs/nodeviews/TableCell.js +9 -2
  3. package/dist/cjs/pm-plugins/commands/active-table-menu.js +18 -21
  4. package/dist/cjs/pm-plugins/commands/commands-with-analytics.js +17 -10
  5. package/dist/cjs/pm-plugins/commands/index.js +6 -0
  6. package/dist/cjs/pm-plugins/commands/misc.js +37 -5
  7. package/dist/cjs/pm-plugins/drag-and-drop/plugin.js +23 -12
  8. package/dist/cjs/tablePlugin.js +5 -4
  9. package/dist/cjs/ui/FloatingContextualButton/index.js +32 -9
  10. package/dist/cjs/ui/FloatingContextualMenu/CellMenuPopup.js +2 -2
  11. package/dist/cjs/ui/TableMenu/cell/getCellMenuComponents.js +76 -0
  12. package/dist/cjs/ui/TableMenu/cell/items/MergeCellsItem.js +2 -1
  13. package/dist/cjs/ui/TableMenu/cell/items/SplitCellItem.js +2 -1
  14. package/dist/cjs/ui/TableMenu/cell/items/VerticalAlignDropdownItem.js +61 -0
  15. package/dist/cjs/ui/TableMenu/cell/items/VerticalAlignNestedMenu.js +56 -0
  16. package/dist/cjs/ui/TableMenu/cell/items/verticalAlignUtils.js +20 -0
  17. package/dist/cjs/ui/TableMenu/cell/keys.js +24 -2
  18. package/dist/cjs/ui/TableMenu/column/items/AddColumnLeftItem.js +3 -0
  19. package/dist/cjs/ui/TableMenu/column/items/AddColumnRightItem.js +3 -0
  20. package/dist/cjs/ui/TableMenu/column/items/DeleteColumnItem.js +2 -0
  21. package/dist/cjs/ui/TableMenu/column/items/DistributeColumnsItem.js +3 -0
  22. package/dist/cjs/ui/TableMenu/column/items/MoveColumnLeftItem.js +3 -0
  23. package/dist/cjs/ui/TableMenu/column/items/MoveColumnRightItem.js +3 -0
  24. package/dist/cjs/ui/TableMenu/column/items/SortDecreasingItem.js +3 -0
  25. package/dist/cjs/ui/TableMenu/column/items/SortIncreasingItem.js +3 -0
  26. package/dist/cjs/ui/TableMenu/row/items/AddRowAboveItem.js +3 -0
  27. package/dist/cjs/ui/TableMenu/row/items/AddRowBelowItem.js +3 -0
  28. package/dist/cjs/ui/TableMenu/row/items/DeleteRowItem.js +2 -0
  29. package/dist/cjs/ui/TableMenu/row/items/MoveRowDownItem.js +3 -0
  30. package/dist/cjs/ui/TableMenu/row/items/MoveRowUpItem.js +3 -0
  31. package/dist/cjs/ui/TableMenu/shared/TableMenu.js +2 -11
  32. package/dist/cjs/ui/TableMenu/shared/items/BackgroundColorItem.js +4 -3
  33. package/dist/cjs/ui/TableMenu/shared/items/ClearCellsItem.js +2 -1
  34. package/dist/es2019/nodeviews/TableCell.js +9 -2
  35. package/dist/es2019/pm-plugins/commands/active-table-menu.js +19 -18
  36. package/dist/es2019/pm-plugins/commands/commands-with-analytics.js +10 -2
  37. package/dist/es2019/pm-plugins/commands/index.js +1 -1
  38. package/dist/es2019/pm-plugins/commands/misc.js +31 -0
  39. package/dist/es2019/pm-plugins/drag-and-drop/plugin.js +22 -10
  40. package/dist/es2019/tablePlugin.js +6 -5
  41. package/dist/es2019/ui/FloatingContextualButton/index.js +36 -9
  42. package/dist/es2019/ui/FloatingContextualMenu/CellMenuPopup.js +2 -2
  43. package/dist/es2019/ui/TableMenu/cell/getCellMenuComponents.js +67 -1
  44. package/dist/es2019/ui/TableMenu/cell/items/MergeCellsItem.js +2 -1
  45. package/dist/es2019/ui/TableMenu/cell/items/SplitCellItem.js +2 -1
  46. package/dist/es2019/ui/TableMenu/cell/items/VerticalAlignDropdownItem.js +56 -0
  47. package/dist/es2019/ui/TableMenu/cell/items/VerticalAlignNestedMenu.js +48 -0
  48. package/dist/es2019/ui/TableMenu/cell/items/verticalAlignUtils.js +15 -0
  49. package/dist/es2019/ui/TableMenu/cell/keys.js +31 -2
  50. package/dist/es2019/ui/TableMenu/column/items/AddColumnLeftItem.js +3 -0
  51. package/dist/es2019/ui/TableMenu/column/items/AddColumnRightItem.js +3 -0
  52. package/dist/es2019/ui/TableMenu/column/items/DeleteColumnItem.js +3 -1
  53. package/dist/es2019/ui/TableMenu/column/items/DistributeColumnsItem.js +3 -0
  54. package/dist/es2019/ui/TableMenu/column/items/MoveColumnLeftItem.js +3 -0
  55. package/dist/es2019/ui/TableMenu/column/items/MoveColumnRightItem.js +3 -0
  56. package/dist/es2019/ui/TableMenu/column/items/SortDecreasingItem.js +3 -0
  57. package/dist/es2019/ui/TableMenu/column/items/SortIncreasingItem.js +3 -0
  58. package/dist/es2019/ui/TableMenu/row/items/AddRowAboveItem.js +3 -0
  59. package/dist/es2019/ui/TableMenu/row/items/AddRowBelowItem.js +3 -0
  60. package/dist/es2019/ui/TableMenu/row/items/DeleteRowItem.js +3 -1
  61. package/dist/es2019/ui/TableMenu/row/items/MoveRowDownItem.js +3 -0
  62. package/dist/es2019/ui/TableMenu/row/items/MoveRowUpItem.js +3 -0
  63. package/dist/es2019/ui/TableMenu/shared/TableMenu.js +2 -11
  64. package/dist/es2019/ui/TableMenu/shared/items/BackgroundColorItem.js +4 -3
  65. package/dist/es2019/ui/TableMenu/shared/items/ClearCellsItem.js +2 -1
  66. package/dist/esm/nodeviews/TableCell.js +9 -2
  67. package/dist/esm/pm-plugins/commands/active-table-menu.js +18 -21
  68. package/dist/esm/pm-plugins/commands/commands-with-analytics.js +17 -10
  69. package/dist/esm/pm-plugins/commands/index.js +1 -1
  70. package/dist/esm/pm-plugins/commands/misc.js +36 -4
  71. package/dist/esm/pm-plugins/drag-and-drop/plugin.js +23 -12
  72. package/dist/esm/tablePlugin.js +6 -5
  73. package/dist/esm/ui/FloatingContextualButton/index.js +32 -9
  74. package/dist/esm/ui/FloatingContextualMenu/CellMenuPopup.js +2 -2
  75. package/dist/esm/ui/TableMenu/cell/getCellMenuComponents.js +77 -1
  76. package/dist/esm/ui/TableMenu/cell/items/MergeCellsItem.js +2 -1
  77. package/dist/esm/ui/TableMenu/cell/items/SplitCellItem.js +2 -1
  78. package/dist/esm/ui/TableMenu/cell/items/VerticalAlignDropdownItem.js +53 -0
  79. package/dist/esm/ui/TableMenu/cell/items/VerticalAlignNestedMenu.js +47 -0
  80. package/dist/esm/ui/TableMenu/cell/items/verticalAlignUtils.js +14 -0
  81. package/dist/esm/ui/TableMenu/cell/keys.js +23 -1
  82. package/dist/esm/ui/TableMenu/column/items/AddColumnLeftItem.js +3 -0
  83. package/dist/esm/ui/TableMenu/column/items/AddColumnRightItem.js +3 -0
  84. package/dist/esm/ui/TableMenu/column/items/DeleteColumnItem.js +3 -1
  85. package/dist/esm/ui/TableMenu/column/items/DistributeColumnsItem.js +3 -0
  86. package/dist/esm/ui/TableMenu/column/items/MoveColumnLeftItem.js +3 -0
  87. package/dist/esm/ui/TableMenu/column/items/MoveColumnRightItem.js +3 -0
  88. package/dist/esm/ui/TableMenu/column/items/SortDecreasingItem.js +3 -0
  89. package/dist/esm/ui/TableMenu/column/items/SortIncreasingItem.js +3 -0
  90. package/dist/esm/ui/TableMenu/row/items/AddRowAboveItem.js +3 -0
  91. package/dist/esm/ui/TableMenu/row/items/AddRowBelowItem.js +3 -0
  92. package/dist/esm/ui/TableMenu/row/items/DeleteRowItem.js +3 -1
  93. package/dist/esm/ui/TableMenu/row/items/MoveRowDownItem.js +3 -0
  94. package/dist/esm/ui/TableMenu/row/items/MoveRowUpItem.js +3 -0
  95. package/dist/esm/ui/TableMenu/shared/TableMenu.js +2 -11
  96. package/dist/esm/ui/TableMenu/shared/items/BackgroundColorItem.js +4 -3
  97. package/dist/esm/ui/TableMenu/shared/items/ClearCellsItem.js +2 -1
  98. package/dist/types/pm-plugins/commands/active-table-menu.d.ts +3 -3
  99. package/dist/types/pm-plugins/commands/index.d.ts +1 -1
  100. package/dist/types/pm-plugins/commands/misc.d.ts +4 -0
  101. package/dist/types/ui/TableMenu/cell/items/VerticalAlignDropdownItem.d.ts +12 -0
  102. package/dist/types/ui/TableMenu/cell/items/VerticalAlignNestedMenu.d.ts +4 -0
  103. package/dist/types/ui/TableMenu/cell/items/verticalAlignUtils.d.ts +3 -0
  104. package/dist/types/ui/TableMenu/cell/keys.d.ts +8 -1
  105. package/dist/types-ts4.5/pm-plugins/commands/active-table-menu.d.ts +3 -3
  106. package/dist/types-ts4.5/pm-plugins/commands/index.d.ts +1 -1
  107. package/dist/types-ts4.5/pm-plugins/commands/misc.d.ts +4 -0
  108. package/dist/types-ts4.5/ui/TableMenu/cell/items/VerticalAlignDropdownItem.d.ts +12 -0
  109. package/dist/types-ts4.5/ui/TableMenu/cell/items/VerticalAlignNestedMenu.d.ts +4 -0
  110. package/dist/types-ts4.5/ui/TableMenu/cell/items/verticalAlignUtils.d.ts +3 -0
  111. package/dist/types-ts4.5/ui/TableMenu/cell/keys.d.ts +8 -1
  112. package/package.json +2 -1
  113. package/dist/cjs/ui/TableMenu/shared/TableMenu.compiled.css +0 -4
  114. package/dist/es2019/ui/TableMenu/shared/TableMenu.compiled.css +0 -4
  115. package/dist/esm/ui/TableMenu/shared/TableMenu.compiled.css +0 -4
@@ -5,6 +5,7 @@ import { addRowAfter, tooltip } from '@atlaskit/editor-common/keymaps';
5
5
  import { tableMessages as messages } from '@atlaskit/editor-common/messages';
6
6
  import { getSelectionRect } from '@atlaskit/editor-tables/utils';
7
7
  import { TableRowAddBelowIcon, ToolbarDropdownItem, ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar';
8
+ import { closeActiveTableMenu } from '../../../../pm-plugins/commands';
8
9
  import { insertRowWithAnalytics } from '../../../../pm-plugins/commands/commands-with-analytics';
9
10
  import { useTableMenuContext } from '../../shared/TableMenuContext';
10
11
  export const AddRowBelowItem = props => {
@@ -32,6 +33,8 @@ export const AddRowBelowItem = props => {
32
33
  index,
33
34
  moveCursorToInsertedRow: true
34
35
  })(editorView.state, editorView.dispatch);
36
+ api === null || api === void 0 ? void 0 : api.core.actions.execute(closeActiveTableMenu());
37
+ api === null || api === void 0 ? void 0 : api.core.actions.focus();
35
38
  };
36
39
  return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
37
40
  onClick: handleClick,
@@ -6,7 +6,7 @@ import { deleteRow, tooltip } from '@atlaskit/editor-common/keymaps';
6
6
  import { tableMessages as messages } from '@atlaskit/editor-common/messages';
7
7
  import { getSelectionRect } from '@atlaskit/editor-tables/utils';
8
8
  import { DeleteIcon, ToolbarDropdownItem, ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar';
9
- import { clearHoverSelection, hoverRows } from '../../../../pm-plugins/commands';
9
+ import { clearHoverSelection, closeActiveTableMenu, hoverRows } from '../../../../pm-plugins/commands';
10
10
  import { deleteRowsWithAnalytics } from '../../../../pm-plugins/commands/commands-with-analytics';
11
11
  import { getSelectedRowIndexes } from '../../../../pm-plugins/utils/selection';
12
12
  import { useTableMenuContext } from '../../shared/TableMenuContext';
@@ -57,6 +57,8 @@ export const DeleteRowItem = props => {
57
57
  return;
58
58
  }
59
59
  deleteRowsWithAnalytics(api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)(INPUT_METHOD.TABLE_CONTEXT_MENU, selectionRect, !!isHeaderRowRequired)(editorView.state, editorView.dispatch);
60
+ api === null || api === void 0 ? void 0 : api.core.actions.execute(closeActiveTableMenu());
61
+ api === null || api === void 0 ? void 0 : api.core.actions.focus();
60
62
  };
61
63
  return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
62
64
  onClick: handleClick,
@@ -6,6 +6,7 @@ import { moveRowDown, tooltip } from '@atlaskit/editor-common/keymaps';
6
6
  import { tableMessages as messages } from '@atlaskit/editor-common/messages';
7
7
  import { getSelectionRect } from '@atlaskit/editor-tables/utils';
8
8
  import { TableRowMoveDownIcon, ToolbarDropdownItem, ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar';
9
+ import { closeActiveTableMenu } from '../../../../pm-plugins/commands';
9
10
  import { moveSourceWithAnalytics } from '../../../../pm-plugins/drag-and-drop/commands-with-analytics';
10
11
  import { getPluginState } from '../../../../pm-plugins/plugin-factory';
11
12
  import { getSelectedRowIndexes } from '../../../../pm-plugins/utils/selection';
@@ -43,6 +44,8 @@ export const MoveRowDownItem = props => {
43
44
  return;
44
45
  }
45
46
  moveSourceWithAnalytics(api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, api === null || api === void 0 ? void 0 : (_api$accessibilityUti = api.accessibilityUtils) === null || _api$accessibilityUti === void 0 ? void 0 : _api$accessibilityUti.actions.ariaNotify, getPluginState(editorView.state).getIntl)(INPUT_METHOD.TABLE_CONTEXT_MENU, TABLE_ROW, getSelectedRowIndexes(selectionRect), selectionRect.bottom)(editorView.state, editorView.dispatch);
47
+ api === null || api === void 0 ? void 0 : api.core.actions.execute(closeActiveTableMenu());
48
+ api === null || api === void 0 ? void 0 : api.core.actions.focus();
46
49
  };
47
50
  if (!tableNode || !shouldShowMoveRowDown(tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.isLastRow)) {
48
51
  return null;
@@ -6,6 +6,7 @@ import { moveRowUp, tooltip } from '@atlaskit/editor-common/keymaps';
6
6
  import { tableMessages as messages } from '@atlaskit/editor-common/messages';
7
7
  import { getSelectionRect } from '@atlaskit/editor-tables/utils';
8
8
  import { TableRowMoveUpIcon, ToolbarDropdownItem, ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar';
9
+ import { closeActiveTableMenu } from '../../../../pm-plugins/commands';
9
10
  import { moveSourceWithAnalytics } from '../../../../pm-plugins/drag-and-drop/commands-with-analytics';
10
11
  import { getPluginState } from '../../../../pm-plugins/plugin-factory';
11
12
  import { getSelectedRowIndexes } from '../../../../pm-plugins/utils/selection';
@@ -43,6 +44,8 @@ export const MoveRowUpItem = props => {
43
44
  return;
44
45
  }
45
46
  moveSourceWithAnalytics(api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, api === null || api === void 0 ? void 0 : (_api$accessibilityUti = api.accessibilityUtils) === null || _api$accessibilityUti === void 0 ? void 0 : _api$accessibilityUti.actions.ariaNotify, getPluginState(editorView.state).getIntl)(INPUT_METHOD.TABLE_CONTEXT_MENU, TABLE_ROW, getSelectedRowIndexes(selectionRect), selectionRect.top - 1)(editorView.state, editorView.dispatch);
47
+ api === null || api === void 0 ? void 0 : api.core.actions.execute(closeActiveTableMenu());
48
+ api === null || api === void 0 ? void 0 : api.core.actions.focus();
46
49
  };
47
50
  if (!tableNode || !shouldShowMoveRowUp(tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.isFirstRow)) {
48
51
  return null;
@@ -1,18 +1,12 @@
1
- /* TableMenu.tsx generated by @compiled/babel-plugin v0.39.1 */
2
- import "./TableMenu.compiled.css";
3
- import { ax, ix } from "@compiled/react/runtime";
4
1
  import React, { memo, useMemo } from 'react';
5
2
  import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
6
3
  import { TableMap } from '@atlaskit/editor-tables/table-map';
7
4
  import { getSelectionRect } from '@atlaskit/editor-tables/utils';
5
+ import { ToolbarMenuContainer } from '@atlaskit/editor-toolbar/toolbar-menu-container';
8
6
  import { SurfaceRenderer } from '@atlaskit/editor-ui-control-model';
9
- import { Box } from '@atlaskit/primitives/compiled';
10
7
  import { canSplitCellSelection } from '../../../pm-plugins/commands/split-cell';
11
8
  import { canMergeCellSelection } from '../../../pm-plugins/transforms/merge';
12
9
  import { TableMenuProvider } from './TableMenuContext';
13
- const tableMenuContainerStyles = {
14
- container: "_2rko1qi0 _1bsb1178 _16qs130s _bfhk1bhr"
15
- };
16
10
  export const TableMenu = /*#__PURE__*/memo(({
17
11
  api,
18
12
  editorView,
@@ -64,10 +58,7 @@ export const TableMenu = /*#__PURE__*/memo(({
64
58
  }
65
59
  return /*#__PURE__*/React.createElement(TableMenuProvider, {
66
60
  value: tableMenuContext
67
- }, /*#__PURE__*/React.createElement(Box, {
68
- xcss: tableMenuContainerStyles.container,
69
- testId: surface.key
70
- }, /*#__PURE__*/React.createElement(SurfaceRenderer, {
61
+ }, /*#__PURE__*/React.createElement(ToolbarMenuContainer, null, /*#__PURE__*/React.createElement(SurfaceRenderer, {
71
62
  surface: surface,
72
63
  components: components
73
64
  })));
@@ -22,7 +22,7 @@ const colorPaletteStyles = {
22
22
  export const BackgroundColorItem = ({
23
23
  api
24
24
  }) => {
25
- var _useTableMenuContext, _api$analytics2;
25
+ var _useTableMenuContext;
26
26
  const {
27
27
  editorView
28
28
  } = (_useTableMenuContext = useTableMenuContext()) !== null && _useTableMenuContext !== void 0 ? _useTableMenuContext : {};
@@ -46,8 +46,9 @@ export const BackgroundColorItem = ({
46
46
  return;
47
47
  }
48
48
  setColorWithAnalytics(api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)(INPUT_METHOD.TABLE_CONTEXT_MENU, color, editorView)(editorView.state, editorView.dispatch);
49
- closeActiveTableMenu()(editorView.state, editorView.dispatch);
50
- }, [api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions, editorView]);
49
+ api === null || api === void 0 ? void 0 : api.core.actions.execute(closeActiveTableMenu());
50
+ api === null || api === void 0 ? void 0 : api.core.actions.focus();
51
+ }, [api, editorView]);
51
52
  // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
52
53
  const colorPreviewStyle = useMemo(() => ({
53
54
  backgroundColor: selectedColor
@@ -29,7 +29,8 @@ export const ClearCellsItem = ({
29
29
  targetCellPosition
30
30
  } = getPluginState(editorView.state);
31
31
  emptyMultipleCellsWithAnalytics(api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)(INPUT_METHOD.TABLE_CONTEXT_MENU, targetCellPosition)(editorView.state, editorView.dispatch);
32
- closeActiveTableMenu()(editorView.state, editorView.dispatch);
32
+ api === null || api === void 0 ? void 0 : api.core.actions.execute(closeActiveTableMenu());
33
+ api === null || api === void 0 ? void 0 : api.core.actions.focus();
33
34
  };
34
35
  return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
35
36
  onClick: handleClick,
@@ -39,6 +39,13 @@ function delayUntilIdle(cb) {
39
39
  // Ignored via go/ees005
40
40
  // eslint-disable-next-line require-unicode-regexp
41
41
  var cssVariablePattern = /^VAR\(--.*\)$/;
42
+ var getCellDomAttrsForTableMenuUpdates = function getCellDomAttrsForTableMenuUpdates(node) {
43
+ var attrs = getCellDomAttrs(node);
44
+ if (expValEquals('platform_editor_table_menu_updates', 'isEnabled', true) && node.attrs.valign) {
45
+ attrs['data-valign'] = node.attrs.valign;
46
+ }
47
+ return attrs;
48
+ };
42
49
  var TableCell = /*#__PURE__*/function (_TableNodeView) {
43
50
  function TableCell(node, view, getPos, eventDispatcher, editorAnalyticsAPI) {
44
51
  var _this;
@@ -172,8 +179,8 @@ var TableCell = /*#__PURE__*/function (_TableNodeView) {
172
179
  if (this.node.type !== node.type) {
173
180
  return false;
174
181
  }
175
- var attrs = getCellDomAttrs(this.node);
176
- var nextAttrs = getCellDomAttrs(node);
182
+ var attrs = getCellDomAttrsForTableMenuUpdates(this.node);
183
+ var nextAttrs = getCellDomAttrsForTableMenuUpdates(node);
177
184
  var _getCellAttrs = getCellAttrs(this.dom),
178
185
  colspan = _getCellAttrs.colspan,
179
186
  rowspan = _getCellAttrs.rowspan;
@@ -1,22 +1,20 @@
1
- import { createCommand, getPluginState } from '../plugin-factory';
1
+ import { pluginKey } from '../plugin-key';
2
2
  export var closeActiveTableMenu = function closeActiveTableMenu() {
3
- return createCommand(function (state) {
4
- var _getPluginState = getPluginState(state),
5
- activeTableMenu = _getPluginState.activeTableMenu;
6
- if (!activeTableMenu || activeTableMenu.type === 'none') {
7
- return false;
8
- }
9
- return {
3
+ return function (_ref) {
4
+ var tr = _ref.tr;
5
+ tr.setMeta(pluginKey, {
10
6
  type: 'SET_ACTIVE_TABLE_MENU',
11
7
  data: {
12
8
  activeTableMenu: {
13
9
  type: 'none'
14
10
  }
15
11
  }
16
- };
17
- }, function (tr) {
18
- return tr.setMeta('addToHistory', false);
19
- });
12
+ });
13
+ if (!tr.docChanged) {
14
+ tr.setMeta('addToHistory', false);
15
+ }
16
+ return tr;
17
+ };
20
18
  };
21
19
  var isSameActiveTableMenu = function isSameActiveTableMenu(current, next) {
22
20
  if (!current || current.type !== next.type) {
@@ -27,19 +25,18 @@ var isSameActiveTableMenu = function isSameActiveTableMenu(current, next) {
27
25
  }
28
26
  return true;
29
27
  };
30
- export var toggleActiveTableMenu = function toggleActiveTableMenu(activeTableMenu) {
31
- return createCommand(function (state) {
32
- var _getPluginState2 = getPluginState(state),
33
- currentActiveTableMenu = _getPluginState2.activeTableMenu;
34
- return {
28
+ export var toggleActiveTableMenu = function toggleActiveTableMenu(activeTableMenu, currentActiveTableMenu) {
29
+ return function (_ref2) {
30
+ var tr = _ref2.tr;
31
+ tr.setMeta(pluginKey, {
35
32
  type: 'SET_ACTIVE_TABLE_MENU',
36
33
  data: {
37
34
  activeTableMenu: isSameActiveTableMenu(currentActiveTableMenu, activeTableMenu) ? {
38
35
  type: 'none'
39
36
  } : activeTableMenu
40
37
  }
41
- };
42
- }, function (tr) {
43
- return tr.setMeta('addToHistory', false);
44
- });
38
+ });
39
+ tr.setMeta('addToHistory', false);
40
+ return tr;
41
+ };
45
42
  };
@@ -46,11 +46,18 @@ export var toggleActiveTableMenuWithAnalytics = function toggleActiveTableMenuWi
46
46
  };
47
47
  })(editorAnalyticsAPI)(function (state, dispatch) {
48
48
  if (dispatch) {
49
- toggleActiveTableMenu({
49
+ var _getPluginState2 = getPluginState(state),
50
+ currentActiveTableMenu = _getPluginState2.activeTableMenu;
51
+ var newTr = toggleActiveTableMenu({
50
52
  type: direction,
51
53
  index: index,
52
54
  openedBy: trigger
53
- })(state, dispatch);
55
+ }, currentActiveTableMenu)({
56
+ tr: state.tr
57
+ });
58
+ if (newTr) {
59
+ dispatch(newTr);
60
+ }
54
61
  }
55
62
  return true;
56
63
  });
@@ -220,8 +227,8 @@ export var changeColumnWidthByStepWithAnalytics = function changeColumnWidthBySt
220
227
  table = _getSelectedTableInfo2.table,
221
228
  totalRowCount = _getSelectedTableInfo2.totalRowCount,
222
229
  totalColumnCount = _getSelectedTableInfo2.totalColumnCount;
223
- var _getPluginState2 = getPluginState(state),
224
- colIndex = _getPluginState2.hoveredCell.colIndex;
230
+ var _getPluginState3 = getPluginState(state),
231
+ colIndex = _getPluginState3.hoveredCell.colIndex;
225
232
  return {
226
233
  action: TABLE_ACTION.COLUMN_RESIZED,
227
234
  actionSubject: ACTION_SUBJECT.TABLE,
@@ -341,8 +348,8 @@ export var deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut = function delete
341
348
  }
342
349
  var selectionType = getTableSelectionType(selection);
343
350
  if (selectionType === 'row') {
344
- var _getPluginState3 = getPluginState(state),
345
- pluginConfig = _getPluginState3.pluginConfig;
351
+ var _getPluginState4 = getPluginState(state),
352
+ pluginConfig = _getPluginState4.pluginConfig;
346
353
  var isHeaderRowRequired = pluginConfig.isHeaderRowRequired || false;
347
354
  return deleteRowsWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT, rect, isHeaderRowRequired)(state, dispatch);
348
355
  } else if (selectionType === 'column') {
@@ -386,8 +393,8 @@ export var toggleHeaderRowWithAnalytics = function toggleHeaderRowWithAnalytics(
386
393
  var _getSelectedTableInfo7 = getSelectedTableInfo(state.selection),
387
394
  totalRowCount = _getSelectedTableInfo7.totalRowCount,
388
395
  totalColumnCount = _getSelectedTableInfo7.totalColumnCount;
389
- var _getPluginState4 = getPluginState(state),
390
- isHeaderRowEnabled = _getPluginState4.isHeaderRowEnabled;
396
+ var _getPluginState5 = getPluginState(state),
397
+ isHeaderRowEnabled = _getPluginState5.isHeaderRowEnabled;
391
398
  return {
392
399
  action: TABLE_ACTION.TOGGLED_HEADER_ROW,
393
400
  actionSubject: ACTION_SUBJECT.TABLE,
@@ -406,8 +413,8 @@ export var toggleHeaderColumnWithAnalytics = function toggleHeaderColumnWithAnal
406
413
  var _getSelectedTableInfo8 = getSelectedTableInfo(state.selection),
407
414
  totalRowCount = _getSelectedTableInfo8.totalRowCount,
408
415
  totalColumnCount = _getSelectedTableInfo8.totalColumnCount;
409
- var _getPluginState5 = getPluginState(state),
410
- isHeaderColumnEnabled = _getPluginState5.isHeaderColumnEnabled;
416
+ var _getPluginState6 = getPluginState(state),
417
+ isHeaderColumnEnabled = _getPluginState6.isHeaderColumnEnabled;
411
418
  return {
412
419
  action: TABLE_ACTION.TOGGLED_HEADER_COLUMN,
413
420
  actionSubject: ACTION_SUBJECT.TABLE,
@@ -6,7 +6,7 @@ export { insertColumn, insertRow, createTable } from './insert';
6
6
  export { getNextLayout, toggleContextualMenu, toggleHeaderColumn, toggleHeaderRow, toggleNumberColumn, toggleTableLayout } from './toggle';
7
7
  export { closeActiveTableMenu, toggleActiveTableMenu } from './active-table-menu';
8
8
  export { clearMultipleCells } from './clear';
9
- export { autoSizeTable, convertFirstRowToHeader, deleteTable, hideInsertColumnOrRowButton, moveCursorBackward, selectColumn, selectColumns, selectRow, selectRows, setCellAttr, setEditorFocus, setMultipleCellAttrs, setTableRef, showInsertColumnButton, showInsertRowButton, transformSliceToAddTableHeaders, triggerUnlessTableHeader, addBoldInEmptyHeaderCells, addResizeHandleDecorations, updateWidthToWidest, setFocusToCellMenu } from './misc';
9
+ export { autoSizeTable, convertFirstRowToHeader, deleteTable, hideInsertColumnOrRowButton, moveCursorBackward, selectColumn, selectColumns, selectRow, selectRows, setCellAttr, setEditorFocus, setMultipleCellAttrs, setMultipleCellAttrsEditorCommand, setTableRef, showInsertColumnButton, showInsertRowButton, transformSliceToAddTableHeaders, triggerUnlessTableHeader, addBoldInEmptyHeaderCells, addResizeHandleDecorations, updateWidthToWidest, setFocusToCellMenu } from './misc';
10
10
  export { sortByColumn } from './sort';
11
11
  export { goToNextCell } from './go-to-next-cell';
12
12
  export { removeDescendantNodes } from './referentiality';
@@ -358,6 +358,38 @@ export var setMultipleCellAttrs = function setMultipleCellAttrs(attrs, editorVie
358
358
  return false;
359
359
  };
360
360
  };
361
+
362
+ /**
363
+ * EditorCommand variant of `setMultipleCellAttrs`.
364
+ */
365
+ export var setMultipleCellAttrsEditorCommand = function setMultipleCellAttrsEditorCommand(attrs, targetCellPosition) {
366
+ return function (_ref2) {
367
+ var tr = _ref2.tr;
368
+ var cursorPos;
369
+ if (isSelectionType(tr.selection, 'cell')) {
370
+ // Ignored via go/ees005
371
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
372
+ var selection = tr.selection;
373
+ selection.forEachCell(function (_cell, pos) {
374
+ var $pos = tr.doc.resolve(tr.mapping.map(pos + 1));
375
+ // Ignored via go/ees005
376
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
377
+ setCellAttrs(findCellClosestToPos($pos), attrs)(tr);
378
+ });
379
+ cursorPos = selection.$headCell.pos;
380
+ } else if (typeof targetCellPosition === 'number') {
381
+ // Ignored via go/ees005
382
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
383
+ var cell = findCellClosestToPos(tr.doc.resolve(targetCellPosition + 1));
384
+ setCellAttrs(cell, attrs)(tr);
385
+ cursorPos = cell.pos;
386
+ }
387
+ if (tr.docChanged && cursorPos !== undefined) {
388
+ return tr;
389
+ }
390
+ return null;
391
+ };
392
+ };
361
393
  export var selectColumn = function selectColumn(column, expand) {
362
394
  var triggeredByKeyboard = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
363
395
  return createCommand(function (state) {
@@ -609,8 +641,8 @@ export var updateWidthToWidest = function updateWidthToWidest(widthToWidest) {
609
641
  });
610
642
  };
611
643
  export var setTableAlignment = function setTableAlignment(newAlignment, isCommentEditor) {
612
- return function (_ref2) {
613
- var tr = _ref2.tr;
644
+ return function (_ref3) {
645
+ var tr = _ref3.tr;
614
646
  var tableObject = findTable(tr.selection);
615
647
  if (!tableObject) {
616
648
  return null;
@@ -632,8 +664,8 @@ export var setTableAlignment = function setTableAlignment(newAlignment, isCommen
632
664
  };
633
665
  };
634
666
  export var setTableAlignmentWithTableContentWithPos = function setTableAlignmentWithTableContentWithPos(newAlignment, tableNodeWithPos) {
635
- return function (_ref3) {
636
- var tr = _ref3.tr;
667
+ return function (_ref4) {
668
+ var tr = _ref4.tr;
637
669
  var table = tableNodeWithPos.node;
638
670
  var nextTableAttrs = _objectSpread(_objectSpread({}, table.attrs), {}, {
639
671
  layout: newAlignment
@@ -82,19 +82,30 @@ var destroyFn = function destroyFn(editorView, editorAnalyticsAPI, isTableScalin
82
82
  return localId === (tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.localId);
83
83
  },
84
84
  onDragStart: function onDragStart() {
85
- var _api$userIntent;
86
85
  if (expValEquals('cc_editor_interactivity_monitoring', 'isEnabled', true)) {
87
86
  var _insm$session3;
88
87
  (_insm$session3 = insm.session) === null || _insm$session3 === void 0 || _insm$session3.startFeature('tableDragAndDrop');
89
88
  }
90
- toggleDragMenu(false)(editorView.state, editorView.dispatch);
91
89
  if (expValEquals('platform_editor_table_menu_updates', 'isEnabled', true)) {
92
- closeActiveTableMenu()(editorView.state, editorView.dispatch);
90
+ api === null || api === void 0 || api.core.actions.execute(function (_ref7) {
91
+ var _api$userIntent;
92
+ var tr = _ref7.tr;
93
+ closeActiveTableMenu()({
94
+ tr: tr
95
+ });
96
+ api === null || api === void 0 || (_api$userIntent = api.userIntent) === null || _api$userIntent === void 0 || _api$userIntent.commands.setCurrentUserIntent('dragging')({
97
+ tr: tr
98
+ });
99
+ return tr;
100
+ });
101
+ } else {
102
+ var _api$userIntent2;
103
+ toggleDragMenu(false)(editorView.state, editorView.dispatch);
104
+ api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 || (_api$userIntent2 = api.userIntent) === null || _api$userIntent2 === void 0 ? void 0 : _api$userIntent2.commands.setCurrentUserIntent('dragging'));
93
105
  }
94
- api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 || (_api$userIntent = api.userIntent) === null || _api$userIntent === void 0 ? void 0 : _api$userIntent.commands.setCurrentUserIntent('dragging'));
95
106
  },
96
107
  onDrag: function onDrag(event) {
97
- var _api$userIntent2;
108
+ var _api$userIntent3;
98
109
  var data = getDraggableDataFromEvent(event);
99
110
  // If no data can be found then it's most like we do not want to perform any drag actions
100
111
  if (!data) {
@@ -109,10 +120,10 @@ var destroyFn = function destroyFn(editorView, editorAnalyticsAPI, isTableScalin
109
120
  var dropTargetType = sourceType === 'table-row' ? DropTargetType.ROW : DropTargetType.COLUMN;
110
121
  var hasMergedCells = hasMergedCellsInBetween([targetAdjustedIndex - 1, targetAdjustedIndex], dropTargetType)(editorView.state.selection);
111
122
  setDropTarget(dropTargetType, targetAdjustedIndex, hasMergedCells)(editorView.state, editorView.dispatch);
112
- api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 || (_api$userIntent2 = api.userIntent) === null || _api$userIntent2 === void 0 ? void 0 : _api$userIntent2.commands.setCurrentUserIntent('dragging'));
123
+ api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 || (_api$userIntent3 = api.userIntent) === null || _api$userIntent3 === void 0 ? void 0 : _api$userIntent3.commands.setCurrentUserIntent('dragging'));
113
124
  },
114
125
  onDrop: function onDrop(event) {
115
- var _cell$row, _cell$col, _api$userIntent3;
126
+ var _cell$row, _cell$col, _api$userIntent4;
116
127
  var data = getDraggableDataFromEvent(event);
117
128
 
118
129
  // On Drop we need to update the table main plugin hoveredCell value with the current row/col that the mouse is
@@ -135,9 +146,9 @@ var destroyFn = function destroyFn(editorView, editorAnalyticsAPI, isTableScalin
135
146
  }
136
147
  };
137
148
  tr.setMeta(tablePluginKey, action);
138
- if ((api === null || api === void 0 || (_api$userIntent3 = api.userIntent) === null || _api$userIntent3 === void 0 || (_api$userIntent3 = _api$userIntent3.sharedState.currentState()) === null || _api$userIntent3 === void 0 ? void 0 : _api$userIntent3.currentUserIntent) === 'dragging') {
139
- var _api$userIntent4;
140
- api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 || (_api$userIntent4 = api.userIntent) === null || _api$userIntent4 === void 0 ? void 0 : _api$userIntent4.commands.setCurrentUserIntent('default'));
149
+ if ((api === null || api === void 0 || (_api$userIntent4 = api.userIntent) === null || _api$userIntent4 === void 0 || (_api$userIntent4 = _api$userIntent4.sharedState.currentState()) === null || _api$userIntent4 === void 0 ? void 0 : _api$userIntent4.currentUserIntent) === 'dragging') {
150
+ var _api$userIntent5;
151
+ api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 || (_api$userIntent5 = api.userIntent) === null || _api$userIntent5 === void 0 ? void 0 : _api$userIntent5.commands.setCurrentUserIntent('default'));
141
152
  }
142
153
  // If no data can be found then it's most like we do not want to perform any drop action
143
154
  if (!data) {
@@ -298,7 +309,7 @@ export var createPlugin = function createPlugin(dispatch, editorAnalyticsAPI) {
298
309
  return decorationSet;
299
310
  },
300
311
  handleKeyDown: function handleKeyDown(view, event) {
301
- var _ref7;
312
+ var _ref8;
302
313
  var tr = view.state.tr;
303
314
  var keysToTrapWhen = ['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'];
304
315
 
@@ -322,7 +333,7 @@ export var createPlugin = function createPlugin(dispatch, editorAnalyticsAPI) {
322
333
  var isDragHandleFocused = ['drag-handle-button-row', 'drag-handle-button-column'
323
334
  // Ignored via go/ees005
324
335
  // eslint-disable-next-line @atlaskit/editor/no-as-casting
325
- ].includes((_ref7 = event.target || null) === null || _ref7 === void 0 ? void 0 : _ref7.id);
336
+ ].includes((_ref8 = event.target || null) === null || _ref8 === void 0 ? void 0 : _ref8.id);
326
337
  var keysToTrap = ['Enter', ' '];
327
338
  var _getPluginState3 = getPluginState(view.state),
328
339
  _getPluginState3$isDr = _getPluginState3.isDragMenuOpen,
@@ -2,7 +2,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
3
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
4
  import React, { useEffect } from 'react';
5
- import { tableCell, tableCellWithNestedTable, tableHeader, tableHeaderWithLocalId, tableHeaderWithNestedTable, tableRow, tableRowWithNestedTable, tableRowWithLocalId, tableCellWithLocalId, tableCellWithNestedTableWithLocalId, tableRowWithNestedTableWithLocalId, tableHeaderWithNestedTableWithLocalId } from '@atlaskit/adf-schema';
5
+ import { tableCell, tableCellStage0, tableCellWithNestedTable, tableCellWithNestedTableStage0, tableHeader, tableHeaderStage0, tableHeaderWithLocalId, tableHeaderWithNestedTable, tableHeaderWithNestedTableStage0, tableRow, tableRowWithNestedTable, tableRowWithLocalId, tableCellWithLocalId, tableCellWithNestedTableWithLocalId, tableRowWithNestedTableWithLocalId, tableHeaderWithNestedTableWithLocalId } from '@atlaskit/adf-schema';
6
6
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD, TABLE_ACTION } from '@atlaskit/editor-common/analytics';
7
7
  import { getBrowserInfo } from '@atlaskit/editor-common/browser';
8
8
  import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
@@ -16,6 +16,7 @@ import { hasParentNodeOfType, safeInsert } from '@atlaskit/editor-prosemirror/ut
16
16
  import { tableEditing } from '@atlaskit/editor-tables/pm-plugins';
17
17
  import { fg } from '@atlaskit/platform-feature-flags';
18
18
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
19
+ import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
19
20
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
20
21
  import { tableNodeSpecWithFixedToDOM } from './nodeviews/toDOM';
21
22
  import { createPlugin as createActiveCellHighlightPlugin } from './pm-plugins/active-cell-highlight/plugin';
@@ -249,13 +250,13 @@ var tablePlugin = function tablePlugin(_ref) {
249
250
  })
250
251
  }, {
251
252
  name: 'tableHeader',
252
- node: fg('platform_editor_adf_with_localid') ? tableHeaderWithNestedTableWithLocalId : tableHeaderWithNestedTable
253
+ node: expValEqualsNoExposure('platform_editor_table_menu_updates', 'isEnabled', true) ? tableHeaderWithNestedTableStage0 : fg('platform_editor_adf_with_localid') ? tableHeaderWithNestedTableWithLocalId : tableHeaderWithNestedTable
253
254
  }, {
254
255
  name: 'tableRow',
255
256
  node: fg('platform_editor_adf_with_localid') ? tableRowWithNestedTableWithLocalId : tableRowWithNestedTable
256
257
  }, {
257
258
  name: 'tableCell',
258
- node: fg('platform_editor_adf_with_localid') ? tableCellWithNestedTableWithLocalId : tableCellWithNestedTable
259
+ node: expValEqualsNoExposure('platform_editor_table_menu_updates', 'isEnabled', true) ? tableCellWithNestedTableStage0 : fg('platform_editor_adf_with_localid') ? tableCellWithNestedTableWithLocalId : tableCellWithNestedTable
259
260
  }] : [{
260
261
  name: 'table',
261
262
  node: tableNodeSpecWithFixedToDOM({
@@ -270,13 +271,13 @@ var tablePlugin = function tablePlugin(_ref) {
270
271
  })
271
272
  }, {
272
273
  name: 'tableHeader',
273
- node: fg('platform_editor_adf_with_localid') ? tableHeaderWithLocalId : tableHeader
274
+ node: expValEqualsNoExposure('platform_editor_table_menu_updates', 'isEnabled', true) ? tableHeaderStage0 : fg('platform_editor_adf_with_localid') ? tableHeaderWithLocalId : tableHeader
274
275
  }, {
275
276
  name: 'tableRow',
276
277
  node: fg('platform_editor_adf_with_localid') ? tableRowWithLocalId : tableRow
277
278
  }, {
278
279
  name: 'tableCell',
279
- node: fg('platform_editor_adf_with_localid') ? tableCellWithLocalId : tableCell
280
+ node: expValEqualsNoExposure('platform_editor_table_menu_updates', 'isEnabled', true) ? tableCellStage0 : fg('platform_editor_adf_with_localid') ? tableCellWithLocalId : tableCell
280
281
  }];
281
282
  },
282
283
  pmPlugins: function pmPlugins() {
@@ -19,6 +19,7 @@ import ExpandIcon from '@atlaskit/icon/core/chevron-down';
19
19
  import { fg } from '@atlaskit/platform-feature-flags';
20
20
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
21
21
  import { toggleActiveTableMenu, toggleContextualMenu } from '../../pm-plugins/commands';
22
+ import { getPluginState } from '../../pm-plugins/plugin-factory';
22
23
  import { isNativeStickySupported } from '../../pm-plugins/utils/sticky-header';
23
24
  import { TableCssClassName as ClassName } from '../../types';
24
25
 
@@ -56,10 +57,21 @@ var FloatingContextualButtonInner = /*#__PURE__*/React.memo(function (props) {
56
57
  var state = editorView.state,
57
58
  dispatch = editorView.dispatch;
58
59
  if (expValEquals('platform_editor_table_menu_updates', 'isEnabled', true)) {
59
- toggleActiveTableMenu({
60
- type: 'cell',
61
- openedBy: 'mouse'
62
- })(state, dispatch);
60
+ if (!api) {
61
+ return;
62
+ }
63
+ var _getPluginState = getPluginState(state),
64
+ currentActiveTableMenu = _getPluginState.activeTableMenu;
65
+ api.core.actions.execute(function (_ref) {
66
+ var tr = _ref.tr;
67
+ toggleActiveTableMenu({
68
+ type: 'cell',
69
+ openedBy: 'mouse'
70
+ }, currentActiveTableMenu)({
71
+ tr: tr
72
+ });
73
+ return tr;
74
+ });
63
75
  return;
64
76
  }
65
77
 
@@ -80,15 +92,26 @@ var FloatingContextualButtonInner = /*#__PURE__*/React.memo(function (props) {
80
92
  dispatch = editorView.dispatch;
81
93
  // open the menu when the keyboard shortcut is pressed
82
94
  if (expValEquals('platform_editor_table_menu_updates', 'isEnabled', true)) {
83
- toggleActiveTableMenu({
84
- type: 'cell',
85
- openedBy: 'keyboard'
86
- })(state, dispatch);
95
+ if (!api) {
96
+ return;
97
+ }
98
+ var _getPluginState2 = getPluginState(state),
99
+ currentActiveTableMenu = _getPluginState2.activeTableMenu;
100
+ api.core.actions.execute(function (_ref2) {
101
+ var tr = _ref2.tr;
102
+ toggleActiveTableMenu({
103
+ type: 'cell',
104
+ openedBy: 'keyboard'
105
+ }, currentActiveTableMenu)({
106
+ tr: tr
107
+ });
108
+ return tr;
109
+ });
87
110
  return;
88
111
  }
89
112
  toggleContextualMenu()(state, dispatch);
90
113
  }
91
- }, [isCellMenuOpenByKeyboard, isCellMenuOpen, editorView]);
114
+ }, [isCellMenuOpenByKeyboard, isCellMenuOpen, editorView, api]);
92
115
  if (!targetCellRef || !(targetCellRef instanceof HTMLElement)) {
93
116
  return null;
94
117
  }
@@ -29,11 +29,11 @@ export var CellMenuPopup = function CellMenuPopup(_ref) {
29
29
  var closeCellMenu = useCallback(function () {
30
30
  var _getPluginState = getPluginState(editorView.state),
31
31
  isCellMenuOpenByKeyboard = _getPluginState.isCellMenuOpenByKeyboard;
32
- closeActiveTableMenu()(editorView.state, editorView.dispatch);
32
+ api === null || api === void 0 || api.core.actions.execute(closeActiveTableMenu());
33
33
  if (isCellMenuOpenByKeyboard) {
34
34
  setFocusToCellMenu(false)(editorView.state, editorView.dispatch);
35
35
  }
36
- }, [editorView]);
36
+ }, [api === null || api === void 0 ? void 0 : api.core.actions, editorView]);
37
37
  var isEventInsideCellMenu = useCallback(function (event) {
38
38
  var _popupContentRef$curr;
39
39
  var target = event.target;