@atlaskit/editor-plugin-table 7.19.7 → 7.19.8

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @atlaskit/editor-plugin-table
2
2
 
3
+ ## 7.19.8
4
+
5
+ ### Patch Changes
6
+
7
+ - [`7c716627bd4f4`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/7c716627bd4f4) -
8
+ Table Drag move column/row logic FF cleanup
9
+ - Updated dependencies
10
+
3
11
  ## 7.19.7
4
12
 
5
13
  ### Patch Changes
@@ -23,7 +23,6 @@ var _shortcut = require("@atlaskit/editor-shared-styles/shortcut");
23
23
  var _tableMap = require("@atlaskit/editor-tables/table-map");
24
24
  var _utils2 = require("@atlaskit/editor-tables/utils");
25
25
  var _backgroundColor = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/background-color"));
26
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
27
26
  var _toggle = _interopRequireDefault(require("@atlaskit/toggle"));
28
27
  var _commands = require("../../commands");
29
28
  var _commandsWithAnalytics = require("../../commands-with-analytics");
@@ -186,7 +185,7 @@ var convertToDropdownItems = function convertToDropdownItems(dragMenuConfig, for
186
185
  };
187
186
  var ColorPaletteWithListeners = (0, _ui.withOuterListeners)(_uiColor.ColorPalette);
