@atlaskit/editor-plugin-table 22.4.17 → 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 +14 -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 +5 -4
  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
@@ -89,19 +89,31 @@ const destroyFn = (editorView, editorAnalyticsAPI, isTableScalingEnabled, isTabl
89
89
  return localId === (tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.localId);
90
90
  },
91
91
  onDragStart: () => {
92
- var _api$userIntent;
93
92
  if (expValEquals('cc_editor_interactivity_monitoring', 'isEnabled', true)) {
94
93
  var _insm$session3;
95
94
  (_insm$session3 = insm.session) === null || _insm$session3 === void 0 ? void 0 : _insm$session3.startFeature('tableDragAndDrop');
96
95
  }
97
- toggleDragMenu(false)(editorView.state, editorView.dispatch);
98
96
  if (expValEquals('platform_editor_table_menu_updates', 'isEnabled', true)) {
99
- closeActiveTableMenu()(editorView.state, editorView.dispatch);
97
+ api === null || api === void 0 ? void 0 : api.core.actions.execute(({
98
+ tr
99
+ }) => {
100
+ var _api$userIntent;
101
+ closeActiveTableMenu()({
102
+ tr
103
+ });
104
+ api === null || api === void 0 ? void 0 : (_api$userIntent = api.userIntent) === null || _api$userIntent === void 0 ? void 0 : _api$userIntent.commands.setCurrentUserIntent('dragging')({
105
+ tr
106
+ });
107
+ return tr;
108
+ });
109
+ } else {
110
+ var _api$userIntent2;
111
+ toggleDragMenu(false)(editorView.state, editorView.dispatch);
112
+ api === null || api === void 0 ? void 0 : api.core.actions.execute(api === null || api === void 0 ? void 0 : (_api$userIntent2 = api.userIntent) === null || _api$userIntent2 === void 0 ? void 0 : _api$userIntent2.commands.setCurrentUserIntent('dragging'));
100
113
  }
101
- api === null || api === void 0 ? void 0 : api.core.actions.execute(api === null || api === void 0 ? void 0 : (_api$userIntent = api.userIntent) === null || _api$userIntent === void 0 ? void 0 : _api$userIntent.commands.setCurrentUserIntent('dragging'));
102
114
  },
