@atlaskit/editor-plugin-table 7.31.1 → 7.31.2

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 (28) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/cjs/ui/FloatingContextualMenu/ContextualMenu.js +12 -17
  3. package/dist/cjs/ui/FloatingDragMenu/DragMenu.js +8 -11
  4. package/dist/cjs/ui/FloatingDragMenu/index.js +1 -4
  5. package/dist/cjs/ui/FloatingDragMenu/styles.js +1 -2
  6. package/dist/cjs/utils/drag-menu.js +3 -4
  7. package/dist/es2019/ui/FloatingContextualMenu/ContextualMenu.js +1 -8
  8. package/dist/es2019/ui/FloatingDragMenu/DragMenu.js +8 -9
  9. package/dist/es2019/ui/FloatingDragMenu/index.js +1 -3
  10. package/dist/es2019/ui/FloatingDragMenu/styles.js +2 -2
  11. package/dist/es2019/utils/drag-menu.js +2 -2
  12. package/dist/esm/ui/FloatingContextualMenu/ContextualMenu.js +12 -17
  13. package/dist/esm/ui/FloatingDragMenu/DragMenu.js +8 -11
  14. package/dist/esm/ui/FloatingDragMenu/index.js +1 -4
  15. package/dist/esm/ui/FloatingDragMenu/styles.js +1 -2
  16. package/dist/esm/utils/drag-menu.js +3 -4
  17. package/dist/types/ui/FloatingDragMenu/DragMenu.d.ts +0 -1
  18. package/dist/types/ui/FloatingDragMenu/styles.d.ts +1 -1
  19. package/dist/types/utils/drag-menu.d.ts +1 -1
  20. package/dist/types-ts4.5/ui/FloatingDragMenu/DragMenu.d.ts +0 -1
  21. package/dist/types-ts4.5/ui/FloatingDragMenu/styles.d.ts +1 -1
  22. package/dist/types-ts4.5/utils/drag-menu.d.ts +1 -1
  23. package/package.json +1 -1
  24. package/src/ui/FloatingContextualMenu/ContextualMenu.tsx +1 -5
  25. package/src/ui/FloatingDragMenu/DragMenu.tsx +5 -14
  26. package/src/ui/FloatingDragMenu/index.tsx +2 -6
  27. package/src/ui/FloatingDragMenu/styles.ts +4 -6
  28. package/src/utils/drag-menu.ts +1 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @atlaskit/editor-plugin-table
2
2
 
3
+ ## 7.31.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#164992](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/164992)
8
+ [`16878c96150af`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/16878c96150af) -
9
+ tidy table sort order experiment
10
+
3
11
  ## 7.31.1
4
12
 
5
13
  ### Patch Changes
@@ -423,14 +423,10 @@ var ContextualMenu = exports.ContextualMenu = /*#__PURE__*/function (_Component)
423
423
  });
424
424
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "createOriginalContextMenuItems", function () {
425
425
  var items = [];
426
- var getEditorFeatureFlags = _this.props.getEditorFeatureFlags;
427
- var _ref2 = getEditorFeatureFlags ? getEditorFeatureFlags() : {},
428
- _ref2$tableSortColumn = _ref2.tableSortColumnReorder,
429
- tableSortColumnReorder = _ref2$tableSortColumn === void 0 ? false : _ref2$tableSortColumn;
430
426
  var sortColumnItems = _this.createSortColumnItems();
431
427
  var backgroundColorItem = _this.createBackgroundColorItem();
432
428
  var distributeColumnsItem = _this.createDistributeColumnsItem();
433
- tableSortColumnReorder && sortColumnItems && items.push.apply(items, (0, _toConsumableArray2.default)(sortColumnItems));
429
+ sortColumnItems && items.push.apply(items, (0, _toConsumableArray2.default)(sortColumnItems));
434
430
  backgroundColorItem && items.push(backgroundColorItem);
435
431
  items.push(_this.createInsertColumnItem());
436
432
  items.push(_this.createInsertRowItem());
@@ -438,7 +434,6 @@ var ContextualMenu = exports.ContextualMenu = /*#__PURE__*/function (_Component)
438
434
  items.push(_this.createDeleteRowItem());
439
435
  items.push.apply(items, (0, _toConsumableArray2.default)(_this.createMergeSplitCellItems()));
440
436
  distributeColumnsItem && items.push(distributeColumnsItem);
441
- !tableSortColumnReorder && sortColumnItems && items.push.apply(items, (0, _toConsumableArray2.default)(sortColumnItems));
442
437
  items.push(_this.createClearCellsItem());
443
438
  return [{
444
439
  items: items
@@ -469,8 +464,8 @@ var ContextualMenu = exports.ContextualMenu = /*#__PURE__*/function (_Component)
469
464
  items[1].items.push(deleteRowItem);
470
465
  return items;
471
466
  });
472
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onMenuItemActivated", function (_ref3) {
473
- var item = _ref3.item;
467
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onMenuItemActivated", function (_ref2) {
468
+ var item = _ref2.item;
474
469
  var _this$props10 = _this.props,
475
470
  editorView = _this$props10.editorView,
476
471
  selectionRect = _this$props10.selectionRect,
@@ -486,11 +481,11 @@ var ContextualMenu = exports.ContextualMenu = /*#__PURE__*/function (_Component)
486
481
  targetCellPosition = _getPluginState11.targetCellPosition,
487
482
  _getPluginState11$isT = _getPluginState11.isTableScalingEnabled,
488
483
  isTableScalingEnabled = _getPluginState11$isT === void 0 ? false : _getPluginState11$isT;
489
- var _ref4 = getEditorFeatureFlags ? getEditorFeatureFlags() : {},
490
- _ref4$tableDuplicateC = _ref4.tableDuplicateCellColouring,
491
- tableDuplicateCellColouring = _ref4$tableDuplicateC === void 0 ? false : _ref4$tableDuplicateC,
492
- _ref4$tableWithFixedC = _ref4.tableWithFixedColumnWidthsOption,
493
- tableWithFixedColumnWidthsOption = _ref4$tableWithFixedC === void 0 ? false : _ref4$tableWithFixedC;
484
+ var _ref3 = getEditorFeatureFlags ? getEditorFeatureFlags() : {},
485
+ _ref3$tableDuplicateC = _ref3.tableDuplicateCellColouring,
486
+ tableDuplicateCellColouring = _ref3$tableDuplicateC === void 0 ? false : _ref3$tableDuplicateC,
487
+ _ref3$tableWithFixedC = _ref3.tableWithFixedColumnWidthsOption,
488
+ tableWithFixedColumnWidthsOption = _ref3$tableWithFixedC === void 0 ? false : _ref3$tableWithFixedC;
494
489
  // context menu opened by keyboard and any item except 'background' activated
495
490
  // or color has been chosen from color palette
496
491
  if (isCellMenuOpenByKeyboard && (item.value.name !== 'background' || item.value.name === 'background' && _this.state.isSubmenuOpen)) {
@@ -619,8 +614,8 @@ var ContextualMenu = exports.ContextualMenu = /*#__PURE__*/function (_Component)
619
614
  }
620
615
  }
621
616
  });
622
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleItemMouseEnter", function (_ref5) {
623
- var item = _ref5.item;
617
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleItemMouseEnter", function (_ref4) {
618
+ var item = _ref4.item;
624
619
  var _this$props13 = _this.props,
625
620
  _this$props13$editorV = _this$props13.editorView,
626
621
  state = _this$props13$editorV.state,
@@ -643,8 +638,8 @@ var ContextualMenu = exports.ContextualMenu = /*#__PURE__*/function (_Component)
643
638
  (0, _commands.hoverMergedCells)()(state, dispatch);
644
639
  }
645
640
  });
646
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleItemMouseLeave", function (_ref6) {
647
- var item = _ref6.item;
641
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleItemMouseLeave", function (_ref5) {
642
+ var item = _ref5.item;
648
643
  var _this$props$editorVie = _this.props.editorView,
649
644
  state = _this$props$editorVie.state,
650
645
  dispatch = _this$props$editorVie.dispatch;
@@ -105,20 +105,18 @@ var MapDragMenuOptionIdToMessage = {
105
105
  plural: null
106
106
  }