188
187
  var DragMenu = exports.DragMenu = /*#__PURE__*/_react.default.memo(function (_ref) {
189
- var _pluginConfig$allowBa;
188
+ var _tableMap$hasMergedCe, _pluginConfig$allowBa;
190
189
  var _ref$direction = _ref.direction,
191
190
  direction = _ref$direction === void 0 ? 'row' : _ref$direction,
192
191
  index = _ref.index,
@@ -220,19 +219,9 @@ var DragMenu = exports.DragMenu = /*#__PURE__*/_react.default.memo(function (_re
220
219
  var _getPluginState = (0, _pluginFactory.getPluginState)(state),
221
220
  isKeyboardModeActive = _getPluginState.isKeyboardModeActive;
222
221
  var selectionRect = (0, _utils2.isSelectionType)(selection, 'cell') ? (0, _utils2.getSelectionRect)(selection) : (0, _utils2.findCellRectClosestToPos)(selection.$from);
223
- var shouldMoveDisabled;
224
- var hasMergedCellsInTable;
225
- if ((0, _platformFeatureFlags.fg)('platform.editor.table.drag-move-options-logic-update_fp7xw')) {
226
- var _tableMap$hasMergedCe;
227
- shouldMoveDisabled = false;
228
- hasMergedCellsInTable = (_tableMap$hasMergedCe = tableMap === null || tableMap === void 0 ? void 0 : tableMap.hasMergedCells()) !== null && _tableMap$hasMergedCe !== void 0 ? _tableMap$hasMergedCe : false;
229
- } else {
230
- var hasMergedCells = direction === 'row' ? _utils3.hasMergedCellsInRow : _utils3.hasMergedCellsInColumn;
231
- shouldMoveDisabled = index !== undefined && hasMergedCells(index)(selection);
232
- hasMergedCellsInTable = (0, _utils3.getMergedCellsPositions)(state.tr).length > 0;
233
- }
222
+ var hasMergedCellsInTable = (_tableMap$hasMergedCe = tableMap === null || tableMap === void 0 ? void 0 : tableMap.hasMergedCells()) !== null && _tableMap$hasMergedCe !== void 0 ? _tableMap$hasMergedCe : false;
234
223
  var allowBackgroundColor = (_pluginConfig$allowBa = pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.allowBackgroundColor) !== null && _pluginConfig$allowBa !== void 0 ? _pluginConfig$allowBa : false;
235
- var dragMenuConfig = (0, _dragMenu.getDragMenuConfig)(direction, getEditorContainerWidth, !shouldMoveDisabled, hasMergedCellsInTable, editorView, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI, pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.isHeaderRowRequired, isTableScalingEnabled, tableDuplicateCellColouring, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, tableSortColumnReorder);
224
+ var dragMenuConfig = (0, _dragMenu.getDragMenuConfig)(direction, getEditorContainerWidth, hasMergedCellsInTable, editorView, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI, pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.isHeaderRowRequired, isTableScalingEnabled, tableDuplicateCellColouring, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, tableSortColumnReorder);
236
225
  var _convertToDropdownIte = convertToDropdownItems(dragMenuConfig, formatMessage, tableSortColumnReorder, selectionRect),
237
226
  menuItems = _convertToDropdownIte.menuItems,
238
227
  menuCallback = _convertToDropdownIte.menuCallback;
@@ -18,7 +18,6 @@ var _layoutThreeEqual = _interopRequireDefault(require("@atlaskit/icon/glyph/edi
18
18
  var _remove = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/remove"));
19
19
  var _chevronDoubleDown = _interopRequireDefault(require("@atlaskit/icon/glyph/hipchat/chevron-double-down"));
20
20
  var _chevronDoubleUp = _interopRequireDefault(require("@atlaskit/icon/glyph/hipchat/chevron-double-up"));
21
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
22
21
  var _commandsWithAnalytics = require("../commands-with-analytics");
23
22
  var _commandsWithAnalytics2 = require("../pm-plugins/drag-and-drop/commands-with-analytics");
24
23
  var _resizeState = require("../pm-plugins/table-resizing/utils/resize-state");
@@ -47,17 +46,10 @@ var canMove = exports.canMove = function canMove(sourceType, direction, totalIte
47
46
  if (hasMergedCellsInTarget) {
48
47
  return false;
49
48
  }
50
- if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.drag-move-options-logic-update_fp7xw')) {
51
- // We can't move if selection in the source is not a rectangle
52
- if ((0, _mergedCells.hasMergedCellsInSelection)(selectedIndexes, isRow ? 'row' : 'column')(selection)) {
53
- return false;
54
- }
55
- } else {
56
- // Currently we can't move in any direction if there are merged cells in the source
57
- var hasMergedCellsInSource = isRow ? (0, _mergedCells.hasMergedCellsInRow)(selectedIndexes)(selection) : (0, _mergedCells.hasMergedCellsInColumn)(selectedIndexes)(selection);
58
- if (hasMergedCellsInSource) {
59
- return false;
60
- }
49
+
50
+ // We can't move if selection in the source is not a rectangle
51
+ if ((0, _mergedCells.hasMergedCellsInSelection)(selectedIndexes, isRow ? 'row' : 'column')(selection)) {
52
+ return false;
61
53
  }
62
54
  return true;
63
55
  };
@@ -75,13 +67,13 @@ var defaultSelectionRect = {
75
67
  right: 0,
76
68
  bottom: 0
77
69
  };
78
- var getDragMenuConfig = exports.getDragMenuConfig = function getDragMenuConfig(direction, getEditorContainerWidth, canDrag, hasMergedCellsInTable, editorView, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI, isHeaderRowRequired) {
70
+ var getDragMenuConfig = exports.getDragMenuConfig = function getDragMenuConfig(direction, getEditorContainerWidth, hasMergedCellsInTable, editorView, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI, isHeaderRowRequired) {
79
71
  var _tableMap$height, _tableMap$height2, _tableMap$width, _tableMap$width2;
80
- var isTableScalingEnabled = arguments.length > 11 && arguments[11] !== undefined ? arguments[11] : false;
81
- var tableDuplicateCellColouring = arguments.length > 12 && arguments[12] !== undefined ? arguments[12] : false;
82
- var isTableFixedColumnWidthsOptionEnabled = arguments.length > 13 && arguments[13] !== undefined ? arguments[13] : false;
83
- var shouldUseIncreasedScalingPercent = arguments.length > 14 && arguments[14] !== undefined ? arguments[14] : false;
84
- var tableSortColumnReorder = arguments.length > 15 && arguments[15] !== undefined ? arguments[15] : false;
72
+ var isTableScalingEnabled = arguments.length > 10 && arguments[10] !== undefined ? arguments[10] : false;
73
+ var tableDuplicateCellColouring = arguments.length > 11 && arguments[11] !== undefined ? arguments[11] : false;
74
+ var isTableFixedColumnWidthsOptionEnabled = arguments.length > 12 && arguments[12] !== undefined ? arguments[12] : false;
75
+ var shouldUseIncreasedScalingPercent = arguments.length > 13 && arguments[13] !== undefined ? arguments[13] : false;
76
+ var tableSortColumnReorder = arguments.length > 14 && arguments[14] !== undefined ? arguments[14] : false;
85
77
  var selection = editorView.state.selection;
86
78
  var addOptions = direction === 'row' ? [{
87
79
  label: 'above',
@@ -108,7 +100,7 @@ var getDragMenuConfig = exports.getDragMenuConfig = function getDragMenuConfig(d
108
100
  label: 'up',
109
101
  icon: _arrowUp.default,
110
102
  keymap: _keymaps.moveRowUp,
111
- canMove: canDrag && canMove('table-row', -1, (_tableMap$height = tableMap === null || tableMap === void 0 ? void 0 : tableMap.height) !== null && _tableMap$height !== void 0 ? _tableMap$height : 0, selection, selectionRect),
103
+ canMove: canMove('table-row', -1, (_tableMap$height = tableMap === null || tableMap === void 0 ? void 0 : tableMap.height) !== null && _tableMap$height !== void 0 ? _tableMap$height : 0, selection, selectionRect),
112
104
  getOriginIndexes: _selection.getSelectedRowIndexes,
113
105
  getTargetIndex: function getTargetIndex(selectionRect) {
114
106
  return selectionRect.top - 1;
@@ -117,7 +109,7 @@ var getDragMenuConfig = exports.getDragMenuConfig = function getDragMenuConfig(d
117
109
  label: 'down',
118
110
  icon: _arrowDown.default,
119
111
  keymap: _keymaps.moveRowDown,
120
- canMove: canDrag && canMove('table-row', 1, (_tableMap$height2 = tableMap === null || tableMap === void 0 ? void 0 : tableMap.height) !== null && _tableMap$height2 !== void 0 ? _tableMap$height2 : 0, selection, selectionRect),
112
+ canMove: canMove('table-row', 1, (_tableMap$height2 = tableMap === null || tableMap === void 0 ? void 0 : tableMap.height) !== null && _tableMap$height2 !== void 0 ? _tableMap$height2 : 0, selection, selectionRect),
121
113
  getOriginIndexes: _selection.getSelectedRowIndexes,
122
114
  getTargetIndex: function getTargetIndex(selectionRect) {
123
115
  return selectionRect.bottom;
@@ -126,7 +118,7 @@ var getDragMenuConfig = exports.getDragMenuConfig = function getDragMenuConfig(d
126
118
  label: 'left',
127
119
  icon: _arrowLeft.default,
128
120
  keymap: _keymaps.moveColumnLeft,
129
- canMove: canDrag && canMove('table-column', -1, (_tableMap$width = tableMap === null || tableMap === void 0 ? void 0 : tableMap.width) !== null && _tableMap$width !== void 0 ? _tableMap$width : 0, selection, selectionRect),
121
+ canMove: canMove('table-column', -1, (_tableMap$width = tableMap === null || tableMap === void 0 ? void 0 : tableMap.width) !== null && _tableMap$width !== void 0 ? _tableMap$width : 0, selection, selectionRect),
130
122
  getOriginIndexes: _selection.getSelectedColumnIndexes,
131
123
  getTargetIndex: function getTargetIndex(selectionRect) {
132
124
  return selectionRect.left - 1;
@@ -135,7 +127,7 @@ var getDragMenuConfig = exports.getDragMenuConfig = function getDragMenuConfig(d
135
127
  label: 'right',
136
128
  icon: _arrowRight.default,
137
129
  keymap: _keymaps.moveColumnRight,
138
- canMove: canDrag && canMove('table-column', 1, (_tableMap$width2 = tableMap === null || tableMap === void 0 ? void 0 : tableMap.width) !== null && _tableMap$width2 !== void 0 ? _tableMap$width2 : 0, selection, selectionRect),
130
+ canMove: canMove('table-column', 1, (_tableMap$width2 = tableMap === null || tableMap === void 0 ? void 0 : tableMap.width) !== null && _tableMap$width2 !== void 0 ? _tableMap$width2 : 0, selection, selectionRect),
139
131
  getOriginIndexes: _selection.getSelectedColumnIndexes,
140
132
  getTargetIndex: function getTargetIndex(selectionRect) {
141
133
  return selectionRect.right;
@@ -18,7 +18,6 @@ import { shortcutStyle } from '@atlaskit/editor-shared-styles/shortcut';
18
18
  import { TableMap } from '@atlaskit/editor-tables/table-map';
19
19
  import { findCellRectClosestToPos, getSelectionRect, isSelectionType } from '@atlaskit/editor-tables/utils';
20
20
  import EditorBackgroundColorIcon from '@atlaskit/icon/glyph/editor/background-color';
21
- import { fg } from '@atlaskit/platform-feature-flags';
22
21
  import Toggle from '@atlaskit/toggle';
23
22
  import { clearHoverSelection, hoverColumns, hoverRows } from '../../commands';
24
23
  import { setColorWithAnalytics, toggleHeaderColumnWithAnalytics, toggleHeaderRowWithAnalytics, toggleNumberColumnWithAnalytics } from '../../commands-with-analytics';
@@ -26,7 +25,7 @@ import { toggleDragMenu } from '../../pm-plugins/drag-and-drop/commands';
26
25
  import { getPluginState } from '../../pm-plugins/drag-and-drop/plugin-factory';
27
26
  import { getPluginState as getTablePluginState } from '../../pm-plugins/plugin-factory';
28
27
  import { TableCssClassName as ClassName } from '../../types';
29
- import { checkIfHeaderColumnEnabled, checkIfHeaderRowEnabled, checkIfNumberColumnEnabled, getMergedCellsPositions, getSelectedColumnIndexes, getSelectedRowIndexes, hasMergedCellsInColumn, hasMergedCellsInRow } from '../../utils';
28
+ import { checkIfHeaderColumnEnabled, checkIfHeaderRowEnabled, checkIfNumberColumnEnabled, getSelectedColumnIndexes, getSelectedRowIndexes } from '../../utils';
30
29
  import { getDragMenuConfig } from '../../utils/drag-menu';
31
30
  import { colorPalletteColumns } from '../consts';
32
31
  import { DropdownMenu } from './DropdownMenu';
@@ -193,7 +192,7 @@ export const DragMenu = /*#__PURE__*/React.memo(({
193
192
  isTableFixedColumnWidthsOptionEnabled,
194
193
  tableSortColumnReorder
195
194
  }) => {
196
- var _pluginConfig$allowBa;
195
+ var _tableMap$hasMergedCe, _pluginConfig$allowBa;
197
196
  const {
198
197
  state,
199
198
  dispatch
@@ -207,19 +206,9 @@ export const DragMenu = /*#__PURE__*/React.memo(({
207
206
  isKeyboardModeActive
208
207
  } = getPluginState(state);
209
208
  const selectionRect = isSelectionType(selection, 'cell') ? getSelectionRect(selection) : findCellRectClosestToPos(selection.$from);
210
- let shouldMoveDisabled;
211
- let hasMergedCellsInTable;
212
- if (fg('platform.editor.table.drag-move-options-logic-update_fp7xw')) {
213
- var _tableMap$hasMergedCe;
214
- shouldMoveDisabled = false;
215
- hasMergedCellsInTable = (_tableMap$hasMergedCe = tableMap === null || tableMap === void 0 ? void 0 : tableMap.hasMergedCells()) !== null && _tableMap$hasMergedCe !== void 0 ? _tableMap$hasMergedCe : false;
216
- } else {
217
- const hasMergedCells = direction === 'row' ? hasMergedCellsInRow : hasMergedCellsInColumn;
218
- shouldMoveDisabled = index !== undefined && hasMergedCells(index)(selection);
219
- hasMergedCellsInTable = getMergedCellsPositions(state.tr).length > 0;
220
- }
209
+ const hasMergedCellsInTable = (_tableMap$hasMergedCe = tableMap === null || tableMap === void 0 ? void 0 : tableMap.hasMergedCells()) !== null && _tableMap$hasMergedCe !== void 0 ? _tableMap$hasMergedCe : false;
221
210
  const allowBackgroundColor = (_pluginConfig$allowBa = pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.allowBackgroundColor) !== null && _pluginConfig$allowBa !== void 0 ? _pluginConfig$allowBa : false;
222
- const dragMenuConfig = getDragMenuConfig(direction, getEditorContainerWidth, !shouldMoveDisabled, hasMergedCellsInTable, editorView, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI, pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.isHeaderRowRequired, isTableScalingEnabled, tableDuplicateCellColouring, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, tableSortColumnReorder);
211
+ const dragMenuConfig = getDragMenuConfig(direction, getEditorContainerWidth, hasMergedCellsInTable, editorView, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI, pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.isHeaderRowRequired, isTableScalingEnabled, tableDuplicateCellColouring, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, tableSortColumnReorder);
223
212
  const {
224
213
  menuItems,
225
214
  menuCallback
@@ -10,13 +10,12 @@ import EditorLayoutThreeEqualIcon from '@atlaskit/icon/glyph/editor/layout-three
10
10
  import RemoveIcon from '@atlaskit/icon/glyph/editor/remove';
11
11
  import HipchatChevronDoubleDownIcon from '@atlaskit/icon/glyph/hipchat/chevron-double-down';
12
12
  import HipchatChevronDoubleUpIcon from '@atlaskit/icon/glyph/hipchat/chevron-double-up';
13
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
14
13
  import { deleteColumnsWithAnalytics, deleteRowsWithAnalytics, distributeColumnsWidthsWithAnalytics, emptyMultipleCellsWithAnalytics, insertColumnWithAnalytics, insertRowWithAnalytics, sortColumnWithAnalytics } from '../commands-with-analytics';
15
14
  import { moveSourceWithAnalytics } from '../pm-plugins/drag-and-drop/commands-with-analytics';
16
15
  import { getNewResizeStateFromSelectedColumns } from '../pm-plugins/table-resizing/utils/resize-state';
17
16
  import { getClosestSelectionRect } from '../toolbar';
18
17
  import { AddColLeftIcon, AddColRightIcon, AddRowAboveIcon, AddRowBelowIcon } from '../ui/icons';
19
- import { hasMergedCellsInColumn, hasMergedCellsInRow, hasMergedCellsInSelection, hasMergedCellsWithColumnNextToColumnIndex, hasMergedCellsWithRowNextToRowIndex } from './merged-cells';
18
+ import { hasMergedCellsInSelection, hasMergedCellsWithColumnNextToColumnIndex, hasMergedCellsWithRowNextToRowIndex } from './merged-cells';
20
19
  import { getSelectedColumnIndexes, getSelectedRowIndexes } from './selection';
21
20
  export const getTargetIndex = (selectedIndexes, direction) => Math[direction < 0 ? 'min' : 'max'](...selectedIndexes) + direction;
22
21
  export const canMove = (sourceType, direction, totalItemsOfSourceTypeCount, selection, selectionRect) => {
@@ -37,17 +36,10 @@ export const canMove = (sourceType, direction, totalItemsOfSourceTypeCount, sele
37
36
  if (hasMergedCellsInTarget) {
38
37
  return false;
39
38
  }
40
- if (getBooleanFF('platform.editor.table.drag-move-options-logic-update_fp7xw')) {
41
- // We can't move if selection in the source is not a rectangle
42
- if (hasMergedCellsInSelection(selectedIndexes, isRow ? 'row' : 'column')(selection)) {
43
- return false;
44
- }
45
- } else {
46
- // Currently we can't move in any direction if there are merged cells in the source
47
- const hasMergedCellsInSource = isRow ? hasMergedCellsInRow(selectedIndexes)(selection) : hasMergedCellsInColumn(selectedIndexes)(selection);
48
- if (hasMergedCellsInSource) {
49
- return false;
50
- }
39
+
40
+ // We can't move if selection in the source is not a rectangle
41
+ if (hasMergedCellsInSelection(selectedIndexes, isRow ? 'row' : 'column')(selection)) {
42
+ return false;
51
43
  }
52
44
  return true;
53
45
  };
@@ -65,7 +57,7 @@ const defaultSelectionRect = {
65
57
  right: 0,
66
58
  bottom: 0
67
59
  };
68
- export const getDragMenuConfig = (direction, getEditorContainerWidth, canDrag, hasMergedCellsInTable, editorView, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI, isHeaderRowRequired, isTableScalingEnabled = false, tableDuplicateCellColouring = false, isTableFixedColumnWidthsOptionEnabled = false, shouldUseIncreasedScalingPercent = false, tableSortColumnReorder = false) => {
60
+ export const getDragMenuConfig = (direction, getEditorContainerWidth, hasMergedCellsInTable, editorView, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI, isHeaderRowRequired, isTableScalingEnabled = false, tableDuplicateCellColouring = false, isTableFixedColumnWidthsOptionEnabled = false, shouldUseIncreasedScalingPercent = false, tableSortColumnReorder = false) => {
69
61
  var _tableMap$height, _tableMap$height2, _tableMap$width, _tableMap$width2;
70
62
  const {
71
63
  selection
@@ -95,28 +87,28 @@ export const getDragMenuConfig = (direction, getEditorContainerWidth, canDrag, h
95
87
  label: 'up',
96
88
  icon: ArrowUpIcon,
97
89
  keymap: moveRowUp,
98
- canMove: canDrag && canMove('table-row', -1, (_tableMap$height = tableMap === null || tableMap === void 0 ? void 0 : tableMap.height) !== null && _tableMap$height !== void 0 ? _tableMap$height : 0, selection, selectionRect),
90
+ canMove: canMove('table-row', -1, (_tableMap$height = tableMap === null || tableMap === void 0 ? void 0 : tableMap.height) !== null && _tableMap$height !== void 0 ? _tableMap$height : 0, selection, selectionRect),
99
91
  getOriginIndexes: getSelectedRowIndexes,
100
92
  getTargetIndex: selectionRect => selectionRect.top - 1
101
93
  }, {
102
94
  label: 'down',
103
95
  icon: ArrowDownIcon,
104
96
  keymap: moveRowDown,
105
- canMove: canDrag && canMove('table-row', 1, (_tableMap$height2 = tableMap === null || tableMap === void 0 ? void 0 : tableMap.height) !== null && _tableMap$height2 !== void 0 ? _tableMap$height2 : 0, selection, selectionRect),
97
+ canMove: canMove('table-row', 1, (_tableMap$height2 = tableMap === null || tableMap === void 0 ? void 0 : tableMap.height) !== null && _tableMap$height2 !== void 0 ? _tableMap$height2 : 0, selection, selectionRect),
106
98
  getOriginIndexes: getSelectedRowIndexes,
107
99
  getTargetIndex: selectionRect => selectionRect.bottom
108
100
  }] : [{
109
101
  label: 'left',
110
102
  icon: ArrowLeftIcon,
111
103
  keymap: moveColumnLeft,
112
- canMove: canDrag && canMove('table-column', -1, (_tableMap$width = tableMap === null || tableMap === void 0 ? void 0 : tableMap.width) !== null && _tableMap$width !== void 0 ? _tableMap$width : 0, selection, selectionRect),
104
+ canMove: canMove('table-column', -1, (_tableMap$width = tableMap === null || tableMap === void 0 ? void 0 : tableMap.width) !== null && _tableMap$width !== void 0 ? _tableMap$width : 0, selection, selectionRect),
113
105
  getOriginIndexes: getSelectedColumnIndexes,
114
106
  getTargetIndex: selectionRect => selectionRect.left - 1
115
107
  }, {
116
108
  label: 'right',
117
109
  icon: ArrowRightIcon,
118
110
  keymap: moveColumnRight,
119
- canMove: canDrag && canMove('table-column', 1, (_tableMap$width2 = tableMap === null || tableMap === void 0 ? void 0 : tableMap.width) !== null && _tableMap$width2 !== void 0 ? _tableMap$width2 : 0, selection, selectionRect),
111
+ canMove: canMove('table-column', 1, (_tableMap$width2 = tableMap === null || tableMap === void 0 ? void 0 : tableMap.width) !== null && _tableMap$width2 !== void 0 ? _tableMap$width2 : 0, selection, selectionRect),
120
112
  getOriginIndexes: getSelectedColumnIndexes,
121
113
  getTargetIndex: selectionRect => selectionRect.right
122
114
  }];
@@ -20,7 +20,6 @@ import { shortcutStyle } from '@atlaskit/editor-shared-styles/shortcut';
20
20
  import { TableMap } from '@atlaskit/editor-tables/table-map';
21
21
  import { findCellRectClosestToPos, getSelectionRect, isSelectionType } from '@atlaskit/editor-tables/utils';
22
22
  import EditorBackgroundColorIcon from '@atlaskit/icon/glyph/editor/background-color';
23
- import { fg } from '@atlaskit/platform-feature-flags';
24
23
  import Toggle from '@atlaskit/toggle';
25
24
  import { clearHoverSelection, hoverColumns, hoverRows } from '../../commands';
26
25
  import { setColorWithAnalytics, toggleHeaderColumnWithAnalytics, toggleHeaderRowWithAnalytics, toggleNumberColumnWithAnalytics } from '../../commands-with-analytics';
@@ -28,7 +27,7 @@ import { toggleDragMenu } from '../../pm-plugins/drag-and-drop/commands';
28
27
  import { getPluginState } from '../../pm-plugins/drag-and-drop/plugin-factory';
29
28
  import { getPluginState as getTablePluginState } from '../../pm-plugins/plugin-factory';
30
29
  import { TableCssClassName as ClassName } from '../../types';
31
- import { checkIfHeaderColumnEnabled, checkIfHeaderRowEnabled, checkIfNumberColumnEnabled, getMergedCellsPositions, getSelectedColumnIndexes, getSelectedRowIndexes, hasMergedCellsInColumn, hasMergedCellsInRow } from '../../utils';
30
+ import { checkIfHeaderColumnEnabled, checkIfHeaderRowEnabled, checkIfNumberColumnEnabled, getSelectedColumnIndexes, getSelectedRowIndexes } from '../../utils';
32
31
  import { getDragMenuConfig } from '../../utils/drag-menu';
33
32
  import { colorPalletteColumns } from '../consts';
34
33
  import { DropdownMenu } from './DropdownMenu';
@@ -175,7 +174,7 @@ var convertToDropdownItems = function convertToDropdownItems(dragMenuConfig, for
175
174
  };
176
175
  var ColorPaletteWithListeners = withOuterListeners(ColorPalette);
177
176
  export var DragMenu = /*#__PURE__*/React.memo(function (_ref) {
178
- var _pluginConfig$allowBa;
177
+ var _tableMap$hasMergedCe, _pluginConfig$allowBa;
179
178
  var _ref$direction = _ref.direction,
180
179
  direction = _ref$direction === void 0 ? 'row' : _ref$direction,
181
180
  index = _ref.index,
@@ -209,19 +208,9 @@ export var DragMenu = /*#__PURE__*/React.memo(function (_ref) {
209
208
  var _getPluginState = getPluginState(state),
210
209
  isKeyboardModeActive = _getPluginState.isKeyboardModeActive;
211
210
  var selectionRect = isSelectionType(selection, 'cell') ? getSelectionRect(selection) : findCellRectClosestToPos(selection.$from);
212
- var shouldMoveDisabled;
213
- var hasMergedCellsInTable;
214
- if (fg('platform.editor.table.drag-move-options-logic-update_fp7xw')) {
215
- var _tableMap$hasMergedCe;
216
- shouldMoveDisabled = false;
217
- hasMergedCellsInTable = (_tableMap$hasMergedCe = tableMap === null || tableMap === void 0 ? void 0 : tableMap.hasMergedCells()) !== null && _tableMap$hasMergedCe !== void 0 ? _tableMap$hasMergedCe : false;
218
- } else {
219
- var hasMergedCells = direction === 'row' ? hasMergedCellsInRow : hasMergedCellsInColumn;
220
- shouldMoveDisabled = index !== undefined && hasMergedCells(index)(selection);
221
- hasMergedCellsInTable = getMergedCellsPositions(state.tr).length > 0;
222
- }
211
+ var hasMergedCellsInTable = (_tableMap$hasMergedCe = tableMap === null || tableMap === void 0 ? void 0 : tableMap.hasMergedCells()) !== null && _tableMap$hasMergedCe !== void 0 ? _tableMap$hasMergedCe : false;
223
212
  var allowBackgroundColor = (_pluginConfig$allowBa = pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.allowBackgroundColor) !== null && _pluginConfig$allowBa !== void 0 ? _pluginConfig$allowBa : false;
224
- var dragMenuConfig = getDragMenuConfig(direction, getEditorContainerWidth, !shouldMoveDisabled, hasMergedCellsInTable, editorView, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI, pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.isHeaderRowRequired, isTableScalingEnabled, tableDuplicateCellColouring, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, tableSortColumnReorder);
213
+ var dragMenuConfig = getDragMenuConfig(direction, getEditorContainerWidth, hasMergedCellsInTable, editorView, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI, pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.isHeaderRowRequired, isTableScalingEnabled, tableDuplicateCellColouring, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, tableSortColumnReorder);
225
214
  var _convertToDropdownIte = convertToDropdownItems(dragMenuConfig, formatMessage, tableSortColumnReorder, selectionRect),
226
215
  menuItems = _convertToDropdownIte.menuItems,
227
216
  menuCallback = _convertToDropdownIte.menuCallback;
@@ -11,13 +11,12 @@ import EditorLayoutThreeEqualIcon from '@atlaskit/icon/glyph/editor/layout-three
11
11
  import RemoveIcon from '@atlaskit/icon/glyph/editor/remove';
12
12
  import HipchatChevronDoubleDownIcon from '@atlaskit/icon/glyph/hipchat/chevron-double-down';
13
13
  import HipchatChevronDoubleUpIcon from '@atlaskit/icon/glyph/hipchat/chevron-double-up';
14
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
15
14
  import { deleteColumnsWithAnalytics, deleteRowsWithAnalytics, distributeColumnsWidthsWithAnalytics, emptyMultipleCellsWithAnalytics, insertColumnWithAnalytics, insertRowWithAnalytics, sortColumnWithAnalytics } from '../commands-with-analytics';
16
15
  import { moveSourceWithAnalytics } from '../pm-plugins/drag-and-drop/commands-with-analytics';
17
16
  import { getNewResizeStateFromSelectedColumns } from '../pm-plugins/table-resizing/utils/resize-state';
18
17
  import { getClosestSelectionRect } from '../toolbar';
19
18
  import { AddColLeftIcon, AddColRightIcon, AddRowAboveIcon, AddRowBelowIcon } from '../ui/icons';
20
- import { hasMergedCellsInColumn, hasMergedCellsInRow, hasMergedCellsInSelection, hasMergedCellsWithColumnNextToColumnIndex, hasMergedCellsWithRowNextToRowIndex } from './merged-cells';
19
+ import { hasMergedCellsInSelection, hasMergedCellsWithColumnNextToColumnIndex, hasMergedCellsWithRowNextToRowIndex } from './merged-cells';
21
20
  import { getSelectedColumnIndexes, getSelectedRowIndexes } from './selection';
22
21
  export var getTargetIndex = function getTargetIndex(selectedIndexes, direction) {
23
22
  return Math[direction < 0 ? 'min' : 'max'].apply(Math, _toConsumableArray(selectedIndexes)) + direction;
@@ -40,17 +39,10 @@ export var canMove = function canMove(sourceType, direction, totalItemsOfSourceT
40
39
  if (hasMergedCellsInTarget) {
41
40
  return false;
42
41
  }
43
- if (getBooleanFF('platform.editor.table.drag-move-options-logic-update_fp7xw')) {
44
- // We can't move if selection in the source is not a rectangle
45
- if (hasMergedCellsInSelection(selectedIndexes, isRow ? 'row' : 'column')(selection)) {
46
- return false;
47
- }
48
- } else {
49
- // Currently we can't move in any direction if there are merged cells in the source
50
- var hasMergedCellsInSource = isRow ? hasMergedCellsInRow(selectedIndexes)(selection) : hasMergedCellsInColumn(selectedIndexes)(selection);
51
- if (hasMergedCellsInSource) {
52
- return false;
53
- }
42
+
43
+ // We can't move if selection in the source is not a rectangle
44
+ if (hasMergedCellsInSelection(selectedIndexes, isRow ? 'row' : 'column')(selection)) {
45
+ return false;
54
46
  }
55
47
  return true;
56
48
  };
@@ -68,13 +60,13 @@ var defaultSelectionRect = {
68
60
  right: 0,
69
61
  bottom: 0
70
62
  };
71
- export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorContainerWidth, canDrag, hasMergedCellsInTable, editorView, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI, isHeaderRowRequired) {
63
+ export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorContainerWidth, hasMergedCellsInTable, editorView, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI, isHeaderRowRequired) {
72
64
  var _tableMap$height, _tableMap$height2, _tableMap$width, _tableMap$width2;
73
- var isTableScalingEnabled = arguments.length > 11 && arguments[11] !== undefined ? arguments[11] : false;
74
- var tableDuplicateCellColouring = arguments.length > 12 && arguments[12] !== undefined ? arguments[12] : false;
75
- var isTableFixedColumnWidthsOptionEnabled = arguments.length > 13 && arguments[13] !== undefined ? arguments[13] : false;
76
- var shouldUseIncreasedScalingPercent = arguments.length > 14 && arguments[14] !== undefined ? arguments[14] : false;
77
- var tableSortColumnReorder = arguments.length > 15 && arguments[15] !== undefined ? arguments[15] : false;
65
+ var isTableScalingEnabled = arguments.length > 10 && arguments[10] !== undefined ? arguments[10] : false;
66
+ var tableDuplicateCellColouring = arguments.length > 11 && arguments[11] !== undefined ? arguments[11] : false;
67
+ var isTableFixedColumnWidthsOptionEnabled = arguments.length > 12 && arguments[12] !== undefined ? arguments[12] : false;
68
+ var shouldUseIncreasedScalingPercent = arguments.length > 13 && arguments[13] !== undefined ? arguments[13] : false;
69
+ var tableSortColumnReorder = arguments.length > 14 && arguments[14] !== undefined ? arguments[14] : false;
78
70
  var selection = editorView.state.selection;
79
71
  var addOptions = direction === 'row' ? [{
80
72
  label: 'above',
@@ -101,7 +93,7 @@ export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorCo
101
93
  label: 'up',
102
94
  icon: ArrowUpIcon,
103
95
  keymap: moveRowUp,
104
- canMove: canDrag && canMove('table-row', -1, (_tableMap$height = tableMap === null || tableMap === void 0 ? void 0 : tableMap.height) !== null && _tableMap$height !== void 0 ? _tableMap$height : 0, selection, selectionRect),
96
+ canMove: canMove('table-row', -1, (_tableMap$height = tableMap === null || tableMap === void 0 ? void 0 : tableMap.height) !== null && _tableMap$height !== void 0 ? _tableMap$height : 0, selection, selectionRect),
105
97
  getOriginIndexes: getSelectedRowIndexes,
106
98
  getTargetIndex: function getTargetIndex(selectionRect) {
107
99
  return selectionRect.top - 1;
@@ -110,7 +102,7 @@ export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorCo
110
102
  label: 'down',
111
103
  icon: ArrowDownIcon,
112
104
  keymap: moveRowDown,
113
- canMove: canDrag && canMove('table-row', 1, (_tableMap$height2 = tableMap === null || tableMap === void 0 ? void 0 : tableMap.height) !== null && _tableMap$height2 !== void 0 ? _tableMap$height2 : 0, selection, selectionRect),
105
+ canMove: canMove('table-row', 1, (_tableMap$height2 = tableMap === null || tableMap === void 0 ? void 0 : tableMap.height) !== null && _tableMap$height2 !== void 0 ? _tableMap$height2 : 0, selection, selectionRect),
114
106
  getOriginIndexes: getSelectedRowIndexes,
115
107
  getTargetIndex: function getTargetIndex(selectionRect) {
116
108
  return selectionRect.bottom;
@@ -119,7 +111,7 @@ export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorCo
119
111
  label: 'left',
120
112
  icon: ArrowLeftIcon,
121
113
  keymap: moveColumnLeft,
122
- canMove: canDrag && canMove('table-column', -1, (_tableMap$width = tableMap === null || tableMap === void 0 ? void 0 : tableMap.width) !== null && _tableMap$width !== void 0 ? _tableMap$width : 0, selection, selectionRect),
114
+ canMove: canMove('table-column', -1, (_tableMap$width = tableMap === null || tableMap === void 0 ? void 0 : tableMap.width) !== null && _tableMap$width !== void 0 ? _tableMap$width : 0, selection, selectionRect),
123
115
  getOriginIndexes: getSelectedColumnIndexes,
124
116
  getTargetIndex: function getTargetIndex(selectionRect) {
125
117
  return selectionRect.left - 1;
@@ -128,7 +120,7 @@ export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorCo
128
120
  label: 'right',
129
121
  icon: ArrowRightIcon,
130
122
  keymap: moveColumnRight,
131
- canMove: canDrag && canMove('table-column', 1, (_tableMap$width2 = tableMap === null || tableMap === void 0 ? void 0 : tableMap.width) !== null && _tableMap$width2 !== void 0 ? _tableMap$width2 : 0, selection, selectionRect),
123
+ canMove: canMove('table-column', 1, (_tableMap$width2 = tableMap === null || tableMap === void 0 ? void 0 : tableMap.width) !== null && _tableMap$width2 !== void 0 ? _tableMap$width2 : 0, selection, selectionRect),
132
124
  getOriginIndexes: getSelectedColumnIndexes,
133
125
  getTargetIndex: function getTargetIndex(selectionRect) {
134
126
  return selectionRect.right;
@@ -13,4 +13,4 @@ export interface DragMenuConfig extends Omit<DropdownOptionT<Command>, 'icon'> {
13
13
  icon?: React.ComponentType<React.PropsWithChildren<IconProps>>;
14
14
  keymap?: string;
15
15
  }
16
- export declare const getDragMenuConfig: (direction: TableDirection, getEditorContainerWidth: GetEditorContainerWidth, canDrag: boolean, hasMergedCellsInTable: boolean, editorView: EditorView, tableMap?: TableMap, index?: number, targetCellPosition?: number, selectionRect?: Rect, editorAnalyticsAPI?: EditorAnalyticsAPI, isHeaderRowRequired?: boolean, isTableScalingEnabled?: boolean, tableDuplicateCellColouring?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean, tableSortColumnReorder?: boolean) => DragMenuConfig[];
16
+ export declare const getDragMenuConfig: (direction: TableDirection, getEditorContainerWidth: GetEditorContainerWidth, hasMergedCellsInTable: boolean, editorView: EditorView, tableMap?: TableMap, index?: number, targetCellPosition?: number, selectionRect?: Rect, editorAnalyticsAPI?: EditorAnalyticsAPI, isHeaderRowRequired?: boolean, isTableScalingEnabled?: boolean, tableDuplicateCellColouring?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean, tableSortColumnReorder?: boolean) => DragMenuConfig[];
@@ -13,4 +13,4 @@ export interface DragMenuConfig extends Omit<DropdownOptionT<Command>, 'icon'> {
13
13
  icon?: React.ComponentType<React.PropsWithChildren<IconProps>>;
14
14
  keymap?: string;
15
15
  }
16
- export declare const getDragMenuConfig: (direction: TableDirection, getEditorContainerWidth: GetEditorContainerWidth, canDrag: boolean, hasMergedCellsInTable: boolean, editorView: EditorView, tableMap?: TableMap, index?: number, targetCellPosition?: number, selectionRect?: Rect, editorAnalyticsAPI?: EditorAnalyticsAPI, isHeaderRowRequired?: boolean, isTableScalingEnabled?: boolean, tableDuplicateCellColouring?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean, tableSortColumnReorder?: boolean) => DragMenuConfig[];
16
+ export declare const getDragMenuConfig: (direction: TableDirection, getEditorContainerWidth: GetEditorContainerWidth, hasMergedCellsInTable: boolean, editorView: EditorView, tableMap?: TableMap, index?: number, targetCellPosition?: number, selectionRect?: Rect, editorAnalyticsAPI?: EditorAnalyticsAPI, isHeaderRowRequired?: boolean, isTableScalingEnabled?: boolean, tableDuplicateCellColouring?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean, tableSortColumnReorder?: boolean) => DragMenuConfig[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "7.19.7",
3
+ "version": "7.19.8",
4
4
  "description": "Table plugin for the @atlaskit/editor",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -29,9 +29,9 @@
29
29
  },
30
30
  "dependencies": {
31
31
  "@atlaskit/adf-schema": "^39.0.3",
32
- "@atlaskit/button": "^18.1.0",
32
+ "@atlaskit/button": "^18.2.0",
33
33
  "@atlaskit/custom-steps": "^0.4.0",
34
- "@atlaskit/editor-common": "^84.0.0",
34
+ "@atlaskit/editor-common": "^84.1.0",
35
35
  "@atlaskit/editor-palette": "1.6.0",
36
36
  "@atlaskit/editor-plugin-accessibility-utils": "^1.1.0",
37
37
  "@atlaskit/editor-plugin-analytics": "^1.4.0",
@@ -43,13 +43,13 @@
43
43
  "@atlaskit/editor-prosemirror": "4.0.1",
44
44
  "@atlaskit/editor-shared-styles": "^2.12.0",
45
45
  "@atlaskit/editor-tables": "^2.7.0",
46
- "@atlaskit/icon": "^22.5.0",
47
- "@atlaskit/menu": "^2.6.0",
46
+ "@atlaskit/icon": "^22.6.0",
47
+ "@atlaskit/menu": "^2.7.0",
48
48
  "@atlaskit/platform-feature-flags": "^0.3.0",
49
49
  "@atlaskit/pragmatic-drag-and-drop": "^1.2.0",
50
50
  "@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^1.4.0",
51
51
  "@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.0.0",
52
- "@atlaskit/primitives": "^10.0.0",
52
+ "@atlaskit/primitives": "^10.1.0",
53
53
  "@atlaskit/theme": "^12.11.0",
54
54
  "@atlaskit/toggle": "^13.2.0",
55
55
  "@atlaskit/tokens": "^1.53.0",
@@ -102,9 +102,6 @@
102
102
  }
103
103
  },
104
104
  "platform-feature-flags": {
105
- "platform.editor.table.drag-move-options-logic-update_fp7xw": {
106
- "type": "boolean"
107
- },
108
105
  "platform.editor.a11y-table-resizing_uapcv": {
109
106
  "type": "boolean"
110
107
  },
@@ -39,7 +39,6 @@ import {
39
39
  isSelectionType,
40
40
  } from '@atlaskit/editor-tables/utils';
41
41
  import EditorBackgroundColorIcon from '@atlaskit/icon/glyph/editor/background-color';
42
- import { fg } from '@atlaskit/platform-feature-flags';
43
42
  import Toggle from '@atlaskit/toggle';
44
43
 
45
44
  import { clearHoverSelection, hoverColumns, hoverRows } from '../../commands';
@@ -58,11 +57,8 @@ import {
58
57
  checkIfHeaderColumnEnabled,
59
58
  checkIfHeaderRowEnabled,
60
59
  checkIfNumberColumnEnabled,
61
- getMergedCellsPositions,
62
60
  getSelectedColumnIndexes,
63
61
  getSelectedRowIndexes,
64
- hasMergedCellsInColumn,
65
- hasMergedCellsInRow,
66
62
  } from '../../utils';
67
63
  import type { DragMenuConfig, DragMenuOptionIdType } from '../../utils/drag-menu';
68
64
  import { getDragMenuConfig } from '../../utils/drag-menu';
@@ -290,25 +286,12 @@ export const DragMenu = React.memo(
290
286
  ? getSelectionRect(selection)!
291
287
  : findCellRectClosestToPos(selection.$from);
292
288
 
293
- let shouldMoveDisabled;
294
- let hasMergedCellsInTable;
295
- if (fg('platform.editor.table.drag-move-options-logic-update_fp7xw')) {
296
- shouldMoveDisabled = false;
297
- hasMergedCellsInTable = tableMap?.hasMergedCells() ?? false;
298
- } else {
299
- const hasMergedCells = direction === 'row' ? hasMergedCellsInRow : hasMergedCellsInColumn;
300
-
301
- shouldMoveDisabled = index !== undefined && hasMergedCells(index)(selection);
302
-
303
- hasMergedCellsInTable = getMergedCellsPositions(state.tr).length > 0;
304
- }
305
-
289
+ const hasMergedCellsInTable = tableMap?.hasMergedCells() ?? false;
306
290
  const allowBackgroundColor = pluginConfig?.allowBackgroundColor ?? false;
307
291
 
308
292
  const dragMenuConfig = getDragMenuConfig(
309
293
  direction,
310
294
  getEditorContainerWidth,
311
- !shouldMoveDisabled,
312
295
  hasMergedCellsInTable,
313
296
  editorView,
314
297
  tableMap,
@@ -34,7 +34,6 @@ import EditorLayoutThreeEqualIcon from '@atlaskit/icon/glyph/editor/layout-three
34
34
  import RemoveIcon from '@atlaskit/icon/glyph/editor/remove';
35
35
  import HipchatChevronDoubleDownIcon from '@atlaskit/icon/glyph/hipchat/chevron-double-down';
36
36
  import HipchatChevronDoubleUpIcon from '@atlaskit/icon/glyph/hipchat/chevron-double-up';
37
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
38
37
 
39
38
  import {
40
39
  deleteColumnsWithAnalytics,
@@ -52,8 +51,6 @@ import type { DraggableData, DraggableType, TableDirection } from '../types';
52
51
  import { AddColLeftIcon, AddColRightIcon, AddRowAboveIcon, AddRowBelowIcon } from '../ui/icons';
53
52
 
54
53
  import {
55
- hasMergedCellsInColumn,
56
- hasMergedCellsInRow,
57
54
  hasMergedCellsInSelection,
58
55
  hasMergedCellsWithColumnNextToColumnIndex,
59
56
  hasMergedCellsWithRowNextToRowIndex,
@@ -94,20 +91,9 @@ export const canMove = (
94
91
  return false;
95
92
  }
96
93
 
97
- if (getBooleanFF('platform.editor.table.drag-move-options-logic-update_fp7xw')) {
98
- // We can't move if selection in the source is not a rectangle
99
- if (hasMergedCellsInSelection(selectedIndexes, isRow ? 'row' : 'column')(selection)) {
100
- return false;
101
- }
102
- } else {
103
- // Currently we can't move in any direction if there are merged cells in the source
104
- const hasMergedCellsInSource = isRow
105
- ? hasMergedCellsInRow(selectedIndexes)(selection)
106
- : hasMergedCellsInColumn(selectedIndexes)(selection);
107
-
108
- if (hasMergedCellsInSource) {
109
- return false;
110
- }
94
+ // We can't move if selection in the source is not a rectangle
95
+ if (hasMergedCellsInSelection(selectedIndexes, isRow ? 'row' : 'column')(selection)) {
96
+ return false;
111
97
  }
112
98
 
113
99
  return true;
@@ -149,7 +135,6 @@ const defaultSelectionRect = { left: 0, top: 0, right: 0, bottom: 0 };
149
135
  export const getDragMenuConfig = (
150
136
  direction: TableDirection,
151
137
  getEditorContainerWidth: GetEditorContainerWidth,
152
- canDrag: boolean,
153
138
  hasMergedCellsInTable: boolean,
154
139
  editorView: EditorView,
155
140
  tableMap?: TableMap,
@@ -202,8 +187,7 @@ export const getDragMenuConfig = (
202
187
  label: 'up',
203
188
  icon: ArrowUpIcon,
204
189
  keymap: moveRowUp,
205
- canMove:
206
- canDrag && canMove('table-row', -1, tableMap?.height ?? 0, selection, selectionRect),
190
+ canMove: canMove('table-row', -1, tableMap?.height ?? 0, selection, selectionRect),
207
191
  getOriginIndexes: getSelectedRowIndexes,
208
192
  getTargetIndex: (selectionRect: Rect) => selectionRect.top - 1,
209
193
  },
@@ -211,8 +195,7 @@ export const getDragMenuConfig = (
211
195
  label: 'down',
212
196
  icon: ArrowDownIcon,
213
197
  keymap: moveRowDown,
214
- canMove:
215
- canDrag && canMove('table-row', 1, tableMap?.height ?? 0, selection, selectionRect),
198
+ canMove: canMove('table-row', 1, tableMap?.height ?? 0, selection, selectionRect),
216
199
  getOriginIndexes: getSelectedRowIndexes,
217
200
  getTargetIndex: (selectionRect: Rect) => selectionRect.bottom,
218
201
  },
@@ -222,9 +205,7 @@ export const getDragMenuConfig = (
222
205
  label: 'left',
223
206
  icon: ArrowLeftIcon,
224
207
  keymap: moveColumnLeft,
225
- canMove:
226
- canDrag &&
227
- canMove('table-column', -1, tableMap?.width ?? 0, selection, selectionRect),
208
+ canMove: canMove('table-column', -1, tableMap?.width ?? 0, selection, selectionRect),
228
209
  getOriginIndexes: getSelectedColumnIndexes,
229
210
  getTargetIndex: (selectionRect: Rect) => selectionRect.left - 1,
230
211
  },
@@ -232,8 +213,7 @@ export const getDragMenuConfig = (
232
213
  label: 'right',
233
214
  icon: ArrowRightIcon,
234
215
  keymap: moveColumnRight,
235
- canMove:
236
- canDrag && canMove('table-column', 1, tableMap?.width ?? 0, selection, selectionRect),
216
+ canMove: canMove('table-column', 1, tableMap?.width ?? 0, selection, selectionRect),
237
217
  getOriginIndexes: getSelectedColumnIndexes,
238
218
  getTargetIndex: (selectionRect: Rect) => selectionRect.right,
239
219
  },