103
115
  onDrag(event) {
104
- var _api$userIntent2;
116
+ var _api$userIntent3;
105
117
  const data = getDraggableDataFromEvent(event);
106
118
  // If no data can be found then it's most like we do not want to perform any drag actions
107
119
  if (!data) {
@@ -118,10 +130,10 @@ const destroyFn = (editorView, editorAnalyticsAPI, isTableScalingEnabled, isTabl
118
130
  const dropTargetType = sourceType === 'table-row' ? DropTargetType.ROW : DropTargetType.COLUMN;
119
131
  const hasMergedCells = hasMergedCellsInBetween([targetAdjustedIndex - 1, targetAdjustedIndex], dropTargetType)(editorView.state.selection);
120
132
  setDropTarget(dropTargetType, targetAdjustedIndex, hasMergedCells)(editorView.state, editorView.dispatch);
121
- api === null || api === void 0 ? void 0 : api.core.actions.execute(api === null || api === void 0 ? void 0 : (_api$userIntent2 = api.userIntent) === null || _api$userIntent2 === void 0 ? void 0 : _api$userIntent2.commands.setCurrentUserIntent('dragging'));
133
+ api === null || api === void 0 ? void 0 : api.core.actions.execute(api === null || api === void 0 ? void 0 : (_api$userIntent3 = api.userIntent) === null || _api$userIntent3 === void 0 ? void 0 : _api$userIntent3.commands.setCurrentUserIntent('dragging'));
122
134
  },
123
135
  onDrop(event) {
124
- var _cell$row, _cell$col, _api$userIntent3, _api$userIntent3$shar;
136
+ var _cell$row, _cell$col, _api$userIntent4, _api$userIntent4$shar;
125
137
  const data = getDraggableDataFromEvent(event);
126
138
 
127
139
  // On Drop we need to update the table main plugin hoveredCell value with the current row/col that the mouse is
@@ -145,9 +157,9 @@ const destroyFn = (editorView, editorAnalyticsAPI, isTableScalingEnabled, isTabl
145
157
  }
146
158
  };
147
159
  tr.setMeta(tablePluginKey, action);
148
- if ((api === null || api === void 0 ? void 0 : (_api$userIntent3 = api.userIntent) === null || _api$userIntent3 === void 0 ? void 0 : (_api$userIntent3$shar = _api$userIntent3.sharedState.currentState()) === null || _api$userIntent3$shar === void 0 ? void 0 : _api$userIntent3$shar.currentUserIntent) === 'dragging') {
149
- var _api$userIntent4;
150
- api === null || api === void 0 ? void 0 : api.core.actions.execute(api === null || api === void 0 ? void 0 : (_api$userIntent4 = api.userIntent) === null || _api$userIntent4 === void 0 ? void 0 : _api$userIntent4.commands.setCurrentUserIntent('default'));
160
+ if ((api === null || api === void 0 ? void 0 : (_api$userIntent4 = api.userIntent) === null || _api$userIntent4 === void 0 ? void 0 : (_api$userIntent4$shar = _api$userIntent4.sharedState.currentState()) === null || _api$userIntent4$shar === void 0 ? void 0 : _api$userIntent4$shar.currentUserIntent) === 'dragging') {
161
+ var _api$userIntent5;
162
+ api === null || api === void 0 ? void 0 : api.core.actions.execute(api === null || api === void 0 ? void 0 : (_api$userIntent5 = api.userIntent) === null || _api$userIntent5 === void 0 ? void 0 : _api$userIntent5.commands.setCurrentUserIntent('default'));
151
163
  }
152
164
  // If no data can be found then it's most like we do not want to perform any drop action
153
165
  if (!data) {
@@ -1,5 +1,5 @@
1
1
  import React, { useEffect } from 'react';
2
- import { tableCell, tableCellWithNestedTable, tableHeader, tableHeaderWithLocalId, tableHeaderWithNestedTable, tableRow, tableRowWithNestedTable, tableRowWithLocalId, tableCellWithLocalId, tableCellWithNestedTableWithLocalId, tableRowWithNestedTableWithLocalId, tableHeaderWithNestedTableWithLocalId } from '@atlaskit/adf-schema';
2
+ import { tableCell, tableCellStage0, tableCellWithNestedTable, tableCellWithNestedTableStage0, tableHeader, tableHeaderStage0, tableHeaderWithLocalId, tableHeaderWithNestedTable, tableHeaderWithNestedTableStage0, tableRow, tableRowWithNestedTable, tableRowWithLocalId, tableCellWithLocalId, tableCellWithNestedTableWithLocalId, tableRowWithNestedTableWithLocalId, tableHeaderWithNestedTableWithLocalId } from '@atlaskit/adf-schema';
3
3
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD, TABLE_ACTION } from '@atlaskit/editor-common/analytics';
4
4
  import { getBrowserInfo } from '@atlaskit/editor-common/browser';
5
5
  import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
@@ -13,6 +13,7 @@ import { hasParentNodeOfType, safeInsert } from '@atlaskit/editor-prosemirror/ut
13
13
  import { tableEditing } from '@atlaskit/editor-tables/pm-plugins';
14
14
  import { fg } from '@atlaskit/platform-feature-flags';
15
15
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
16
+ import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
16
17
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
17
18
  import { tableNodeSpecWithFixedToDOM } from './nodeviews/toDOM';
18
19
  import { createPlugin as createActiveCellHighlightPlugin } from './pm-plugins/active-cell-highlight/plugin';
@@ -245,13 +246,13 @@ const tablePlugin = ({
245
246
  })
246
247
  }, {
247
248
  name: 'tableHeader',
248
- node: fg('platform_editor_adf_with_localid') ? tableHeaderWithNestedTableWithLocalId : tableHeaderWithNestedTable
249
+ node: expValEqualsNoExposure('platform_editor_table_menu_updates', 'isEnabled', true) ? tableHeaderWithNestedTableStage0 : fg('platform_editor_adf_with_localid') ? tableHeaderWithNestedTableWithLocalId : tableHeaderWithNestedTable
249
250
  }, {
250
251
  name: 'tableRow',
251
252
  node: fg('platform_editor_adf_with_localid') ? tableRowWithNestedTableWithLocalId : tableRowWithNestedTable
252
253
  }, {
253
254
  name: 'tableCell',
254
- node: fg('platform_editor_adf_with_localid') ? tableCellWithNestedTableWithLocalId : tableCellWithNestedTable
255
+ node: expValEqualsNoExposure('platform_editor_table_menu_updates', 'isEnabled', true) ? tableCellWithNestedTableStage0 : fg('platform_editor_adf_with_localid') ? tableCellWithNestedTableWithLocalId : tableCellWithNestedTable
255
256
  }] : [{
256
257
  name: 'table',
257
258
  node: tableNodeSpecWithFixedToDOM({
@@ -266,13 +267,13 @@ const tablePlugin = ({
266
267
  })
267
268
  }, {
268
269
  name: 'tableHeader',
269
- node: fg('platform_editor_adf_with_localid') ? tableHeaderWithLocalId : tableHeader
270
+ node: expValEqualsNoExposure('platform_editor_table_menu_updates', 'isEnabled', true) ? tableHeaderStage0 : fg('platform_editor_adf_with_localid') ? tableHeaderWithLocalId : tableHeader
270
271
  }, {
271
272
  name: 'tableRow',
272
273
  node: fg('platform_editor_adf_with_localid') ? tableRowWithLocalId : tableRow
273
274
  }, {
274
275
  name: 'tableCell',
275
- node: fg('platform_editor_adf_with_localid') ? tableCellWithLocalId : tableCell
276
+ node: expValEqualsNoExposure('platform_editor_table_menu_updates', 'isEnabled', true) ? tableCellStage0 : fg('platform_editor_adf_with_localid') ? tableCellWithLocalId : tableCell
276
277
  }];
277
278
  },
278
279
  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
 
@@ -63,10 +64,23 @@ const FloatingContextualButtonInner = /*#__PURE__*/React.memo(props => {
63
64
  dispatch
64
65
  } = editorView;
65
66
  if (expValEquals('platform_editor_table_menu_updates', 'isEnabled', true)) {
66
- toggleActiveTableMenu({
67
- type: 'cell',
68
- openedBy: 'mouse'
69
- })(state, dispatch);
67
+ if (!api) {
68
+ return;
69
+ }
70
+ const {
71
+ activeTableMenu: currentActiveTableMenu
72
+ } = getPluginState(state);
73
+ api.core.actions.execute(({
74
+ tr
75
+ }) => {
76
+ toggleActiveTableMenu({
77
+ type: 'cell',
78
+ openedBy: 'mouse'
79
+ }, currentActiveTableMenu)({
80
+ tr
81
+ });
82
+ return tr;
83
+ });
70
84
  return;
71
85
  }
72
86
 
@@ -89,15 +103,28 @@ const FloatingContextualButtonInner = /*#__PURE__*/React.memo(props => {
89
103
  } = editorView;
90
104
  // open the menu when the keyboard shortcut is pressed
91
105
  if (expValEquals('platform_editor_table_menu_updates', 'isEnabled', true)) {
92
- toggleActiveTableMenu({
93
- type: 'cell',
94
- openedBy: 'keyboard'
95
- })(state, dispatch);
106
+ if (!api) {
107
+ return;
108
+ }
109
+ const {
110
+ activeTableMenu: currentActiveTableMenu
111
+ } = getPluginState(state);
112
+ api.core.actions.execute(({
113
+ tr
114
+ }) => {
115
+ toggleActiveTableMenu({
116
+ type: 'cell',
117
+ openedBy: 'keyboard'
118
+ }, currentActiveTableMenu)({
119
+ tr
120
+ });
121
+ return tr;
122
+ });
96
123
  return;
97
124
  }
98
125
  toggleContextualMenu()(state, dispatch);
99
126
  }
100
- }, [isCellMenuOpenByKeyboard, isCellMenuOpen, editorView]);
127
+ }, [isCellMenuOpenByKeyboard, isCellMenuOpen, editorView, api]);
101
128
  if (!targetCellRef || !(targetCellRef instanceof HTMLElement)) {
102
129
  return null;
103
130
  }