107
107
  };
108
- var getGroupedDragMenuConfig = function getGroupedDragMenuConfig(tableSortColumnReorder) {
108
+ var getGroupedDragMenuConfig = function getGroupedDragMenuConfig() {
109
109
  var groupedDragMenuConfig = [['add_row_above', 'add_row_below', 'add_column_left', 'add_column_right', 'distribute_columns', 'clear_cells', 'delete_row', 'delete_column'], ['move_column_left', 'move_column_right', 'move_row_up', 'move_row_down']];
110
110
  var sortColumnItems = ['sort_column_asc', 'sort_column_desc'];
111
- tableSortColumnReorder ? groupedDragMenuConfig.unshift(sortColumnItems) : groupedDragMenuConfig.push(sortColumnItems);
111
+ groupedDragMenuConfig.unshift(sortColumnItems);
112
112
  return groupedDragMenuConfig;
113
113
  };
114
114
  var elementBeforeIconStyles = (0, _primitives.xcss)({
115
115
  marginRight: 'space.negative.075',
116
116
  display: 'flex'
117
117
  });
118
- var convertToDropdownItems = function convertToDropdownItems(dragMenuConfig, formatMessage) {
119
- var tableSortColumnReorder = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
120
- var selectionRect = arguments.length > 3 ? arguments[3] : undefined;
121
- var groupedDragMenuConfig = getGroupedDragMenuConfig(tableSortColumnReorder);
118
+ var convertToDropdownItems = function convertToDropdownItems(dragMenuConfig, formatMessage, selectionRect) {
119
+ var groupedDragMenuConfig = getGroupedDragMenuConfig();
122
120
  var menuItemsArr = (0, _toConsumableArray2.default)(Array(groupedDragMenuConfig.length)).map(function () {
123
121
  return [];
124
122
  });
@@ -216,7 +214,6 @@ var DragMenu = /*#__PURE__*/_react.default.memo(function (_ref) {
216
214
  tableDuplicateCellColouring = _ref.tableDuplicateCellColouring,
217
215
  shouldUseIncreasedScalingPercent = _ref.shouldUseIncreasedScalingPercent,
218
216
  isTableFixedColumnWidthsOptionEnabled = _ref.isTableFixedColumnWidthsOptionEnabled,
219
- tableSortColumnReorder = _ref.tableSortColumnReorder,
220
217
  ariaNotifyPlugin = _ref.ariaNotifyPlugin,
221
218
  isCommentEditor = _ref.isCommentEditor;
222
219
  var state = editorView.state,
@@ -232,8 +229,8 @@ var DragMenu = /*#__PURE__*/_react.default.memo(function (_ref) {
232
229
  var selectionRect = (0, _utils2.isSelectionType)(selection, 'cell') ? (0, _utils2.getSelectionRect)(selection) : (0, _utils2.findCellRectClosestToPos)(selection.$from);
233
230
  var hasMergedCellsInTable = (_tableMap$hasMergedCe = tableMap === null || tableMap === void 0 ? void 0 : tableMap.hasMergedCells()) !== null && _tableMap$hasMergedCe !== void 0 ? _tableMap$hasMergedCe : false;
234
231
  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, hasMergedCellsInTable, editorView, api, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI, pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.isHeaderRowRequired, isTableScalingEnabled, tableDuplicateCellColouring, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, tableSortColumnReorder, ariaNotifyPlugin, isCommentEditor);
236
- var _convertToDropdownIte = convertToDropdownItems(dragMenuConfig, formatMessage, tableSortColumnReorder, selectionRect),
232
+ var dragMenuConfig = (0, _dragMenu.getDragMenuConfig)(direction, getEditorContainerWidth, hasMergedCellsInTable, editorView, api, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI, pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.isHeaderRowRequired, isTableScalingEnabled, tableDuplicateCellColouring, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, ariaNotifyPlugin, isCommentEditor);
233
+ var _convertToDropdownIte = convertToDropdownItems(dragMenuConfig, formatMessage, selectionRect),
237
234
  menuItems = _convertToDropdownIte.menuItems,
238
235
  menuCallback = _convertToDropdownIte.menuCallback;
239
236
  var handleSubMenuRef = function handleSubMenuRef(ref) {
@@ -282,7 +279,7 @@ var DragMenu = /*#__PURE__*/_react.default.memo(function (_ref) {
282
279
  className: _styles.DropdownMenuSharedCssClassName.SUBMENU
283
280
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
284
281
  ,
285
- css: (0, _styles2.dragMenuBackgroundColorStyles)(tableSortColumnReorder)
282
+ css: (0, _styles2.dragMenuBackgroundColorStyles)()
286
283
  }, (0, _react2.jsx)("div", {
287
284
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
288
285
  css: (0, _styles2.cellColourPreviewStyles)(background)
@@ -480,7 +477,7 @@ var DragMenu = /*#__PURE__*/_react.default.memo(function (_ref) {
480
477
  return null;
481
478
  }
482
479
  if (allowBackgroundColor) {
483
- tableSortColumnReorder ? menuItems[1].items.unshift(createBackgroundColorMenuItem()) : menuItems[0].items.unshift(createBackgroundColorMenuItem());
480
+ menuItems[1].items.unshift(createBackgroundColorMenuItem());
484
481
  }
485
482
 
486
483
  // If first row, add toggle for Header row, default is true
@@ -43,9 +43,7 @@ var FloatingDragMenu = function FloatingDragMenu(_ref) {
43
43
  _ref2$tableDuplicateC = _ref2.tableDuplicateCellColouring,
44
44
  tableDuplicateCellColouring = _ref2$tableDuplicateC === void 0 ? false : _ref2$tableDuplicateC,
45
45
  _ref2$tableWithFixedC = _ref2.tableWithFixedColumnWidthsOption,
46
- tableWithFixedColumnWidthsOption = _ref2$tableWithFixedC === void 0 ? false : _ref2$tableWithFixedC,
47
- _ref2$tableSortColumn = _ref2.tableSortColumnReorder,
48
- tableSortColumnReorder = _ref2$tableSortColumn === void 0 ? false : _ref2$tableSortColumn;
46
+ tableWithFixedColumnWidthsOption = _ref2$tableWithFixedC === void 0 ? false : _ref2$tableWithFixedC;
49
47
  var shouldUseIncreasedScalingPercent = isTableScalingEnabled && (tableWithFixedColumnWidthsOption || isCommentEditor);
50
48
  return /*#__PURE__*/_react.default.createElement(_ui.Popup, {
51
49
  alignX: direction === 'row' ? 'right' : undefined,
@@ -84,7 +82,6 @@ var FloatingDragMenu = function FloatingDragMenu(_ref) {
84
82
  tableDuplicateCellColouring: tableDuplicateCellColouring,
85
83
  shouldUseIncreasedScalingPercent: shouldUseIncreasedScalingPercent,
86
84
  isTableFixedColumnWidthsOptionEnabled: tableWithFixedColumnWidthsOption,
87
- tableSortColumnReorder: tableSortColumnReorder,
88
85
  ariaNotifyPlugin: ariaNotifyPlugin,
89
86
  api: api,
90
87
  isCommentEditor: isCommentEditor || false
@@ -23,8 +23,7 @@ var cellColourPreviewStyles = exports.cellColourPreviewStyles = function cellCol
23
23
 
24
24
  // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- needs manual remediation
25
25
  var dragMenuBackgroundColorStyles = exports.dragMenuBackgroundColorStyles = function dragMenuBackgroundColorStyles() {
26
- var tableSortColumnReorder = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
27
- return (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n\t.", " {\n\t\tborder-radius: ", ";\n\t\tbackground: ", ";\n\t\tbox-shadow: ", ";\n\t\tdisplay: block;\n\t\tposition: absolute;\n\t\ttop: ", "px; // move the submenu down when 'sort increasing/decreasing' appear before background color picker\n\t\tleft: ", "px;\n\t\tpadding: ", ";\n\n\t\t> div {\n\t\t\tpadding: 0;\n\t\t}\n\t}\n\n\t.", " {\n\t\tdisplay: flex;\n\n\t\t&::before {\n\t\t\tcontent: '';\n\t\t\tdisplay: block;\n\t\t\tborder: 1px solid ", ";\n\t\t\tborder-radius: ", ";\n\t\t\twidth: 14px;\n\t\t\theight: 14px;\n\t\t}\n\n\t\t&::after {\n\t\t\tcontent: '\u203A';\n\t\t\tmargin-left: ", ";\n\t\t\tline-height: 14px;\n\t\t\tcolor: ", ";\n\t\t}\n\t}\n"])), _types.TableCssClassName.DRAG_SUBMENU, "var(--ds-border-radius, 3px)", "var(--ds-surface-overlay, white)", "var(--ds-shadow-overlay, ".concat("0 4px 8px -2px ".concat(_colors.N60A, ", 0 0 1px ").concat(_colors.N60A), ")"), tableSortColumnReorder ? _consts.TABLE_DRAG_MENU_PADDING_TOP + _consts.TABLE_DRAG_MENU_SORT_GROUP_HEIGHT + _consts.TABLE_DRAG_MENU_MENU_GROUP_BEFORE_HEIGHT : 0, _consts.dragMenuDropdownWidth, "var(--ds-space-100, 8px)", _types.TableCssClassName.DRAG_SUBMENU_ICON, _adfSchema.tableBackgroundBorderColor, "var(--ds-border-radius, 3px)", "var(--ds-space-050, 4px)", "var(--ds-icon, ".concat(_colors.N90, ")"));
26
+ return (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n\t.", " {\n\t\tborder-radius: ", ";\n\t\tbackground: ", ";\n\t\tbox-shadow: ", ";\n\t\tdisplay: block;\n\t\tposition: absolute;\n\t\ttop: ", "px; // move the submenu down when 'sort increasing/decreasing' appear before background color picker\n\t\tleft: ", "px;\n\t\tpadding: ", ";\n\n\t\t> div {\n\t\t\tpadding: 0;\n\t\t}\n\t}\n\n\t.", " {\n\t\tdisplay: flex;\n\n\t\t&::before {\n\t\t\tcontent: '';\n\t\t\tdisplay: block;\n\t\t\tborder: 1px solid ", ";\n\t\t\tborder-radius: ", ";\n\t\t\twidth: 14px;\n\t\t\theight: 14px;\n\t\t}\n\n\t\t&::after {\n\t\t\tcontent: '\u203A';\n\t\t\tmargin-left: ", ";\n\t\t\tline-height: 14px;\n\t\t\tcolor: ", ";\n\t\t}\n\t}\n"])), _types.TableCssClassName.DRAG_SUBMENU, "var(--ds-border-radius, 3px)", "var(--ds-surface-overlay, white)", "var(--ds-shadow-overlay, ".concat("0 4px 8px -2px ".concat(_colors.N60A, ", 0 0 1px ").concat(_colors.N60A), ")"), _consts.TABLE_DRAG_MENU_PADDING_TOP + _consts.TABLE_DRAG_MENU_SORT_GROUP_HEIGHT + _consts.TABLE_DRAG_MENU_MENU_GROUP_BEFORE_HEIGHT, _consts.dragMenuDropdownWidth, "var(--ds-space-100, 8px)", _types.TableCssClassName.DRAG_SUBMENU_ICON, _adfSchema.tableBackgroundBorderColor, "var(--ds-border-radius, 3px)", "var(--ds-space-050, 4px)", "var(--ds-icon, ".concat(_colors.N90, ")"));
28
27
  };
29
28
 
30
29
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
@@ -88,9 +88,8 @@ var getDragMenuConfig = exports.getDragMenuConfig = function getDragMenuConfig(d
88
88
  var tableDuplicateCellColouring = arguments.length > 12 && arguments[12] !== undefined ? arguments[12] : false;
89
89
  var isTableFixedColumnWidthsOptionEnabled = arguments.length > 13 && arguments[13] !== undefined ? arguments[13] : false;
90
90
  var shouldUseIncreasedScalingPercent = arguments.length > 14 && arguments[14] !== undefined ? arguments[14] : false;
91
- var tableSortColumnReorder = arguments.length > 15 && arguments[15] !== undefined ? arguments[15] : false;
92
- var ariaNotifyPlugin = arguments.length > 16 ? arguments[16] : undefined;
93
- var isCommentEditor = arguments.length > 17 && arguments[17] !== undefined ? arguments[17] : false;
91
+ var ariaNotifyPlugin = arguments.length > 15 ? arguments[15] : undefined;
92
+ var isCommentEditor = arguments.length > 16 && arguments[16] !== undefined ? arguments[16] : false;
94
93
  var selection = editorView.state.selection;
95
94
  var _getTablePluginState = (0, _pluginFactory.getPluginState)(editorView.state),
96
95
  getIntl = _getTablePluginState.getIntl;
@@ -281,6 +280,6 @@ var getDragMenuConfig = exports.getDragMenuConfig = function getDragMenuConfig(d
281
280
  };
282
281
  })));
283
282
  var allConfigs = (0, _toConsumableArray2.default)(restConfigs);
284
- tableSortColumnReorder ? allConfigs.unshift.apply(allConfigs, (0, _toConsumableArray2.default)(sortConfigs)) : allConfigs.push.apply(allConfigs, (0, _toConsumableArray2.default)(sortConfigs));
283
+ allConfigs.unshift.apply(allConfigs, (0, _toConsumableArray2.default)(sortConfigs));
285
284
  return allConfigs.filter(Boolean);
286
285
  };
@@ -450,16 +450,10 @@ export class ContextualMenu extends Component {
450
450
  });
451
451
  _defineProperty(this, "createOriginalContextMenuItems", () => {
452
452
  let items = [];
453
- const {
454
- getEditorFeatureFlags
455
- } = this.props;
456
- const {
457
- tableSortColumnReorder = false
458
- } = getEditorFeatureFlags ? getEditorFeatureFlags() : {};
459
453
  const sortColumnItems = this.createSortColumnItems();
460
454
  const backgroundColorItem = this.createBackgroundColorItem();
461
455
  const distributeColumnsItem = this.createDistributeColumnsItem();
462
- tableSortColumnReorder && sortColumnItems && items.push(...sortColumnItems);
456
+ sortColumnItems && items.push(...sortColumnItems);
463
457
  backgroundColorItem && items.push(backgroundColorItem);
464
458
  items.push(this.createInsertColumnItem());
465
459
  items.push(this.createInsertRowItem());
@@ -467,7 +461,6 @@ export class ContextualMenu extends Component {
467
461
  items.push(this.createDeleteRowItem());
468
462
  items.push(...this.createMergeSplitCellItems());
469
463
  distributeColumnsItem && items.push(distributeColumnsItem);
470
- !tableSortColumnReorder && sortColumnItems && items.push(...sortColumnItems);
471
464
  items.push(this.createClearCellsItem());
472
465
  return [{
473
466
  items
@@ -92,18 +92,18 @@ const MapDragMenuOptionIdToMessage = {
92
92
  plural: null
93
93
  }
94
94
  };
95
- const getGroupedDragMenuConfig = tableSortColumnReorder => {
95
+ const getGroupedDragMenuConfig = () => {
96
96
  let groupedDragMenuConfig = [['add_row_above', 'add_row_below', 'add_column_left', 'add_column_right', 'distribute_columns', 'clear_cells', 'delete_row', 'delete_column'], ['move_column_left', 'move_column_right', 'move_row_up', 'move_row_down']];
97
97
  const sortColumnItems = ['sort_column_asc', 'sort_column_desc'];
98
- tableSortColumnReorder ? groupedDragMenuConfig.unshift(sortColumnItems) : groupedDragMenuConfig.push(sortColumnItems);
98
+ groupedDragMenuConfig.unshift(sortColumnItems);
99
99
  return groupedDragMenuConfig;
100
100
  };
101
101
  const elementBeforeIconStyles = xcss({
102
102
  marginRight: 'space.negative.075',
103
103
  display: 'flex'
104
104
  });
105
- const convertToDropdownItems = (dragMenuConfig, formatMessage, tableSortColumnReorder = false, selectionRect) => {
106
- const groupedDragMenuConfig = getGroupedDragMenuConfig(tableSortColumnReorder);
105
+ const convertToDropdownItems = (dragMenuConfig, formatMessage, selectionRect) => {
106
+ const groupedDragMenuConfig = getGroupedDragMenuConfig();
107
107
  let menuItemsArr = [...Array(groupedDragMenuConfig.length)].map(() => []);
108
108
  let menuCallback = {};
109
109
  dragMenuConfig.forEach(item => {
@@ -199,7 +199,6 @@ const DragMenu = /*#__PURE__*/React.memo(({
199
199
  tableDuplicateCellColouring,
200
200
  shouldUseIncreasedScalingPercent,
201
201
  isTableFixedColumnWidthsOptionEnabled,
202
- tableSortColumnReorder,
203
202
  ariaNotifyPlugin,
204
203
  isCommentEditor
205
204
  }) => {
@@ -219,11 +218,11 @@ const DragMenu = /*#__PURE__*/React.memo(({
219
218
  const selectionRect = isSelectionType(selection, 'cell') ? getSelectionRect(selection) : findCellRectClosestToPos(selection.$from);
220
219
  const hasMergedCellsInTable = (_tableMap$hasMergedCe = tableMap === null || tableMap === void 0 ? void 0 : tableMap.hasMergedCells()) !== null && _tableMap$hasMergedCe !== void 0 ? _tableMap$hasMergedCe : false;
221
220
  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, hasMergedCellsInTable, editorView, api, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI, pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.isHeaderRowRequired, isTableScalingEnabled, tableDuplicateCellColouring, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, tableSortColumnReorder, ariaNotifyPlugin, isCommentEditor);
221
+ const dragMenuConfig = getDragMenuConfig(direction, getEditorContainerWidth, hasMergedCellsInTable, editorView, api, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI, pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.isHeaderRowRequired, isTableScalingEnabled, tableDuplicateCellColouring, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, ariaNotifyPlugin, isCommentEditor);
223
222
  const {
224
223
  menuItems,
225
224
  menuCallback
226
- } = convertToDropdownItems(dragMenuConfig, formatMessage, tableSortColumnReorder, selectionRect);
225
+ } = convertToDropdownItems(dragMenuConfig, formatMessage, selectionRect);
227
226
  const handleSubMenuRef = ref => {
228
227
  const parent = closestElement(editorView.dom, '.fabric-editor-popup-scroll-parent');
229
228
  if (!(parent && ref)) {
@@ -274,7 +273,7 @@ const DragMenu = /*#__PURE__*/React.memo(({
274
273
  className: DropdownMenuSharedCssClassName.SUBMENU
275
274
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
276
275
  ,
277
- css: dragMenuBackgroundColorStyles(tableSortColumnReorder)
276
+ css: dragMenuBackgroundColorStyles()
278
277
  }, jsx("div", {
279
278
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
280
279
  css: cellColourPreviewStyles(background)
@@ -477,7 +476,7 @@ const DragMenu = /*#__PURE__*/React.memo(({
477
476
  return null;
478
477
  }
479
478
  if (allowBackgroundColor) {
480
- tableSortColumnReorder ? menuItems[1].items.unshift(createBackgroundColorMenuItem()) : menuItems[0].items.unshift(createBackgroundColorMenuItem());
479
+ menuItems[1].items.unshift(createBackgroundColorMenuItem());
481
480
  }
482
481
 
483
482
  // If first row, add toggle for Header row, default is true
@@ -35,8 +35,7 @@ const FloatingDragMenu = ({
35
35
  }
36
36
  const {
37
37
  tableDuplicateCellColouring = false,
38
- tableWithFixedColumnWidthsOption = false,
39
- tableSortColumnReorder = false
38
+ tableWithFixedColumnWidthsOption = false
40
39
  } = getEditorFeatureFlags ? getEditorFeatureFlags() : {};
41
40
  const shouldUseIncreasedScalingPercent = isTableScalingEnabled && (tableWithFixedColumnWidthsOption || isCommentEditor);
42
41
  return /*#__PURE__*/React.createElement(Popup, {
@@ -76,7 +75,6 @@ const FloatingDragMenu = ({
76
75
  tableDuplicateCellColouring: tableDuplicateCellColouring,
77
76
  shouldUseIncreasedScalingPercent: shouldUseIncreasedScalingPercent,
78
77
  isTableFixedColumnWidthsOptionEnabled: tableWithFixedColumnWidthsOption,
79
- tableSortColumnReorder: tableSortColumnReorder,
80
78
  ariaNotifyPlugin: ariaNotifyPlugin,
81
79
  api: api,
82
80
  isCommentEditor: isCommentEditor || false
@@ -12,14 +12,14 @@ export const cellColourPreviewStyles = selectedColor => css({
12
12
  });
13
13
 
14
14
  // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- needs manual remediation
15
- export const dragMenuBackgroundColorStyles = (tableSortColumnReorder = false) => css`
15
+ export const dragMenuBackgroundColorStyles = () => css`
16
16
  .${ClassName.DRAG_SUBMENU} {
17
17
  border-radius: ${"var(--ds-border-radius, 3px)"};
18
18
  background: ${"var(--ds-surface-overlay, white)"};
19
19
  box-shadow: ${`var(--ds-shadow-overlay, ${`0 4px 8px -2px ${N60A}, 0 0 1px ${N60A}`})`};
20
20
  display: block;
21
21
  position: absolute;
22
- top: ${tableSortColumnReorder ? TABLE_DRAG_MENU_PADDING_TOP + TABLE_DRAG_MENU_SORT_GROUP_HEIGHT + TABLE_DRAG_MENU_MENU_GROUP_BEFORE_HEIGHT : 0}px; // move the submenu down when 'sort increasing/decreasing' appear before background color picker
22
+ top: ${TABLE_DRAG_MENU_PADDING_TOP + TABLE_DRAG_MENU_SORT_GROUP_HEIGHT + TABLE_DRAG_MENU_MENU_GROUP_BEFORE_HEIGHT}px; // move the submenu down when 'sort increasing/decreasing' appear before background color picker
23
23
  left: ${dragMenuDropdownWidth}px;
24
24
  padding: ${"var(--ds-space-100, 8px)"};
25
25
 
@@ -72,7 +72,7 @@ const defaultSelectionRect = {
72
72
  right: 0,
73
73
  bottom: 0
74
74
  };
75
- export const getDragMenuConfig = (direction, getEditorContainerWidth, hasMergedCellsInTable, editorView, api, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI, isHeaderRowRequired, isTableScalingEnabled = false, tableDuplicateCellColouring = false, isTableFixedColumnWidthsOptionEnabled = false, shouldUseIncreasedScalingPercent = false, tableSortColumnReorder = false, ariaNotifyPlugin, isCommentEditor = false) => {
75
+ export const getDragMenuConfig = (direction, getEditorContainerWidth, hasMergedCellsInTable, editorView, api, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI, isHeaderRowRequired, isTableScalingEnabled = false, tableDuplicateCellColouring = false, isTableFixedColumnWidthsOptionEnabled = false, shouldUseIncreasedScalingPercent = false, ariaNotifyPlugin, isCommentEditor = false) => {
76
76
  var _tableMap$height, _tableMap$height2, _tableMap$width, _tableMap$width2;
77
77
  const {
78
78
  selection
@@ -256,6 +256,6 @@ export const getDragMenuConfig = (direction, getEditorContainerWidth, hasMergedC
256
256
  keymap: keymap && tooltip(keymap)
257
257
  }))];
258
258
  let allConfigs = [...restConfigs];
259
- tableSortColumnReorder ? allConfigs.unshift(...sortConfigs) : allConfigs.push(...sortConfigs);
259
+ allConfigs.unshift(...sortConfigs);
260
260
  return allConfigs.filter(Boolean);
261
261
  };
@@ -416,14 +416,10 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
416
416
  });
417
417
  _defineProperty(_assertThisInitialized(_this), "createOriginalContextMenuItems", function () {
418
418
  var items = [];
419
- var getEditorFeatureFlags = _this.props.getEditorFeatureFlags;
420
- var _ref2 = getEditorFeatureFlags ? getEditorFeatureFlags() : {},
421
- _ref2$tableSortColumn = _ref2.tableSortColumnReorder,
422
- tableSortColumnReorder = _ref2$tableSortColumn === void 0 ? false : _ref2$tableSortColumn;
423
419
  var sortColumnItems = _this.createSortColumnItems();
424
420
  var backgroundColorItem = _this.createBackgroundColorItem();
425
421
  var distributeColumnsItem = _this.createDistributeColumnsItem();
426
- tableSortColumnReorder && sortColumnItems && items.push.apply(items, _toConsumableArray(sortColumnItems));
422
+ sortColumnItems && items.push.apply(items, _toConsumableArray(sortColumnItems));
427
423
  backgroundColorItem && items.push(backgroundColorItem);
428
424
  items.push(_this.createInsertColumnItem());
429
425
  items.push(_this.createInsertRowItem());
@@ -431,7 +427,6 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
431
427
  items.push(_this.createDeleteRowItem());
432
428
  items.push.apply(items, _toConsumableArray(_this.createMergeSplitCellItems()));
433
429
  distributeColumnsItem && items.push(distributeColumnsItem);
434
- !tableSortColumnReorder && sortColumnItems && items.push.apply(items, _toConsumableArray(sortColumnItems));
435
430
  items.push(_this.createClearCellsItem());
436
431
  return [{
437
432
  items: items
@@ -462,8 +457,8 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
462
457
  items[1].items.push(deleteRowItem);
463
458
  return items;
464
459
  });
465
- _defineProperty(_assertThisInitialized(_this), "onMenuItemActivated", function (_ref3) {
466
- var item = _ref3.item;
460
+ _defineProperty(_assertThisInitialized(_this), "onMenuItemActivated", function (_ref2) {
461
+ var item = _ref2.item;
467
462
  var _this$props10 = _this.props,
468
463
  editorView = _this$props10.editorView,
469
464
  selectionRect = _this$props10.selectionRect,
@@ -479,11 +474,11 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
479
474
  targetCellPosition = _getPluginState11.targetCellPosition,
480
475
  _getPluginState11$isT = _getPluginState11.isTableScalingEnabled,
481
476
  isTableScalingEnabled = _getPluginState11$isT === void 0 ? false : _getPluginState11$isT;
482
- var _ref4 = getEditorFeatureFlags ? getEditorFeatureFlags() : {},
483
- _ref4$tableDuplicateC = _ref4.tableDuplicateCellColouring,
484
- tableDuplicateCellColouring = _ref4$tableDuplicateC === void 0 ? false : _ref4$tableDuplicateC,
485
- _ref4$tableWithFixedC = _ref4.tableWithFixedColumnWidthsOption,
486
- tableWithFixedColumnWidthsOption = _ref4$tableWithFixedC === void 0 ? false : _ref4$tableWithFixedC;
477
+ var _ref3 = getEditorFeatureFlags ? getEditorFeatureFlags() : {},
478
+ _ref3$tableDuplicateC = _ref3.tableDuplicateCellColouring,
479
+ tableDuplicateCellColouring = _ref3$tableDuplicateC === void 0 ? false : _ref3$tableDuplicateC,
480
+ _ref3$tableWithFixedC = _ref3.tableWithFixedColumnWidthsOption,
481
+ tableWithFixedColumnWidthsOption = _ref3$tableWithFixedC === void 0 ? false : _ref3$tableWithFixedC;
487
482
  // context menu opened by keyboard and any item except 'background' activated
488
483
  // or color has been chosen from color palette
489
484
  if (isCellMenuOpenByKeyboard && (item.value.name !== 'background' || item.value.name === 'background' && _this.state.isSubmenuOpen)) {
@@ -612,8 +607,8 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
612
607
  }
613
608
  }
614
609
  });
615
- _defineProperty(_assertThisInitialized(_this), "handleItemMouseEnter", function (_ref5) {
616
- var item = _ref5.item;
610
+ _defineProperty(_assertThisInitialized(_this), "handleItemMouseEnter", function (_ref4) {
611
+ var item = _ref4.item;
617
612
  var _this$props13 = _this.props,
618
613
  _this$props13$editorV = _this$props13.editorView,
619
614
  state = _this$props13$editorV.state,
@@ -636,8 +631,8 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
636
631
  hoverMergedCells()(state, dispatch);
637
632
  }
638
633
  });
639
- _defineProperty(_assertThisInitialized(_this), "handleItemMouseLeave", function (_ref6) {
640
- var item = _ref6.item;
634
+ _defineProperty(_assertThisInitialized(_this), "handleItemMouseLeave", function (_ref5) {
635
+ var item = _ref5.item;
641
636
  var _this$props$editorVie = _this.props.editorView,
642
637
  state = _this$props$editorVie.state,
643
638
  dispatch = _this$props$editorVie.dispatch;
@@ -94,20 +94,18 @@ var MapDragMenuOptionIdToMessage = {
94
94
  plural: null
95
95
  }
96
96
  };
97
- var getGroupedDragMenuConfig = function getGroupedDragMenuConfig(tableSortColumnReorder) {
97
+ var getGroupedDragMenuConfig = function getGroupedDragMenuConfig() {
98
98
  var groupedDragMenuConfig = [['add_row_above', 'add_row_below', 'add_column_left', 'add_column_right', 'distribute_columns', 'clear_cells', 'delete_row', 'delete_column'], ['move_column_left', 'move_column_right', 'move_row_up', 'move_row_down']];
99
99
  var sortColumnItems = ['sort_column_asc', 'sort_column_desc'];
100
- tableSortColumnReorder ? groupedDragMenuConfig.unshift(sortColumnItems) : groupedDragMenuConfig.push(sortColumnItems);
100
+ groupedDragMenuConfig.unshift(sortColumnItems);
101
101
  return groupedDragMenuConfig;
102
102
  };
103
103
  var elementBeforeIconStyles = xcss({
104
104
  marginRight: 'space.negative.075',
105
105
  display: 'flex'
106
106
  });
107
- var convertToDropdownItems = function convertToDropdownItems(dragMenuConfig, formatMessage) {
108
- var tableSortColumnReorder = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
109
- var selectionRect = arguments.length > 3 ? arguments[3] : undefined;
110
- var groupedDragMenuConfig = getGroupedDragMenuConfig(tableSortColumnReorder);
107
+ var convertToDropdownItems = function convertToDropdownItems(dragMenuConfig, formatMessage, selectionRect) {
108
+ var groupedDragMenuConfig = getGroupedDragMenuConfig();
111
109
  var menuItemsArr = _toConsumableArray(Array(groupedDragMenuConfig.length)).map(function () {
112
110
  return [];
113
111
  });
@@ -205,7 +203,6 @@ var DragMenu = /*#__PURE__*/React.memo(function (_ref) {
205
203
  tableDuplicateCellColouring = _ref.tableDuplicateCellColouring,
206
204
  shouldUseIncreasedScalingPercent = _ref.shouldUseIncreasedScalingPercent,
207
205
  isTableFixedColumnWidthsOptionEnabled = _ref.isTableFixedColumnWidthsOptionEnabled,
208
- tableSortColumnReorder = _ref.tableSortColumnReorder,
209
206
  ariaNotifyPlugin = _ref.ariaNotifyPlugin,
210
207
  isCommentEditor = _ref.isCommentEditor;
211
208
  var state = editorView.state,
@@ -221,8 +218,8 @@ var DragMenu = /*#__PURE__*/React.memo(function (_ref) {
221
218
  var selectionRect = isSelectionType(selection, 'cell') ? getSelectionRect(selection) : findCellRectClosestToPos(selection.$from);
222
219
  var hasMergedCellsInTable = (_tableMap$hasMergedCe = tableMap === null || tableMap === void 0 ? void 0 : tableMap.hasMergedCells()) !== null && _tableMap$hasMergedCe !== void 0 ? _tableMap$hasMergedCe : false;
223
220
  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, hasMergedCellsInTable, editorView, api, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI, pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.isHeaderRowRequired, isTableScalingEnabled, tableDuplicateCellColouring, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, tableSortColumnReorder, ariaNotifyPlugin, isCommentEditor);
225
- var _convertToDropdownIte = convertToDropdownItems(dragMenuConfig, formatMessage, tableSortColumnReorder, selectionRect),
221
+ var dragMenuConfig = getDragMenuConfig(direction, getEditorContainerWidth, hasMergedCellsInTable, editorView, api, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI, pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.isHeaderRowRequired, isTableScalingEnabled, tableDuplicateCellColouring, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, ariaNotifyPlugin, isCommentEditor);
222
+ var _convertToDropdownIte = convertToDropdownItems(dragMenuConfig, formatMessage, selectionRect),
226
223
  menuItems = _convertToDropdownIte.menuItems,
227
224
  menuCallback = _convertToDropdownIte.menuCallback;
228
225
  var handleSubMenuRef = function handleSubMenuRef(ref) {
@@ -271,7 +268,7 @@ var DragMenu = /*#__PURE__*/React.memo(function (_ref) {
271
268
  className: DropdownMenuSharedCssClassName.SUBMENU
272
269
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
273
270
  ,
274
- css: dragMenuBackgroundColorStyles(tableSortColumnReorder)
271
+ css: dragMenuBackgroundColorStyles()
275
272
  }, jsx("div", {
276
273
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
277
274
  css: cellColourPreviewStyles(background)
@@ -469,7 +466,7 @@ var DragMenu = /*#__PURE__*/React.memo(function (_ref) {
469
466
  return null;
470
467
  }
471
468
  if (allowBackgroundColor) {
472
- tableSortColumnReorder ? menuItems[1].items.unshift(createBackgroundColorMenuItem()) : menuItems[0].items.unshift(createBackgroundColorMenuItem());
469
+ menuItems[1].items.unshift(createBackgroundColorMenuItem());
473
470
  }
474
471
 
475
472
  // If first row, add toggle for Header row, default is true
@@ -36,9 +36,7 @@ var FloatingDragMenu = function FloatingDragMenu(_ref) {
36
36
  _ref2$tableDuplicateC = _ref2.tableDuplicateCellColouring,
37
37
  tableDuplicateCellColouring = _ref2$tableDuplicateC === void 0 ? false : _ref2$tableDuplicateC,
38
38
  _ref2$tableWithFixedC = _ref2.tableWithFixedColumnWidthsOption,
39
- tableWithFixedColumnWidthsOption = _ref2$tableWithFixedC === void 0 ? false : _ref2$tableWithFixedC,
40
- _ref2$tableSortColumn = _ref2.tableSortColumnReorder,
41
- tableSortColumnReorder = _ref2$tableSortColumn === void 0 ? false : _ref2$tableSortColumn;
39
+ tableWithFixedColumnWidthsOption = _ref2$tableWithFixedC === void 0 ? false : _ref2$tableWithFixedC;
42
40
  var shouldUseIncreasedScalingPercent = isTableScalingEnabled && (tableWithFixedColumnWidthsOption || isCommentEditor);
43
41
  return /*#__PURE__*/React.createElement(Popup, {
44
42
  alignX: direction === 'row' ? 'right' : undefined,
@@ -77,7 +75,6 @@ var FloatingDragMenu = function FloatingDragMenu(_ref) {
77
75
  tableDuplicateCellColouring: tableDuplicateCellColouring,
78
76
  shouldUseIncreasedScalingPercent: shouldUseIncreasedScalingPercent,
79
77
  isTableFixedColumnWidthsOptionEnabled: tableWithFixedColumnWidthsOption,
80
- tableSortColumnReorder: tableSortColumnReorder,
81
78
  ariaNotifyPlugin: ariaNotifyPlugin,
82
79
  api: api,
83
80
  isCommentEditor: isCommentEditor || false
@@ -17,8 +17,7 @@ export var cellColourPreviewStyles = function cellColourPreviewStyles(selectedCo
17
17
 
18
18
  // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- needs manual remediation
19
19
  export var dragMenuBackgroundColorStyles = function dragMenuBackgroundColorStyles() {
20
- var tableSortColumnReorder = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
21
- return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n\t.", " {\n\t\tborder-radius: ", ";\n\t\tbackground: ", ";\n\t\tbox-shadow: ", ";\n\t\tdisplay: block;\n\t\tposition: absolute;\n\t\ttop: ", "px; // move the submenu down when 'sort increasing/decreasing' appear before background color picker\n\t\tleft: ", "px;\n\t\tpadding: ", ";\n\n\t\t> div {\n\t\t\tpadding: 0;\n\t\t}\n\t}\n\n\t.", " {\n\t\tdisplay: flex;\n\n\t\t&::before {\n\t\t\tcontent: '';\n\t\t\tdisplay: block;\n\t\t\tborder: 1px solid ", ";\n\t\t\tborder-radius: ", ";\n\t\t\twidth: 14px;\n\t\t\theight: 14px;\n\t\t}\n\n\t\t&::after {\n\t\t\tcontent: '\u203A';\n\t\t\tmargin-left: ", ";\n\t\t\tline-height: 14px;\n\t\t\tcolor: ", ";\n\t\t}\n\t}\n"])), ClassName.DRAG_SUBMENU, "var(--ds-border-radius, 3px)", "var(--ds-surface-overlay, white)", "var(--ds-shadow-overlay, ".concat("0 4px 8px -2px ".concat(N60A, ", 0 0 1px ").concat(N60A), ")"), tableSortColumnReorder ? TABLE_DRAG_MENU_PADDING_TOP + TABLE_DRAG_MENU_SORT_GROUP_HEIGHT + TABLE_DRAG_MENU_MENU_GROUP_BEFORE_HEIGHT : 0, dragMenuDropdownWidth, "var(--ds-space-100, 8px)", ClassName.DRAG_SUBMENU_ICON, tableBackgroundBorderColor, "var(--ds-border-radius, 3px)", "var(--ds-space-050, 4px)", "var(--ds-icon, ".concat(N90, ")"));
20
+ return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n\t.", " {\n\t\tborder-radius: ", ";\n\t\tbackground: ", ";\n\t\tbox-shadow: ", ";\n\t\tdisplay: block;\n\t\tposition: absolute;\n\t\ttop: ", "px; // move the submenu down when 'sort increasing/decreasing' appear before background color picker\n\t\tleft: ", "px;\n\t\tpadding: ", ";\n\n\t\t> div {\n\t\t\tpadding: 0;\n\t\t}\n\t}\n\n\t.", " {\n\t\tdisplay: flex;\n\n\t\t&::before {\n\t\t\tcontent: '';\n\t\t\tdisplay: block;\n\t\t\tborder: 1px solid ", ";\n\t\t\tborder-radius: ", ";\n\t\t\twidth: 14px;\n\t\t\theight: 14px;\n\t\t}\n\n\t\t&::after {\n\t\t\tcontent: '\u203A';\n\t\t\tmargin-left: ", ";\n\t\t\tline-height: 14px;\n\t\t\tcolor: ", ";\n\t\t}\n\t}\n"])), ClassName.DRAG_SUBMENU, "var(--ds-border-radius, 3px)", "var(--ds-surface-overlay, white)", "var(--ds-shadow-overlay, ".concat("0 4px 8px -2px ".concat(N60A, ", 0 0 1px ").concat(N60A), ")"), TABLE_DRAG_MENU_PADDING_TOP + TABLE_DRAG_MENU_SORT_GROUP_HEIGHT + TABLE_DRAG_MENU_MENU_GROUP_BEFORE_HEIGHT, dragMenuDropdownWidth, "var(--ds-space-100, 8px)", ClassName.DRAG_SUBMENU_ICON, tableBackgroundBorderColor, "var(--ds-border-radius, 3px)", "var(--ds-space-050, 4px)", "var(--ds-icon, ".concat(N90, ")"));
22
21
  };
23
22
 
24
23
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
@@ -81,9 +81,8 @@ export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorCo
81
81
  var tableDuplicateCellColouring = arguments.length > 12 && arguments[12] !== undefined ? arguments[12] : false;
82
82
  var isTableFixedColumnWidthsOptionEnabled = arguments.length > 13 && arguments[13] !== undefined ? arguments[13] : false;
83
83
  var shouldUseIncreasedScalingPercent = arguments.length > 14 && arguments[14] !== undefined ? arguments[14] : false;
84
- var tableSortColumnReorder = arguments.length > 15 && arguments[15] !== undefined ? arguments[15] : false;
85
- var ariaNotifyPlugin = arguments.length > 16 ? arguments[16] : undefined;
86
- var isCommentEditor = arguments.length > 17 && arguments[17] !== undefined ? arguments[17] : false;
84
+ var ariaNotifyPlugin = arguments.length > 15 ? arguments[15] : undefined;
85
+ var isCommentEditor = arguments.length > 16 && arguments[16] !== undefined ? arguments[16] : false;
87
86
  var selection = editorView.state.selection;
88
87
  var _getTablePluginState = getTablePluginState(editorView.state),
89
88
  getIntl = _getTablePluginState.getIntl;
@@ -274,6 +273,6 @@ export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorCo
274
273
  };
275
274
  })));
276
275
  var allConfigs = _toConsumableArray(restConfigs);
277
- tableSortColumnReorder ? allConfigs.unshift.apply(allConfigs, _toConsumableArray(sortConfigs)) : allConfigs.push.apply(allConfigs, _toConsumableArray(sortConfigs));
276
+ allConfigs.unshift.apply(allConfigs, _toConsumableArray(sortConfigs));
278
277
  return allConfigs.filter(Boolean);
279
278
  };
@@ -32,7 +32,6 @@ type DragMenuProps = {
32
32
  tableDuplicateCellColouring?: boolean;
33
33
  shouldUseIncreasedScalingPercent?: boolean;
34
34
  isTableFixedColumnWidthsOptionEnabled?: boolean;
35
- tableSortColumnReorder?: boolean;
36
35
  ariaNotifyPlugin?: (message: string, ariaLiveElementAttributes?: AriaLiveElementAttributes) => void;
37
36
  isCommentEditor?: boolean;
38
37
  };
@@ -1,3 +1,3 @@
1
1
  export declare const cellColourPreviewStyles: (selectedColor: string) => import("@emotion/react").SerializedStyles;
2
- export declare const dragMenuBackgroundColorStyles: (tableSortColumnReorder?: boolean) => import("@emotion/react").SerializedStyles;
2
+ export declare const dragMenuBackgroundColorStyles: () => import("@emotion/react").SerializedStyles;
3
3
  export declare const toggleStyles: import("@emotion/react").SerializedStyles;
@@ -16,4 +16,4 @@ export interface DragMenuConfig extends Omit<DropdownOptionT<Command>, 'icon'> {
16
16
  iconFallback?: React.ComponentType<React.PropsWithChildren<UNSAFE_NewIconProps>>;
17
17
  keymap?: string;
18
18
  }
19
- export declare const getDragMenuConfig: (direction: TableDirection, getEditorContainerWidth: GetEditorContainerWidth, hasMergedCellsInTable: boolean, editorView: EditorView, api: PluginInjectionAPI | undefined | null, tableMap?: TableMap, index?: number, targetCellPosition?: number, selectionRect?: Rect, editorAnalyticsAPI?: EditorAnalyticsAPI, isHeaderRowRequired?: boolean, isTableScalingEnabled?: boolean, tableDuplicateCellColouring?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean, tableSortColumnReorder?: boolean, ariaNotifyPlugin?: ((message: string, ariaLiveElementAttributes?: AriaLiveElementAttributes) => void) | undefined, isCommentEditor?: boolean) => DragMenuConfig[];
19
+ export declare const getDragMenuConfig: (direction: TableDirection, getEditorContainerWidth: GetEditorContainerWidth, hasMergedCellsInTable: boolean, editorView: EditorView, api: PluginInjectionAPI | undefined | null, tableMap?: TableMap, index?: number, targetCellPosition?: number, selectionRect?: Rect, editorAnalyticsAPI?: EditorAnalyticsAPI, isHeaderRowRequired?: boolean, isTableScalingEnabled?: boolean, tableDuplicateCellColouring?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean, ariaNotifyPlugin?: ((message: string, ariaLiveElementAttributes?: AriaLiveElementAttributes) => void) | undefined, isCommentEditor?: boolean) => DragMenuConfig[];
@@ -32,7 +32,6 @@ type DragMenuProps = {
32
32
  tableDuplicateCellColouring?: boolean;
33
33
  shouldUseIncreasedScalingPercent?: boolean;
34
34
  isTableFixedColumnWidthsOptionEnabled?: boolean;
35
- tableSortColumnReorder?: boolean;
36
35
  ariaNotifyPlugin?: (message: string, ariaLiveElementAttributes?: AriaLiveElementAttributes) => void;
37
36
  isCommentEditor?: boolean;
38
37
  };
@@ -1,3 +1,3 @@
1
1
  export declare const cellColourPreviewStyles: (selectedColor: string) => import("@emotion/react").SerializedStyles;
2
- export declare const dragMenuBackgroundColorStyles: (tableSortColumnReorder?: boolean) => import("@emotion/react").SerializedStyles;
2
+ export declare const dragMenuBackgroundColorStyles: () => import("@emotion/react").SerializedStyles;
3
3
  export declare const toggleStyles: import("@emotion/react").SerializedStyles;
@@ -16,4 +16,4 @@ export interface DragMenuConfig extends Omit<DropdownOptionT<Command>, 'icon'> {
16
16
  iconFallback?: React.ComponentType<React.PropsWithChildren<UNSAFE_NewIconProps>>;
17
17
  keymap?: string;
18
18
  }
19
- export declare const getDragMenuConfig: (direction: TableDirection, getEditorContainerWidth: GetEditorContainerWidth, hasMergedCellsInTable: boolean, editorView: EditorView, api: PluginInjectionAPI | undefined | null, tableMap?: TableMap, index?: number, targetCellPosition?: number, selectionRect?: Rect, editorAnalyticsAPI?: EditorAnalyticsAPI, isHeaderRowRequired?: boolean, isTableScalingEnabled?: boolean, tableDuplicateCellColouring?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean, tableSortColumnReorder?: boolean, ariaNotifyPlugin?: ((message: string, ariaLiveElementAttributes?: AriaLiveElementAttributes) => void) | undefined, isCommentEditor?: boolean) => DragMenuConfig[];
19
+ export declare const getDragMenuConfig: (direction: TableDirection, getEditorContainerWidth: GetEditorContainerWidth, hasMergedCellsInTable: boolean, editorView: EditorView, api: PluginInjectionAPI | undefined | null, tableMap?: TableMap, index?: number, targetCellPosition?: number, selectionRect?: Rect, editorAnalyticsAPI?: EditorAnalyticsAPI, isHeaderRowRequired?: boolean, isTableScalingEnabled?: boolean, tableDuplicateCellColouring?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean, ariaNotifyPlugin?: ((message: string, ariaLiveElementAttributes?: AriaLiveElementAttributes) => void) | undefined, isCommentEditor?: boolean) => DragMenuConfig[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "7.31.1",
3
+ "version": "7.31.2",
4
4
  "description": "Table plugin for the @atlaskit/editor",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -584,13 +584,11 @@ export class ContextualMenu extends Component<Props & WrappedComponentProps, Sta
584
584
 
585
585
  private createOriginalContextMenuItems = () => {
586
586
  let items: MenuItem[] = [];
587
- const { getEditorFeatureFlags } = this.props;
588
- const { tableSortColumnReorder = false } = getEditorFeatureFlags ? getEditorFeatureFlags() : {};
589
587
  const sortColumnItems = this.createSortColumnItems();
590
588
  const backgroundColorItem = this.createBackgroundColorItem();
591
589
  const distributeColumnsItem = this.createDistributeColumnsItem();
592
590
 
593
- tableSortColumnReorder && sortColumnItems && items.push(...sortColumnItems);
591
+ sortColumnItems && items.push(...sortColumnItems);
594
592
 
595
593
  backgroundColorItem && items.push(backgroundColorItem);
596
594
 
@@ -606,8 +604,6 @@ export class ContextualMenu extends Component<Props & WrappedComponentProps, Sta
606
604
 
607
605
  distributeColumnsItem && items.push(distributeColumnsItem);
608
606
 
609
- !tableSortColumnReorder && sortColumnItems && items.push(...sortColumnItems);
610
-
611
607
  items.push(this.createClearCellsItem());
612
608
 
613
609
  return [{ items }];
@@ -93,7 +93,6 @@ type DragMenuProps = {
93
93
  tableDuplicateCellColouring?: boolean;
94
94
  shouldUseIncreasedScalingPercent?: boolean;
95
95
  isTableFixedColumnWidthsOptionEnabled?: boolean;
96
- tableSortColumnReorder?: boolean;
97
96
  ariaNotifyPlugin?: (
98
97
  message: string,
99
98
  ariaLiveElementAttributes?: AriaLiveElementAttributes,
@@ -166,7 +165,7 @@ const MapDragMenuOptionIdToMessage: Record<DragMenuOptionIdType, MessageType> =
166
165
  },
167
166
  };
168
167
 
169
- const getGroupedDragMenuConfig = (tableSortColumnReorder: boolean) => {
168
+ const getGroupedDragMenuConfig = () => {
170
169
  let groupedDragMenuConfig: DragMenuOptionIdType[][] = [
171
170
  [
172
171
  'add_row_above',
@@ -181,9 +180,7 @@ const getGroupedDragMenuConfig = (tableSortColumnReorder: boolean) => {
181
180
  ['move_column_left', 'move_column_right', 'move_row_up', 'move_row_down'],
182
181
  ];
183
182
  const sortColumnItems: DragMenuOptionIdType[] = ['sort_column_asc', 'sort_column_desc'];
184
- tableSortColumnReorder
185
- ? groupedDragMenuConfig.unshift(sortColumnItems)
186
- : groupedDragMenuConfig.push(sortColumnItems);
183
+ groupedDragMenuConfig.unshift(sortColumnItems);
187
184
 
188
185
  return groupedDragMenuConfig;
189
186
  };
@@ -196,10 +193,9 @@ const elementBeforeIconStyles = xcss({
196
193
  const convertToDropdownItems = (
197
194
  dragMenuConfig: DragMenuConfig[],
198
195
  formatMessage: IntlShape['formatMessage'],
199
- tableSortColumnReorder: boolean = false,
200
196
  selectionRect?: Rect,
201
197
  ) => {
202
- const groupedDragMenuConfig = getGroupedDragMenuConfig(tableSortColumnReorder);
198
+ const groupedDragMenuConfig = getGroupedDragMenuConfig();
203
199
  let menuItemsArr: MenuItem[][] = [...Array(groupedDragMenuConfig.length)].map(() => []);
204
200
  let menuCallback: { [key: string]: Command } = {};
205
201
  dragMenuConfig.forEach((item) => {
@@ -286,7 +282,6 @@ const DragMenu = React.memo(
286
282
  tableDuplicateCellColouring,
287
283
  shouldUseIncreasedScalingPercent,
288
284
  isTableFixedColumnWidthsOptionEnabled,
289
- tableSortColumnReorder,
290
285
  ariaNotifyPlugin,
291
286
  isCommentEditor,
292
287
  }: DragMenuProps & WrappedComponentProps) => {
@@ -319,7 +314,6 @@ const DragMenu = React.memo(
319
314
  tableDuplicateCellColouring,
320
315
  isTableFixedColumnWidthsOptionEnabled,
321
316
  shouldUseIncreasedScalingPercent,
322
- tableSortColumnReorder,
323
317
  ariaNotifyPlugin,
324
318
  isCommentEditor,
325
319
  );
@@ -327,7 +321,6 @@ const DragMenu = React.memo(
327
321
  const { menuItems, menuCallback } = convertToDropdownItems(
328
322
  dragMenuConfig,
329
323
  formatMessage,
330
- tableSortColumnReorder,
331
324
  selectionRect,
332
325
  );
333
326
 
@@ -383,7 +376,7 @@ const DragMenu = React.memo(
383
376
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
384
377
  className={DropdownMenuSharedCssClassName.SUBMENU}
385
378
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
386
- css={dragMenuBackgroundColorStyles(tableSortColumnReorder)}
379
+ css={dragMenuBackgroundColorStyles()}
387
380
  >
388
381
  <div
389
382
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
@@ -610,9 +603,7 @@ const DragMenu = React.memo(
610
603
  }
611
604
 
612
605
  if (allowBackgroundColor) {
613
- tableSortColumnReorder
614
- ? menuItems[1].items.unshift(createBackgroundColorMenuItem())
615
- : menuItems[0].items.unshift(createBackgroundColorMenuItem());
606
+ menuItems[1].items.unshift(createBackgroundColorMenuItem());
616
607
  }
617
608
 
618
609
  // If first row, add toggle for Header row, default is true
@@ -79,11 +79,8 @@ const FloatingDragMenu = ({
79
79
  return null;
80
80
  }
81
81
 
82
- const {
83
- tableDuplicateCellColouring = false,
84
- tableWithFixedColumnWidthsOption = false,
85
- tableSortColumnReorder = false,
86
- } = getEditorFeatureFlags ? getEditorFeatureFlags() : {};
82
+ const { tableDuplicateCellColouring = false, tableWithFixedColumnWidthsOption = false } =
83
+ getEditorFeatureFlags ? getEditorFeatureFlags() : {};
87
84
 
88
85
  const shouldUseIncreasedScalingPercent =
89
86
  isTableScalingEnabled && (tableWithFixedColumnWidthsOption || isCommentEditor);
@@ -126,7 +123,6 @@ const FloatingDragMenu = ({
126
123
  tableDuplicateCellColouring={tableDuplicateCellColouring}
127
124
  shouldUseIncreasedScalingPercent={shouldUseIncreasedScalingPercent}
128
125
  isTableFixedColumnWidthsOptionEnabled={tableWithFixedColumnWidthsOption}
129
- tableSortColumnReorder={tableSortColumnReorder}
130
126
  ariaNotifyPlugin={ariaNotifyPlugin}
131
127
  api={api}
132
128
  isCommentEditor={isCommentEditor || false}
@@ -22,18 +22,16 @@ export const cellColourPreviewStyles = (selectedColor: string) =>
22
22
  });
23
23
 
24
24
  // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- needs manual remediation
25
- export const dragMenuBackgroundColorStyles = (tableSortColumnReorder: boolean = false) => css`
25
+ export const dragMenuBackgroundColorStyles = () => css`
26
26
  .${ClassName.DRAG_SUBMENU} {
27
27
  border-radius: ${token('border.radius', '3px')};
28
28
  background: ${token('elevation.surface.overlay', 'white')};
29
29
  box-shadow: ${token('elevation.shadow.overlay', `0 4px 8px -2px ${N60A}, 0 0 1px ${N60A}`)};
30
30
  display: block;
31
31
  position: absolute;
32
- top: ${tableSortColumnReorder
33
- ? TABLE_DRAG_MENU_PADDING_TOP +
34
- TABLE_DRAG_MENU_SORT_GROUP_HEIGHT +
35
- TABLE_DRAG_MENU_MENU_GROUP_BEFORE_HEIGHT
36
- : 0}px; // move the submenu down when 'sort increasing/decreasing' appear before background color picker
32
+ top: ${TABLE_DRAG_MENU_PADDING_TOP +
33
+ TABLE_DRAG_MENU_SORT_GROUP_HEIGHT +
34
+ TABLE_DRAG_MENU_MENU_GROUP_BEFORE_HEIGHT}px; // move the submenu down when 'sort increasing/decreasing' appear before background color picker
37
35
  left: ${dragMenuDropdownWidth}px;
38
36
  padding: ${token('space.100', '8px')};
39
37
 
@@ -165,7 +165,6 @@ export const getDragMenuConfig = (
165
165
  tableDuplicateCellColouring = false,
166
166
  isTableFixedColumnWidthsOptionEnabled = false,
167
167
  shouldUseIncreasedScalingPercent = false,
168
- tableSortColumnReorder = false,
169
168
  ariaNotifyPlugin?: (
170
169
  message: string,
171
170
  ariaLiveElementAttributes?: AriaLiveElementAttributes,
@@ -417,7 +416,7 @@ export const getDragMenuConfig = (
417
416
  ];
418
417
 
419
418
  let allConfigs = [...restConfigs];
420
- tableSortColumnReorder ? allConfigs.unshift(...sortConfigs) : allConfigs.push(...sortConfigs);
419
+ allConfigs.unshift(...sortConfigs);
421
420
 
422
421
  return allConfigs.filter(Boolean) as DragMenuConfig[];
423
422
  };