@@ -31,11 +31,11 @@ export const CellMenuPopup = ({
31
31
  const {
32
32
  isCellMenuOpenByKeyboard
33
33
  } = getPluginState(editorView.state);
34
- closeActiveTableMenu()(editorView.state, editorView.dispatch);
34
+ api === null || api === void 0 ? void 0 : api.core.actions.execute(closeActiveTableMenu());
35
35
  if (isCellMenuOpenByKeyboard) {
36
36
  setFocusToCellMenu(false)(editorView.state, editorView.dispatch);
37
37
  }
38
- }, [editorView]);
38
+ }, [api === null || api === void 0 ? void 0 : api.core.actions, editorView]);
39
39
  const isEventInsideCellMenu = useCallback(event => {
40
40
  var _popupContentRef$curr;
41
41
  const target = event.target;
@@ -1,8 +1,14 @@
1
1
  import React from 'react';
2
+ import { tableMessages as messages } from '@atlaskit/editor-common/messages';
2
3
  import { ToolbarDropdownItemSection } from '@atlaskit/editor-toolbar';
4
+ import AlignPositionBottomIcon from '@atlaskit/icon-lab/core/align-position-bottom';
5
+ import AlignPositionCenterVerticalIcon from '@atlaskit/icon-lab/core/align-position-center-vertical';
6
+ import AlignPositionTopIcon from '@atlaskit/icon-lab/core/align-position-top';
3
7
  import { MergeCellsItem } from './items/MergeCellsItem';
4
8
  import { SplitCellItem } from './items/SplitCellItem';
5
- import { CELL_MENU, CELL_ACTION_SECTION, CELL_DANGER_SECTION, CELL_MENU_RANK, MERGE_CELLS_ITEM, SPLIT_CELL_ITEM, CELL_ACTION_SECTION_RANK } from './keys';
9
+ import { VerticalAlignDropdownItem } from './items/VerticalAlignDropdownItem';
10
+ import { VerticalAlignNestedMenu } from './items/VerticalAlignNestedMenu';
11
+ import { CELL_MENU, CELL_ACTION_SECTION, CELL_DANGER_SECTION, CELL_MENU_RANK, MERGE_CELLS_ITEM, SPLIT_CELL_ITEM, CELL_ACTION_SECTION_RANK, VERTICAL_ALIGN_BOTTOM_ITEM, VERTICAL_ALIGN_MENU, VERTICAL_ALIGN_MENU_RANK, VERTICAL_ALIGN_MENU_SECTION, VERTICAL_ALIGN_MENU_SECTION_RANK, VERTICAL_ALIGN_MIDDLE_ITEM, VERTICAL_ALIGN_TOP_ITEM } from './keys';
6
12
  export const getCellMenuComponents = ({
7
13
  api
8
14
  }) => [
@@ -21,6 +27,66 @@ export const getCellMenuComponents = ({
21
27
  rank: CELL_MENU_RANK[CELL_ACTION_SECTION.key]
22
28
  }],
23
29
  component: props => /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, null, props.children)
30
+ }, {
31
+ type: VERTICAL_ALIGN_MENU.type,
32
+ key: VERTICAL_ALIGN_MENU.key,
33
+ parents: [{
34
+ type: CELL_ACTION_SECTION.type,
35
+ key: CELL_ACTION_SECTION.key,
36
+ rank: CELL_ACTION_SECTION_RANK[VERTICAL_ALIGN_MENU.key]
37
+ }],
38
+ component: props => /*#__PURE__*/React.createElement(VerticalAlignNestedMenu, null, props.children)
39
+ }, {
40
+ type: VERTICAL_ALIGN_MENU_SECTION.type,
41
+ key: VERTICAL_ALIGN_MENU_SECTION.key,
42
+ parents: [{
43
+ type: VERTICAL_ALIGN_MENU.type,
44
+ key: VERTICAL_ALIGN_MENU.key,
45
+ rank: VERTICAL_ALIGN_MENU_RANK[VERTICAL_ALIGN_MENU_SECTION.key]
46
+ }],
47
+ component: props => /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, null, props.children)
48
+ }, {
49
+ type: VERTICAL_ALIGN_TOP_ITEM.type,
50
+ key: VERTICAL_ALIGN_TOP_ITEM.key,
51
+ parents: [{
52
+ type: VERTICAL_ALIGN_MENU_SECTION.type,
53
+ key: VERTICAL_ALIGN_MENU_SECTION.key,
54
+ rank: VERTICAL_ALIGN_MENU_SECTION_RANK[VERTICAL_ALIGN_TOP_ITEM.key]
55
+ }],
56
+ component: () => /*#__PURE__*/React.createElement(VerticalAlignDropdownItem, {
57
+ api: api,
58
+ icon: AlignPositionTopIcon,
59
+ label: messages.cellAlignmentTop,
60
+ value: "top"
61
+ })
62
+ }, {
63
+ type: VERTICAL_ALIGN_MIDDLE_ITEM.type,
64
+ key: VERTICAL_ALIGN_MIDDLE_ITEM.key,
65
+ parents: [{
66
+ type: VERTICAL_ALIGN_MENU_SECTION.type,
67
+ key: VERTICAL_ALIGN_MENU_SECTION.key,
68
+ rank: VERTICAL_ALIGN_MENU_SECTION_RANK[VERTICAL_ALIGN_MIDDLE_ITEM.key]
69
+ }],
70
+ component: () => /*#__PURE__*/React.createElement(VerticalAlignDropdownItem, {
71
+ api: api,
72
+ icon: AlignPositionCenterVerticalIcon,
73
+ label: messages.cellAlignmentMiddle,
74
+ value: "middle"
75
+ })
76
+ }, {
77
+ type: VERTICAL_ALIGN_BOTTOM_ITEM.type,
78
+ key: VERTICAL_ALIGN_BOTTOM_ITEM.key,
79
+ parents: [{
80
+ type: VERTICAL_ALIGN_MENU_SECTION.type,
81
+ key: VERTICAL_ALIGN_MENU_SECTION.key,
82
+ rank: VERTICAL_ALIGN_MENU_SECTION_RANK[VERTICAL_ALIGN_BOTTOM_ITEM.key]
83
+ }],
84
+ component: () => /*#__PURE__*/React.createElement(VerticalAlignDropdownItem, {
85
+ api: api,
86
+ icon: AlignPositionBottomIcon,
87
+ label: messages.cellAlignmentBottom,
88
+ value: "bottom"
89
+ })
24
90
  }, {
25
91
  type: MERGE_CELLS_ITEM.type,
26
92
  key: MERGE_CELLS_ITEM.key,
@@ -27,7 +27,8 @@ export const MergeCellsItem = ({
27
27
  return;
28
28
  }
29
29
  mergeCellsWithAnalytics(api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)(INPUT_METHOD.CONTEXT_MENU)(editorView.state, editorView.dispatch);
30
- closeActiveTableMenu()(editorView.state, editorView.dispatch);
30
+ api === null || api === void 0 ? void 0 : api.core.actions.execute(closeActiveTableMenu());
31
+ api === null || api === void 0 ? void 0 : api.core.actions.focus();
31
32
  };
32
33
  if (!shouldShowMergeCells(tableMenuContext)) {
33
34
  return null;
@@ -27,7 +27,8 @@ export const SplitCellItem = ({
27
27
  return;
28
28
  }
29
29
  splitCellWithAnalytics(api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)(INPUT_METHOD.CONTEXT_MENU)(editorView.state, editorView.dispatch);
30
- closeActiveTableMenu()(editorView.state, editorView.dispatch);
30
+ api === null || api === void 0 ? void 0 : api.core.actions.execute(closeActiveTableMenu());
31
+ api === null || api === void 0 ? void 0 : api.core.actions.focus();
31
32
  };
32
33
  if (!shouldShowSplitCell(tableMenuContext)) {
33
34
  return null;
@@ -0,0 +1,56 @@
1
+ import React, { useCallback, useMemo } from 'react';
2
+ import { useIntl } from 'react-intl';
3
+ import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
4
+ import { closeActiveTableMenu, setMultipleCellAttrsEditorCommand } from '../../../../pm-plugins/commands';
5
+ import { getPluginState } from '../../../../pm-plugins/plugin-factory';
6
+ import { useTableMenuContext } from '../../shared/TableMenuContext';
7
+ import { getSelectedCellValign } from './verticalAlignUtils';
8
+ export const VerticalAlignDropdownItem = ({
9
+ api,
10
+ icon: Icon,
11
+ label,
12
+ value
13
+ }) => {
14
+ var _useTableMenuContext;
15
+ const {
16
+ editorView
17
+ } = (_useTableMenuContext = useTableMenuContext()) !== null && _useTableMenuContext !== void 0 ? _useTableMenuContext : {};
18
+ const {
19
+ formatMessage
20
+ } = useIntl();
21
+ const selectedValign = useMemo(() => getSelectedCellValign(editorView), [editorView]);
22
+ const handleClick = useCallback(() => {
23
+ if (!editorView || !api) {
24
+ return;
25
+ }
26
+ const {
27
+ targetCellPosition
28
+ } = getPluginState(editorView.state);
29
+ api.core.actions.execute(({
30
+ tr
31
+ }) => {
32
+ setMultipleCellAttrsEditorCommand({
33
+ valign: value
34
+ }, targetCellPosition)({
35
+ tr
36
+ });
37
+ closeActiveTableMenu()({
38
+ tr
39
+ });
40
+ return tr;
41
+ });
42
+ api.core.actions.focus();
43
+ }, [api, editorView, value]);
44
+ if (!editorView) {
45
+ return null;
46
+ }
47
+ return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
48
+ elemBefore: /*#__PURE__*/React.createElement(Icon, {
49
+ color: "currentColor",
50
+ label: "",
51
+ size: "small"
52
+ }),
53
+ isSelected: selectedValign === value,
54
+ onClick: handleClick
55
+ }, formatMessage(label));
56
+ };
@@ -0,0 +1,48 @@
1
+ import React, { useMemo } from 'react';
2
+ import { useIntl } from 'react-intl';
3
+ import { tableMessages as messages } from '@atlaskit/editor-common/messages';
4
+ import { NestedDropdownRightIcon, ToolbarNestedDropdownMenu } from '@atlaskit/editor-toolbar';
5
+ import AlignPositionBottomIcon from '@atlaskit/icon-lab/core/align-position-bottom';
6
+ import AlignPositionCenterVerticalIcon from '@atlaskit/icon-lab/core/align-position-center-vertical';
7
+ import AlignPositionTopIcon from '@atlaskit/icon-lab/core/align-position-top';
8
+ import { useTableMenuContext } from '../../shared/TableMenuContext';
9
+ import { getSelectedCellValign } from './verticalAlignUtils';
10
+ const getTriggerIcon = valign => {
11
+ switch (valign) {
12
+ case 'middle':
13
+ return AlignPositionCenterVerticalIcon;
14
+ case 'bottom':
15
+ return AlignPositionBottomIcon;
16
+ case 'top':
17
+ default:
18
+ return AlignPositionTopIcon;
19
+ }
20
+ };
21
+ export const VerticalAlignNestedMenu = ({
22
+ children
23
+ }) => {
24
+ var _useTableMenuContext;
25
+ const {
26
+ editorView
27
+ } = (_useTableMenuContext = useTableMenuContext()) !== null && _useTableMenuContext !== void 0 ? _useTableMenuContext : {};
28
+ const {
29
+ formatMessage
30
+ } = useIntl();
31
+ const selectedValign = useMemo(() => getSelectedCellValign(editorView), [editorView]);
32
+ const TriggerIcon = getTriggerIcon(selectedValign);
33
+ if (!editorView) {
34
+ return null;
35
+ }
36
+ return /*#__PURE__*/React.createElement(ToolbarNestedDropdownMenu, {
37
+ elemBefore: /*#__PURE__*/React.createElement(TriggerIcon, {
38
+ color: "currentColor",
39
+ label: "",
40
+ size: "small"
41
+ }),
42
+ elemAfter: /*#__PURE__*/React.createElement(NestedDropdownRightIcon, {
43
+ label: "",
44
+ size: "small"
45
+ }),
46
+ text: formatMessage(messages.cellAlignment)
47
+ }, children);
48
+ };
@@ -0,0 +1,15 @@
1
+ import { getPluginState } from '../../../../pm-plugins/plugin-factory';
2
+ const getNormalizedValign = valign => valign !== null && valign !== void 0 ? valign : 'top';
3
+ export const getSelectedCellValign = editorView => {
4
+ if (!editorView) {
5
+ return 'top';
6
+ }
7
+ const {
8
+ state
9
+ } = editorView;
10
+ const {
11
+ targetCellPosition
12
+ } = getPluginState(state);
13
+ const cell = typeof targetCellPosition === 'number' ? state.doc.nodeAt(targetCellPosition) : undefined;
14
+ return getNormalizedValign(cell === null || cell === void 0 ? void 0 : cell.attrs.valign);
15
+ };
@@ -29,13 +29,42 @@ export const SPLIT_CELL_ITEM = {
29
29
  type: 'menu-item',
30
30
  key: 'split-cell'
31
31
  };
32
+ export const VERTICAL_ALIGN_MENU = {
33
+ type: 'nested-menu',
34
+ key: 'vertical-align'
35
+ };
36
+ export const VERTICAL_ALIGN_MENU_SECTION = {
37
+ type: 'menu-section',
38
+ key: 'vertical-align-section'
39
+ };
40
+ export const VERTICAL_ALIGN_TOP_ITEM = {
41
+ type: 'menu-item',
42
+ key: 'vertical-align-top'
43
+ };
44
+ export const VERTICAL_ALIGN_MIDDLE_ITEM = {
45
+ type: 'menu-item',
46
+ key: 'vertical-align-middle'
47
+ };
48
+ export const VERTICAL_ALIGN_BOTTOM_ITEM = {
49
+ type: 'menu-item',
50
+ key: 'vertical-align-bottom'
51
+ };
32
52
 
33
53
  // --- Item ranks within their sections ---
34
54
 
35
55
  export const CELL_ACTION_SECTION_RANK = {
36
56
  [BACKGROUND_COLOR_ITEM.key]: 100,
37
- [MERGE_CELLS_ITEM.key]: 200,
38
- [SPLIT_CELL_ITEM.key]: 300
57
+ [VERTICAL_ALIGN_MENU.key]: 200,
58
+ [MERGE_CELLS_ITEM.key]: 300,
59
+ [SPLIT_CELL_ITEM.key]: 400
60
+ };
61
+ export const VERTICAL_ALIGN_MENU_RANK = {
62
+ [VERTICAL_ALIGN_MENU_SECTION.key]: 100
63
+ };
64
+ export const VERTICAL_ALIGN_MENU_SECTION_RANK = {
65
+ [VERTICAL_ALIGN_TOP_ITEM.key]: 100,
66
+ [VERTICAL_ALIGN_MIDDLE_ITEM.key]: 200,
67
+ [VERTICAL_ALIGN_BOTTOM_ITEM.key]: 300
39
68
  };
40
69
  export const CELL_DANGER_SECTION_RANK = {
41
70
  [CLEAR_CELLS_ITEM.key]: 100
@@ -6,6 +6,7 @@ import { addColumnBefore, 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 { TableColumnAddLeftIcon, ToolbarDropdownItem, ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar';
9
+ import { closeActiveTableMenu } from '../../../../pm-plugins/commands';
9
10
  import { insertColumnWithAnalytics } from '../../../../pm-plugins/commands/commands-with-analytics';
10
11
  import { useTableMenuContext } from '../../shared/TableMenuContext';
11
12
  export const AddColumnLeftItem = ({
@@ -42,6 +43,8 @@ export const AddColumnLeftItem = ({
42
43
  }
43
44
  const shouldUseIncreasedScalingPercent = isTableScalingEnabled && (isTableFixedColumnWidthsOptionEnabled || isCommentEditor);
44
45
  insertColumnWithAnalytics(api, api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor)(INPUT_METHOD.TABLE_CONTEXT_MENU, index)(editorView.state, editorView.dispatch, editorView);
46
+ api === null || api === void 0 ? void 0 : api.core.actions.execute(closeActiveTableMenu());
47
+ api === null || api === void 0 ? void 0 : api.core.actions.focus();
45
48
  };
46
49
  return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
47
50
  onClick: handleClick,
@@ -6,6 +6,7 @@ import { addColumnAfter, 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 { TableColumnAddRightIcon, ToolbarDropdownItem, ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar';
9
+ import { closeActiveTableMenu } from '../../../../pm-plugins/commands';
9
10
  import { insertColumnWithAnalytics } from '../../../../pm-plugins/commands/commands-with-analytics';
10
11
  import { useTableMenuContext } from '../../shared/TableMenuContext';
11
12
  export const AddColumnRightItem = ({
@@ -42,6 +43,8 @@ export const AddColumnRightItem = ({
42
43
  }
43
44
  const shouldUseIncreasedScalingPercent = isTableScalingEnabled && (isTableFixedColumnWidthsOptionEnabled || isCommentEditor);
44
45
  insertColumnWithAnalytics(api, api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor)(INPUT_METHOD.TABLE_CONTEXT_MENU, index)(editorView.state, editorView.dispatch, editorView);
46
+ api === null || api === void 0 ? void 0 : api.core.actions.execute(closeActiveTableMenu());
47
+ api === null || api === void 0 ? void 0 : api.core.actions.focus();
45
48
  };
46
49
  return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
47
50
  onClick: handleClick,
@@ -6,7 +6,7 @@ import { deleteColumn, 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, hoverColumns } from '../../../../pm-plugins/commands';
9
+ import { clearHoverSelection, closeActiveTableMenu, hoverColumns } from '../../../../pm-plugins/commands';
10
10
  import { deleteColumnsWithAnalytics } from '../../../../pm-plugins/commands/commands-with-analytics';
11
11
  import { getSelectedColumnIndexes } from '../../../../pm-plugins/utils/selection';
12
12
  import { useTableMenuContext } from '../../shared/TableMenuContext';
@@ -61,6 +61,8 @@ export const DeleteColumnItem = ({
61
61
  }
62
62
  const shouldUseIncreasedScalingPercent = isTableScalingEnabled && (isTableFixedColumnWidthsOptionEnabled || isCommentEditor);
63
63
  deleteColumnsWithAnalytics(api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, api, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor)(INPUT_METHOD.TABLE_CONTEXT_MENU, selectionRect)(editorView.state, editorView.dispatch, editorView);
64
+ api === null || api === void 0 ? void 0 : api.core.actions.execute(closeActiveTableMenu());
65
+ api === null || api === void 0 ? void 0 : api.core.actions.focus();
64
66
  };
65
67
  return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
66
68
  onClick: handleClick,
@@ -5,6 +5,7 @@ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks'
5
5
  import { tableMessages as messages } from '@atlaskit/editor-common/messages';
6
6
  import { getSelectionRect } from '@atlaskit/editor-tables/utils';
7
7
  import { TableColumnsDistributeIcon, ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
8
+ import { closeActiveTableMenu } from '../../../../pm-plugins/commands';
8
9
  import { distributeColumnsWidthsWithAnalytics } from '../../../../pm-plugins/commands/commands-with-analytics';
9
10
  import { getNewResizeStateFromSelectedColumns } from '../../../../pm-plugins/table-resizing/utils/resize-state';
10
11
  import { useTableMenuContext } from '../../shared/TableMenuContext';
@@ -47,6 +48,8 @@ export const DistributeColumnsItem = ({
47
48
  return;
48
49
  }
49
50
  distributeColumnsWidthsWithAnalytics(api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, api)(INPUT_METHOD.TABLE_CONTEXT_MENU, newResizeState)(editorView.state, editorView.dispatch);
51
+ api === null || api === void 0 ? void 0 : api.core.actions.execute(closeActiveTableMenu());
52
+ api === null || api === void 0 ? void 0 : api.core.actions.focus();
50
53
  };
51
54
  if (!shouldShowDistributeColumns(tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.selectedColumnCount)) {
52
55
  return null;
@@ -7,6 +7,7 @@ import { tableMessages as messages } from '@atlaskit/editor-common/messages';
7
7
  import { getSelectionRect } from '@atlaskit/editor-tables/utils';
8
8
  import { ToolbarDropdownItem, ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar';
9
9
  import TableColumnMoveLeftIcon from '@atlaskit/icon/core/table-column-move-left';
10
+ import { closeActiveTableMenu } from '../../../../pm-plugins/commands';
10
11
  import { moveSourceWithAnalytics } from '../../../../pm-plugins/drag-and-drop/commands-with-analytics';
11
12
  import { getPluginState } from '../../../../pm-plugins/plugin-factory';
12
13
  import { getSelectedColumnIndexes } from '../../../../pm-plugins/utils/selection';
@@ -44,6 +45,8 @@ export const MoveColumnLeftItem = props => {
44
45
  return;
45
46
  }
46
47
  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_COLUMN, getSelectedColumnIndexes(selectionRect), selectionRect.left - 1)(editorView.state, editorView.dispatch);
48
+ api === null || api === void 0 ? void 0 : api.core.actions.execute(closeActiveTableMenu());
49
+ api === null || api === void 0 ? void 0 : api.core.actions.focus();
47
50
  };
48
51
  if (!tableNode || !shouldShowMoveColumnLeft(tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.isFirstColumn)) {
49
52
  return null;
@@ -6,6 +6,7 @@ import { moveColumnRight, 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 { TableColumnMoveRightIcon, 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 { getSelectedColumnIndexes } from '../../../../pm-plugins/utils/selection';
@@ -43,6 +44,8 @@ export const MoveColumnRightItem = 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_COLUMN, getSelectedColumnIndexes(selectionRect), selectionRect.right)(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 || !shouldShowMoveColumnRight(tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.isLastColumn)) {
48
51
  return null;
@@ -5,6 +5,7 @@ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
5
5
  import { tableMessages as messages } from '@atlaskit/editor-common/messages';
6
6
  import { getSelectionRect } from '@atlaskit/editor-tables/utils';
7
7
  import { ArrowDownIcon, ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
8
+ import { closeActiveTableMenu } from '../../../../pm-plugins/commands';
8
9
  import { sortColumnWithAnalytics } from '../../../../pm-plugins/commands/commands-with-analytics';
9
10
  import { useTableMenuContext } from '../../shared/TableMenuContext';
10
11
  export const SortDecreasingItem = ({
@@ -28,6 +29,8 @@ export const SortDecreasingItem = ({
28
29
  return;
29
30
  }
30
31
  sortColumnWithAnalytics(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, columnIndex, SortOrder.DESC)(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();
31
34
  };
32
35
  return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
33
36
  onClick: handleClick,
@@ -5,6 +5,7 @@ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
5
5
  import { tableMessages as messages } from '@atlaskit/editor-common/messages';
6
6
  import { getSelectionRect } from '@atlaskit/editor-tables/utils';
7
7
  import { ArrowUpIcon, ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
8
+ import { closeActiveTableMenu } from '../../../../pm-plugins/commands';
8
9
  import { sortColumnWithAnalytics } from '../../../../pm-plugins/commands/commands-with-analytics';
9
10
  import { useTableMenuContext } from '../../shared/TableMenuContext';
10
11
  export const SortIncreasingItem = ({
@@ -28,6 +29,8 @@ export const SortIncreasingItem = ({
28
29
  return;
29
30
  }
30
31
  sortColumnWithAnalytics(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, columnIndex, SortOrder.ASC)(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();
31
34
  };
32
35
  return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
33
36
  onClick: handleClick,
@@ -5,6 +5,7 @@ import { addRowBefore, 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 { TableRowAddAboveIcon, 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 AddRowAboveItem = props => {
@@ -32,6 +33,8 @@ export const AddRowAboveItem = 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,