@atlaskit/editor-plugin-table 22.1.4 → 22.2.0

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 (46) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/cjs/nodeviews/table-node-views.js +1 -2
  3. package/dist/cjs/pm-plugins/commands/column-resize.js +2 -3
  4. package/dist/cjs/pm-plugins/commands/hover.js +6 -14
  5. package/dist/cjs/pm-plugins/commands/misc.js +13 -17
  6. package/dist/cjs/pm-plugins/decorations/plugin.js +2 -10
  7. package/dist/cjs/pm-plugins/decorations/utils/column-controls.js +9 -26
  8. package/dist/cjs/pm-plugins/utils/decoration.js +6 -10
  9. package/dist/cjs/pm-plugins/utils/sticky-header.js +2 -2
  10. package/dist/cjs/tablePlugin.js +1 -2
  11. package/dist/cjs/ui/FloatingContextualButton/index.js +1 -2
  12. package/dist/cjs/ui/FloatingContextualMenu/index.js +2 -15
  13. package/dist/cjs/ui/TableFloatingColumnControls/index.js +1 -1
  14. package/dist/es2019/nodeviews/table-node-views.js +1 -2
  15. package/dist/es2019/pm-plugins/commands/column-resize.js +2 -3
  16. package/dist/es2019/pm-plugins/commands/hover.js +4 -16
  17. package/dist/es2019/pm-plugins/commands/misc.js +1 -6
  18. package/dist/es2019/pm-plugins/decorations/plugin.js +2 -9
  19. package/dist/es2019/pm-plugins/decorations/utils/column-controls.js +3 -21
  20. package/dist/es2019/pm-plugins/utils/decoration.js +6 -10
  21. package/dist/es2019/pm-plugins/utils/sticky-header.js +2 -2
  22. package/dist/es2019/tablePlugin.js +1 -2
  23. package/dist/es2019/ui/FloatingContextualButton/index.js +1 -2
  24. package/dist/es2019/ui/FloatingContextualMenu/index.js +2 -15
  25. package/dist/es2019/ui/TableFloatingColumnControls/index.js +1 -1
  26. package/dist/esm/nodeviews/table-node-views.js +1 -2
  27. package/dist/esm/pm-plugins/commands/column-resize.js +2 -3
  28. package/dist/esm/pm-plugins/commands/hover.js +6 -14
  29. package/dist/esm/pm-plugins/commands/misc.js +14 -18
  30. package/dist/esm/pm-plugins/decorations/plugin.js +2 -10
  31. package/dist/esm/pm-plugins/decorations/utils/column-controls.js +10 -27
  32. package/dist/esm/pm-plugins/utils/decoration.js +6 -10
  33. package/dist/esm/pm-plugins/utils/sticky-header.js +2 -2
  34. package/dist/esm/tablePlugin.js +1 -2
  35. package/dist/esm/ui/FloatingContextualButton/index.js +1 -2
  36. package/dist/esm/ui/FloatingContextualMenu/index.js +2 -15
  37. package/dist/esm/ui/TableFloatingColumnControls/index.js +1 -1
  38. package/dist/types/pm-plugins/decorations/utils/column-controls.d.ts +2 -2
  39. package/dist/types/pm-plugins/decorations/utils/types.d.ts +1 -7
  40. package/dist/types/pm-plugins/utils/decoration.d.ts +2 -2
  41. package/dist/types/pm-plugins/utils/sticky-header.d.ts +1 -1
  42. package/dist/types-ts4.5/pm-plugins/decorations/utils/column-controls.d.ts +2 -2
  43. package/dist/types-ts4.5/pm-plugins/decorations/utils/types.d.ts +1 -7
  44. package/dist/types-ts4.5/pm-plugins/utils/decoration.d.ts +2 -2
  45. package/dist/types-ts4.5/pm-plugins/utils/sticky-header.d.ts +1 -1
  46. package/package.json +4 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @atlaskit/editor-plugin-table
2
2
 
3
+ ## 22.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`e5cdd96dcf4f9`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e5cdd96dcf4f9) -
8
+ Clean up platform_editor_hydratable_ui experiment (shipped as enabled)
9
+
10
+ ### Patch Changes
11
+
12
+ - [`d2c265eaaf495`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d2c265eaaf495) -
13
+ Remove isDragAndDropEnabled dead code from pm-plugins - always true (EDITOR-6290)
14
+ - Updated dependencies
15
+
3
16
  ## 22.1.4
4
17
 
5
18
  ### Patch Changes
@@ -32,8 +32,7 @@ var tableHeaderView = exports.tableHeaderView = function tableHeaderView(options
32
32
  };
33
33
  var tableRowView = exports.tableRowView = function tableRowView(options) {
34
34
  return function (node, view, getPos) {
35
- var _options$isDragAndDro;
36
- if ((0, _stickyHeader.isNativeStickySupported)((_options$isDragAndDro = options.isDragAndDropEnabled) !== null && _options$isDragAndDro !== void 0 ? _options$isDragAndDro : false) && (0, _expValEquals.expValEquals)('platform_editor_table_sticky_header_improvements', 'cohort', 'test_with_overflow')) {
35
+ if ((0, _stickyHeader.isNativeStickySupported)() && (0, _expValEquals.expValEquals)('platform_editor_table_sticky_header_improvements', 'cohort', 'test_with_overflow')) {
37
36
  return new _TableRowNativeStickyWithFallback.default(node, view, getPos, options.eventDispatcher, options.pluginInjectionApi);
38
37
  } else {
39
38
  return new _TableRow.default(node, view, getPos, options.eventDispatcher, options.pluginInjectionApi);
@@ -33,8 +33,7 @@ var updateResizeHandleAndStatePosition = function updateResizeHandleAndStatePosi
33
33
  var customTr = state.tr;
34
34
  var _getPluginState = (0, _pluginFactory.getPluginState)(state),
35
35
  allowColumnResizing = _getPluginState.pluginConfig.allowColumnResizing,
36
- getIntl = _getPluginState.getIntl,
37
- isDragAndDropEnabled = _getPluginState.isDragAndDropEnabled;
36
+ getIntl = _getPluginState.getIntl;
38
37
  var fakeDispatch = function fakeDispatch(tr) {
39
38
  customTr = tr;
40
39
  };
@@ -47,7 +46,7 @@ var updateResizeHandleAndStatePosition = function updateResizeHandleAndStatePosi
47
46
  });
48
47
  var decorationsWithWidgetAndHandle = (0, _decoration.updateDecorations)(customTr.doc, decorationsWithWidget, (0, _decoration.createColumnLineResize)(state.selection, {
49
48
  right: columnIndex
50
- }, isDragAndDropEnabled), _types.TableDecorations.COLUMN_RESIZING_HANDLE_LINE);
49
+ }), _types.TableDecorations.COLUMN_RESIZING_HANDLE_LINE);
51
50
  getTablePluginCommand({
52
51
  type: 'START_KEYBOARD_COLUMN_RESIZE',
53
52
  data: {
@@ -49,12 +49,10 @@ var hoverMergedCells = exports.hoverMergedCells = function hoverMergedCells() {
49
49
  var hoverColumns = exports.hoverColumns = function hoverColumns(hoveredColumns, isInDanger) {
50
50
  return (0, _pluginFactory.createCommand)(function (state) {
51
51
  var cells = (0, _utils.getCellsInColumn)(hoveredColumns)(state.tr.selection);
52
- var _getPluginState = (0, _pluginFactory.getPluginState)(state),
53
- isDragAndDropEnabled = _getPluginState.isDragAndDropEnabled;
54
52
  if (!cells) {
55
53
  return false;
56
54
  }
57
- var decorations = (0, _decoration.createControlsHoverDecoration)(cells, 'column', state.tr, isDragAndDropEnabled, hoveredColumns, isInDanger);
55
+ var decorations = (0, _decoration.createControlsHoverDecoration)(cells, 'column', state.tr, hoveredColumns, isInDanger);
58
56
  return {
59
57
  type: 'HOVER_COLUMNS',
60
58
  data: {
@@ -73,9 +71,7 @@ var hoverRows = exports.hoverRows = function hoverRows(hoveredRows, isInDanger)
73
71
  if (!cells) {
74
72
  return false;
75
73
  }
76
- var _getPluginState2 = (0, _pluginFactory.getPluginState)(state),
77
- isDragAndDropEnabled = _getPluginState2.isDragAndDropEnabled;
78
- var decorations = (0, _decoration.createControlsHoverDecoration)(cells, 'row', state.tr, isDragAndDropEnabled, hoveredRows, isInDanger);
74
+ var decorations = (0, _decoration.createControlsHoverDecoration)(cells, 'row', state.tr, hoveredRows, isInDanger);
79
75
  return {
80
76
  type: 'HOVER_ROWS',
81
77
  data: {
@@ -101,9 +97,7 @@ var hoverTable = exports.hoverTable = function hoverTable(isInDanger, isSelected
101
97
  if (!cells) {
102
98
  return false;
103
99
  }
104
- var _getPluginState3 = (0, _pluginFactory.getPluginState)(state),
105
- isDragAndDropEnabled = _getPluginState3.isDragAndDropEnabled;
106
- var decorations = (0, _decoration.createControlsHoverDecoration)(cells, 'table', state.tr, isDragAndDropEnabled, [], isInDanger, isSelected);
100
+ var decorations = (0, _decoration.createControlsHoverDecoration)(cells, 'table', state.tr, [], isInDanger, isSelected);
107
101
  return {
108
102
  type: 'HOVER_TABLE',
109
103
  data: {
@@ -132,12 +126,10 @@ var clearHoverSelection = exports.clearHoverSelection = function clearHoverSelec
132
126
  };
133
127
  var showResizeHandleLine = exports.showResizeHandleLine = function showResizeHandleLine(cellColumnPositioning) {
134
128
  return (0, _pluginFactory.createCommand)(function (state) {
135
- var _getPluginState4 = (0, _pluginFactory.getPluginState)(state),
136
- isDragAndDropEnabled = _getPluginState4.isDragAndDropEnabled;
137
129
  return {
138
130
  type: 'SHOW_RESIZE_HANDLE_LINE',
139
131
  data: {
140
- decorationSet: (0, _updatePluginStateDecorations.updatePluginStateDecorations)(state, (0, _decoration.createColumnLineResize)(state.selection, cellColumnPositioning, isDragAndDropEnabled), _types.TableDecorations.COLUMN_RESIZING_HANDLE_LINE)
132
+ decorationSet: (0, _updatePluginStateDecorations.updatePluginStateDecorations)(state, (0, _decoration.createColumnLineResize)(state.selection, cellColumnPositioning), _types.TableDecorations.COLUMN_RESIZING_HANDLE_LINE)
141
133
  }
142
134
  };
143
135
  });
@@ -166,8 +158,8 @@ var setTableHovered = exports.setTableHovered = function setTableHovered(hovered
166
158
  };
167
159
  var hoverCell = exports.hoverCell = function hoverCell(rowIndex, colIndex) {
168
160
  return (0, _pluginFactory.createCommand)(function (state) {
169
- var _getPluginState5 = (0, _pluginFactory.getPluginState)(state),
170
- prevHoveredCell = _getPluginState5.hoveredCell;
161
+ var _getPluginState = (0, _pluginFactory.getPluginState)(state),
162
+ prevHoveredCell = _getPluginState.hoveredCell;
171
163
 
172
164
  // If no arguments have been passed then the intention it to reset the hover cell data
173
165
  var clear = rowIndex === undefined && colIndex === undefined;
@@ -41,8 +41,6 @@ var setTableRef = exports.setTableRef = function setTableRef(ref) {
41
41
  var tableNode = ref && foundTable ? foundTable.node : undefined;
42
42
  var tablePos = ref && foundTable ? foundTable.pos : undefined;
43
43
  var tableWrapperTarget = (0, _utils.closestElement)(tableRef, ".".concat(_types.TableCssClassName.TABLE_NODE_WRAPPER)) || undefined;
44
- var _getPluginState = (0, _pluginFactory.getPluginState)(state),
45
- isDragAndDropEnabled = _getPluginState.isDragAndDropEnabled;
46
44
  return {
47
45
  type: 'SET_TABLE_REF',
48
46
  data: {
@@ -53,8 +51,6 @@ var setTableRef = exports.setTableRef = function setTableRef(ref) {
53
51
  isNumberColumnEnabled: (0, _nodes.checkIfNumberColumnEnabled)(state.selection),
54
52
  isHeaderRowEnabled: (0, _nodes.checkIfHeaderRowEnabled)(state.selection),
55
53
  isHeaderColumnEnabled: (0, _nodes.checkIfHeaderColumnEnabled)(state.selection),
56
- // decoration set is drawn by the decoration plugin, skip this for DnD as all controls are floating
57
- decorationSet: !isDragAndDropEnabled ? (0, _updatePluginStateDecorations.updatePluginStateDecorations)(state, (0, _decoration.createColumnControlsDecoration)(state.selection), _types.TableDecorations.COLUMN_CONTROLS_DECORATIONS) : undefined,
58
54
  resizeHandleRowIndex: undefined,
59
55
  resizeHandleColumnIndex: undefined
60
56
  }
@@ -339,8 +335,8 @@ var setMultipleCellAttrs = exports.setMultipleCellAttrs = function setMultipleCe
339
335
  return function (state, dispatch) {
340
336
  var cursorPos;
341
337
  var tr = state.tr;
342
- var _getPluginState2 = (0, _pluginFactory.getPluginState)(state),
343
- targetCellPosition = _getPluginState2.targetCellPosition;
338
+ var _getPluginState = (0, _pluginFactory.getPluginState)(state),
339
+ targetCellPosition = _getPluginState.targetCellPosition;
344
340
  if ((0, _utils2.isSelectionType)(tr.selection, 'cell')) {
345
341
  // Ignored via go/ees005
346
342
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -501,9 +497,9 @@ var hideInsertColumnOrRowButton = exports.hideInsertColumnOrRowButton = function
501
497
  var addResizeHandleDecorations = exports.addResizeHandleDecorations = function addResizeHandleDecorations(rowIndex, columnIndex, includeTooltip, nodeViewPortalProviderAPI, isKeyboardResize) {
502
498
  return (0, _pluginFactory.createCommand)(function (state) {
503
499
  var tableNode = (0, _utils2.findTable)(state.selection);
504
- var _getPluginState3 = (0, _pluginFactory.getPluginState)(state),
505
- allowColumnResizing = _getPluginState3.pluginConfig.allowColumnResizing,
506
- getIntl = _getPluginState3.getIntl;
500
+ var _getPluginState2 = (0, _pluginFactory.getPluginState)(state),
501
+ allowColumnResizing = _getPluginState2.pluginConfig.allowColumnResizing,
502
+ getIntl = _getPluginState2.getIntl;
507
503
  if (!tableNode || !allowColumnResizing) {
508
504
  return false;
509
505
  }
@@ -527,12 +523,12 @@ var addResizeHandleDecorations = exports.addResizeHandleDecorations = function a
527
523
  var updateResizeHandleDecorations = exports.updateResizeHandleDecorations = function updateResizeHandleDecorations(nodeViewPortalProviderAPI, rowIndex, columnIndex, includeTooltip) {
528
524
  return (0, _pluginFactory.createCommand)(function (state) {
529
525
  var tableNode = (0, _utils2.findTable)(state.selection);
530
- var _getPluginState4 = (0, _pluginFactory.getPluginState)(state),
531
- resizeHandleRowIndex = _getPluginState4.resizeHandleRowIndex,
532
- resizeHandleColumnIndex = _getPluginState4.resizeHandleColumnIndex,
533
- resizeHandleIncludeTooltip = _getPluginState4.resizeHandleIncludeTooltip,
534
- allowColumnResizing = _getPluginState4.pluginConfig.allowColumnResizing,
535
- getIntl = _getPluginState4.getIntl;
526
+ var _getPluginState3 = (0, _pluginFactory.getPluginState)(state),
527
+ resizeHandleRowIndex = _getPluginState3.resizeHandleRowIndex,
528
+ resizeHandleColumnIndex = _getPluginState3.resizeHandleColumnIndex,
529
+ resizeHandleIncludeTooltip = _getPluginState3.resizeHandleIncludeTooltip,
530
+ allowColumnResizing = _getPluginState3.pluginConfig.allowColumnResizing,
531
+ getIntl = _getPluginState3.getIntl;
536
532
  if (!tableNode || !allowColumnResizing) {
537
533
  return false;
538
534
  }
@@ -606,8 +602,8 @@ var addBoldInEmptyHeaderCells = exports.addBoldInEmptyHeaderCells = function add
606
602
  };
607
603
  var updateWidthToWidest = exports.updateWidthToWidest = function updateWidthToWidest(widthToWidest) {
608
604
  return (0, _pluginFactory.createCommand)(function (state) {
609
- var _getPluginState5 = (0, _pluginFactory.getPluginState)(state),
610
- prevWidthToWidest = _getPluginState5.widthToWidest;
605
+ var _getPluginState4 = (0, _pluginFactory.getPluginState)(state),
606
+ prevWidthToWidest = _getPluginState4.widthToWidest;
611
607
  if ((0, _isEqual.default)(widthToWidest, prevWidthToWidest)) {
612
608
  return false;
613
609
  }
@@ -22,8 +22,6 @@ var handleDocOrSelectionChanged = exports.handleDocOrSelectionChanged = function
22
22
  var isResizing = (_tableWidthPluginKey$ = _tableWidth.pluginKey.getState(newState)) === null || _tableWidthPluginKey$ === void 0 ? void 0 : _tableWidthPluginKey$.resizing;
23
23
  var wasResizing = (_tableWidthPluginKey$2 = _tableWidth.pluginKey.getState(oldState)) === null || _tableWidthPluginKey$2 === void 0 ? void 0 : _tableWidthPluginKey$2.resizing;
24
24
  var _ref = _pluginKey.pluginKey.getState(newState) || {},
25
- _ref$isDragAndDropEna = _ref.isDragAndDropEnabled,
26
- isDragAndDropEnabled = _ref$isDragAndDropEna === void 0 ? false : _ref$isDragAndDropEna,
27
25
  isInDanger = _ref.isInDanger,
28
26
  isTableHovered = _ref.isTableHovered;
29
27
  var changedResizing = isResizing !== wasResizing;
@@ -34,10 +32,7 @@ var handleDocOrSelectionChanged = exports.handleDocOrSelectionChanged = function
34
32
  } else if (tr.docChanged || tr.selection instanceof _cellSelection.CellSelection || changedResizing) {
35
33
  return (0, _columnControls.buildColumnControlsDecorations)({
36
34
  decorationSet: decorationSet,
37
- tr: tr,
38
- options: {
39
- isDragAndDropEnabled: isDragAndDropEnabled
40
- }
35
+ tr: tr
41
36
  });
42
37
  } else if (tr.selectionSet) {
43
38
  var _findTable, _findTable2;
@@ -52,10 +47,7 @@ var handleDocOrSelectionChanged = exports.handleDocOrSelectionChanged = function
52
47
  if ((isInDanger || isTableHovered) && (!(0, _coreUtils.insideTable)(newState) || ((_findTable = (0, _utils.findTable)(newState.selection)) === null || _findTable === void 0 ? void 0 : _findTable.node) !== ((_findTable2 = (0, _utils.findTable)(oldState.selection)) === null || _findTable2 === void 0 ? void 0 : _findTable2.node))) {
53
48
  return (0, _columnControls.buildColumnControlsDecorations)({
54
49
  decorationSet: decorationSet,
55
- tr: tr,
56
- options: {
57
- isDragAndDropEnabled: isDragAndDropEnabled
58
- }
50
+ tr: tr
59
51
  });
60
52
  }
61
53
  }
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.maybeUpdateColumnControlsSelectedDecoration = exports.buildColumnControlsDecorations = void 0;
7
7
  var _cellSelection = require("@atlaskit/editor-tables/cell-selection");
8
- var _utils = require("@atlaskit/editor-tables/utils");
9
8
  var _types = require("../../../types");
10
9
  var _decoration = require("../../utils/decoration");
11
10
  var _composeDecorations = require("./compose-decorations");
@@ -28,27 +27,18 @@ var maybeUpdateColumnSelectedDecoration = function maybeUpdateColumnSelectedDeco
28
27
  }
29
28
  return (0, _decoration.updateDecorations)(tr.doc, decorationSet, (0, _decoration.createColumnSelectedDecoration)(tr), _types.TableDecorations.COLUMN_SELECTED);
30
29
  };
31
- var maybeUpdateColumnControlsDecoration = function maybeUpdateColumnControlsDecoration(_ref3) {
32
- var decorationSet = _ref3.decorationSet,
33
- tr = _ref3.tr;
34
- var table = (0, _utils.findTable)(tr.selection);
35
- if (!table) {
36
- return decorationSet;
37
- }
38
- return (0, _decoration.updateDecorations)(tr.doc, decorationSet, (0, _decoration.createColumnControlsDecoration)(tr.selection), _types.TableDecorations.COLUMN_CONTROLS_DECORATIONS);
39
- };
40
30
 
41
31
  // @see: https://product-fabric.atlassian.net/browse/ED-7304
42
- var removeColumnControlsSelectedDecoration = function removeColumnControlsSelectedDecoration(_ref4) {
43
- var decorationSet = _ref4.decorationSet;
32
+ var removeColumnControlsSelectedDecoration = function removeColumnControlsSelectedDecoration(_ref3) {
33
+ var decorationSet = _ref3.decorationSet;
44
34
  return decorationSet.remove((0, _decoration.findColumnControlSelectedDecoration)(decorationSet));
45
35
  };
46
36
  var hasColumnSelectedDecorations = function hasColumnSelectedDecorations(decorationSet) {
47
37
  return !!(0, _decoration.findColumnControlSelectedDecoration)(decorationSet).length;
48
38
  };
49
- var maybeUpdateColumnControlsSelectedDecoration = exports.maybeUpdateColumnControlsSelectedDecoration = function maybeUpdateColumnControlsSelectedDecoration(_ref5) {
50
- var decorationSet = _ref5.decorationSet,
51
- tr = _ref5.tr;
39
+ var maybeUpdateColumnControlsSelectedDecoration = exports.maybeUpdateColumnControlsSelectedDecoration = function maybeUpdateColumnControlsSelectedDecoration(_ref4) {
40
+ var decorationSet = _ref4.decorationSet,
41
+ tr = _ref4.tr;
52
42
  if (!hasColumnSelectedDecorations(decorationSet)) {
53
43
  return decorationSet;
54
44
  }
@@ -57,17 +47,10 @@ var maybeUpdateColumnControlsSelectedDecoration = exports.maybeUpdateColumnContr
57
47
  tr: tr
58
48
  });
59
49
  };
60
- var buildColumnControlsDecorations = exports.buildColumnControlsDecorations = function buildColumnControlsDecorations(_ref6) {
61
- var decorationSet = _ref6.decorationSet,
62
- tr = _ref6.tr,
63
- options = _ref6.options;
64
- if (options.isDragAndDropEnabled) {
65
- return (0, _composeDecorations.composeDecorations)([removeColumnControlsSelectedDecoration, removeControlsHoverDecoration, maybeUpdateColumnSelectedDecoration])({
66
- decorationSet: decorationSet,
67
- tr: tr
68
- });
69
- }
70
- return (0, _composeDecorations.composeDecorations)([removeColumnControlsSelectedDecoration, removeControlsHoverDecoration, maybeUpdateColumnSelectedDecoration, maybeUpdateColumnControlsDecoration])({
50
+ var buildColumnControlsDecorations = exports.buildColumnControlsDecorations = function buildColumnControlsDecorations(_ref5) {
51
+ var decorationSet = _ref5.decorationSet,
52
+ tr = _ref5.tr;
53
+ return (0, _composeDecorations.composeDecorations)([removeColumnControlsSelectedDecoration, removeControlsHoverDecoration, maybeUpdateColumnSelectedDecoration])({
71
54
  decorationSet: decorationSet,
72
55
  tr: tr
73
56
  });
@@ -40,7 +40,7 @@ var createCellHoverDecoration = exports.createCellHoverDecoration = function cre
40
40
  });
41
41
  });
42
42
  };
43
- var createControlsHoverDecoration = exports.createControlsHoverDecoration = function createControlsHoverDecoration(cells, type, tr, isDragAndDropEnable, hoveredIndexes, danger, selected) {
43
+ var createControlsHoverDecoration = exports.createControlsHoverDecoration = function createControlsHoverDecoration(cells, type, tr, hoveredIndexes, danger, selected) {
44
44
  var table = (0, _utils2.findTable)(tr.selection);
45
45
  if (!table) {
46
46
  return [];
@@ -92,13 +92,9 @@ var createControlsHoverDecoration = exports.createControlsHoverDecoration = func
92
92
  if (selected) {
93
93
  classes.push(_types.TableCssClassName.SELECTED_CELL);
94
94
  }
95
- if (isDragAndDropEnable) {
96
- if (type === 'column' || type === 'row') {
97
- classes.pop();
98
- classes.push(_types.TableCssClassName.HOVERED_NO_HIGHLIGHT);
99
- }
100
- } else {
101
- classes.push(type === 'column' ? _types.TableCssClassName.HOVERED_COLUMN : type === 'row' ? _types.TableCssClassName.HOVERED_ROW : _types.TableCssClassName.HOVERED_TABLE);
95
+ if (type === 'column' || type === 'row') {
96
+ classes.pop();
97
+ classes.push(_types.TableCssClassName.HOVERED_NO_HIGHLIGHT);
102
98
  }
103
99
  var key;
104
100
  switch (type) {
@@ -399,7 +395,7 @@ var createResizeHandleDecoration = exports.createResizeHandleDecoration = functi
399
395
  * this function will return two decorations applying a new class `ClassName.WITH_RESIZE_LINE`
400
396
  * only on the cells: `C1` and `D1`.
401
397
  */
402
- var createColumnLineResize = exports.createColumnLineResize = function createColumnLineResize(selection, cellColumnPositioning, isDragAndDropEnabled) {
398
+ var createColumnLineResize = exports.createColumnLineResize = function createColumnLineResize(selection, cellColumnPositioning) {
403
399
  var table = (0, _utils2.findTable)(selection);
404
400
  if (!table || cellColumnPositioning.right === null) {
405
401
  return [];
@@ -410,7 +406,7 @@ var createColumnLineResize = exports.createColumnLineResize = function createCol
410
406
  if (isLastColumn) {
411
407
  columnIndex -= 1;
412
408
  }
413
- var decorationClassName = isDragAndDropEnabled ? isLastColumn ? _types.TableCssClassName.WITH_DRAG_RESIZE_LINE_LAST_COLUMN : _types.TableCssClassName.WITH_DRAG_RESIZE_LINE : isLastColumn ? _types.TableCssClassName.WITH_RESIZE_LINE_LAST_COLUMN : _types.TableCssClassName.WITH_RESIZE_LINE;
409
+ var decorationClassName = isLastColumn ? _types.TableCssClassName.WITH_DRAG_RESIZE_LINE_LAST_COLUMN : _types.TableCssClassName.WITH_DRAG_RESIZE_LINE;
414
410
  var cellPositions = makeArray(map.height).map(function (rowIndex) {
415
411
  return map.map[map.width * rowIndex + columnIndex];
416
412
  }).filter(function (cellPosition, rowIndex) {
@@ -13,11 +13,11 @@ var isAnchorSupported = exports.isAnchorSupported = (0, _memoizeOne.default)(fun
13
13
  }
14
14
  return false;
15
15
  });
16
- var isNativeStickySupported = exports.isNativeStickySupported = function isNativeStickySupported(isDragAndDropEnabled) {
16
+ var isNativeStickySupported = exports.isNativeStickySupported = function isNativeStickySupported() {
17
17
  var safariVersion = (0, _browser.getBrowserInfo)().safari_version;
18
18
  var isBrowserSafari = !Number.isNaN(safariVersion);
19
19
  return (
20
20
  // Safari has a bug with position: sticky and content editable, so we don't support it
21
- !isBrowserSafari && isAnchorSupported() && isDragAndDropEnabled
21
+ !isBrowserSafari && isAnchorSupported()
22
22
  );
23
23
  };
@@ -359,8 +359,7 @@ var tablePlugin = function tablePlugin(_ref) {
359
359
  },
360
360
  eventType: _analytics.EVENT_TYPE.TRACK
361
361
  })(tr);
362
- },
363
- dragAndDropEnabled: true
362
+ }
364
363
  });
365
364
  }
366
365
  }, {
@@ -52,7 +52,6 @@ var FloatingContextualButtonInner = /*#__PURE__*/_react.default.memo(function (p
52
52
  tableWrapper = props.tableWrapper,
53
53
  targetCellPosition = props.targetCellPosition,
54
54
  isCellMenuOpenByKeyboard = props.isCellMenuOpenByKeyboard,
55
- isDragAndDropEnabled = props.isDragAndDropEnabled,
56
55
  formatMessage = props.intl.formatMessage; // : Props & WrappedComponentProps
57
56
 
58
57
  var handleClick = function handleClick() {
@@ -105,7 +104,7 @@ var FloatingContextualButtonInner = /*#__PURE__*/_react.default.memo(function (p
105
104
  }));
106
105
  var parentSticky = targetCellRef.parentElement && targetCellRef.parentElement.className.indexOf('sticky') > -1;
107
106
  var parentStickyNative = targetCellRef.parentElement && ((0, _platformFeatureFlags.fg)('platform_editor_table_sticky_header_patch_4') ? tableWrapper === null || tableWrapper === void 0 ? void 0 : tableWrapper.classList.contains(_types.TableCssClassName.TABLE_NODE_WRAPPER_NO_OVERFLOW) : targetCellRef.parentElement.classList.contains(_types.TableCssClassName.NATIVE_STICKY));
108
- if (parentStickyNative && targetCellRef.nodeName === 'TH' && (0, _stickyHeader.isNativeStickySupported)(isDragAndDropEnabled !== null && isDragAndDropEnabled !== void 0 ? isDragAndDropEnabled : false) && (0, _expValEquals.expValEquals)('platform_editor_table_sticky_header_improvements', 'cohort', 'test_with_overflow')) {
107
+ if (parentStickyNative && targetCellRef.nodeName === 'TH' && (0, _stickyHeader.isNativeStickySupported)() && (0, _expValEquals.expValEquals)('platform_editor_table_sticky_header_improvements', 'cohort', 'test_with_overflow')) {
109
108
  var _targetCellRef$parent;
110
109
  /* We need to default to checking the anchor style because there may be a conflict with the block controls
111
110
  plugin not using the data attribute value and setting the `anchor-name` style property independently of the data attribute.
@@ -10,7 +10,6 @@ var _ui = require("@atlaskit/editor-common/ui");
10
10
  var _utils = require("@atlaskit/editor-prosemirror/utils");
11
11
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
12
12
  var _utils2 = require("@atlaskit/editor-tables/utils");
13
- var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
14
13
  var _pluginFactory = require("../../pm-plugins/plugin-factory");
15
14
  var _consts = require("../consts");
16
15
  var _ContextualMenu = _interopRequireDefault(require("./ContextualMenu"));
@@ -38,24 +37,17 @@ var FloatingContextualMenu = function FloatingContextualMenu(_ref) {
38
37
  isCommentEditor = _ref.isCommentEditor,
39
38
  api = _ref.api,
40
39
  isDragMenuOpen = _ref.isDragMenuOpen;
41
- if ((0, _expValEquals.expValEquals)('platform_editor_hydratable_ui', 'isEnabled', true) && !editorView) {
40
+ if (!editorView) {
42
41
  return null;
43
42
  }
44
43
 
45
44
  // TargetCellPosition could be outdated: https://product-fabric.atlassian.net/browse/ED-8129
46
- // Remove ! during platform_editor_hydratable_ui cleanup
47
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
48
45
  var _getPluginState = (0, _pluginFactory.getPluginState)(editorView.state),
49
46
  targetCellPosition = _getPluginState.targetCellPosition,
50
47
  isDragAndDropEnabled = _getPluginState.isDragAndDropEnabled;
51
- // Remove ! during platform_editor_hydratable_ui cleanup
52
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
53
48
  if (!isOpen || !targetCellPosition || editorView.state.doc.nodeSize <= targetCellPosition) {
54
49
  return null;
55
50
  }
56
-
57
- // Remove ! during platform_editor_hydratable_ui cleanup
58
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
59
51
  var selection = editorView.state.selection;
60
52
  var selectionRect = (0, _utils2.isSelectionType)(selection, 'cell') ?
61
53
  // Ignored via go/ees005
@@ -64,8 +56,6 @@ var FloatingContextualMenu = function FloatingContextualMenu(_ref) {
64
56
  if (!selectionRect) {
65
57
  return null;
66
58
  }
67
- // Remove ! during platform_editor_hydratable_ui cleanup
68
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
69
59
  var domAtPos = editorView.domAtPos.bind(editorView);
70
60
  var targetCellRef = (0, _utils.findDomRefAtPos)(targetCellPosition, domAtPos);
71
61
  if (!targetCellRef) {
@@ -95,10 +85,7 @@ var FloatingContextualMenu = function FloatingContextualMenu(_ref) {
95
85
  stick: true
96
86
  }, (0, _react.jsx)("div", {
97
87
  css: (0, _styles.tablePopupStyles)(isDragAndDropEnabled)
98
- }, (0, _react.jsx)(_ContextualMenu.default
99
- // Remove ! during platform_editor_hydratable_ui cleanup
100
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
101
- , {
88
+ }, (0, _react.jsx)(_ContextualMenu.default, {
102
89
  editorView: editorView
103
90
  // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
104
91
  ,
@@ -84,7 +84,7 @@ var TableFloatingColumnControls = function TableFloatingColumnControls(_ref) {
84
84
  containerRef === null || containerRef === void 0 || (_containerRef$current2 = containerRef.current) === null || _containerRef$current2 === void 0 || _containerRef$current2.style.removeProperty('top');
85
85
  }
86
86
  var anchorStyles = {};
87
- if ((0, _stickyHeader.isNativeStickySupported)(isDragAndDropEnabled !== null && isDragAndDropEnabled !== void 0 ? isDragAndDropEnabled : false) && (0, _expValEquals.expValEquals)('platform_editor_table_sticky_header_improvements', 'cohort', 'test_with_overflow')) {
87
+ if ((0, _stickyHeader.isNativeStickySupported)() && (0, _expValEquals.expValEquals)('platform_editor_table_sticky_header_improvements', 'cohort', 'test_with_overflow')) {
88
88
  var _tableRef$querySelect, _tableRef$querySelect2;
89
89
  var rowAnchorName = (_tableRef$querySelect = tableRef.querySelector('tr')) === null || _tableRef$querySelect === void 0 ? void 0 : _tableRef$querySelect.style.getPropertyValue('anchor-name');
90
90
  // cast here is due to CSSProperties missing valid positionAnchor property
@@ -24,8 +24,7 @@ export const tableHeaderView = options => {
24
24
  };
25
25
  export const tableRowView = options => {
26
26
  return (node, view, getPos) => {
27
- var _options$isDragAndDro;
28
- if (isNativeStickySupported((_options$isDragAndDro = options.isDragAndDropEnabled) !== null && _options$isDragAndDro !== void 0 ? _options$isDragAndDro : false) && expValEquals('platform_editor_table_sticky_header_improvements', 'cohort', 'test_with_overflow')) {
27
+ if (isNativeStickySupported() && expValEquals('platform_editor_table_sticky_header_improvements', 'cohort', 'test_with_overflow')) {
29
28
  return new TableRowNativeStickyWithFallback(node, view, getPos, options.eventDispatcher, options.pluginInjectionApi);
30
29
  } else {
31
30
  return new TableRow(node, view, getPos, options.eventDispatcher, options.pluginInjectionApi);
@@ -24,8 +24,7 @@ const updateResizeHandleAndStatePosition = (rowIndex, columnIndex, nextResizeHan
24
24
  pluginConfig: {
25
25
  allowColumnResizing
26
26
  },
27
- getIntl,
28
- isDragAndDropEnabled
27
+ getIntl
29
28
  } = getPluginState(state);
30
29
  const fakeDispatch = tr => {
31
30
  customTr = tr;
@@ -39,7 +38,7 @@ const updateResizeHandleAndStatePosition = (rowIndex, columnIndex, nextResizeHan
39
38
  });
40
39
  const decorationsWithWidgetAndHandle = updateDecorations(customTr.doc, decorationsWithWidget, createColumnLineResize(state.selection, {
41
40
  right: columnIndex
42
- }, isDragAndDropEnabled), TableDecorations.COLUMN_RESIZING_HANDLE_LINE);
41
+ }), TableDecorations.COLUMN_RESIZING_HANDLE_LINE);
43
42
  getTablePluginCommand({
44
43
  type: 'START_KEYBOARD_COLUMN_RESIZE',
45
44
  data: {
@@ -33,13 +33,10 @@ export const hoverMergedCells = () => createCommand(state => {
33
33
  }, tr => tr.setMeta('addToHistory', false));
34
34
  export const hoverColumns = (hoveredColumns, isInDanger) => createCommand(state => {
35
35
  const cells = getCellsInColumn(hoveredColumns)(state.tr.selection);
36
- const {
37
- isDragAndDropEnabled
38
- } = getPluginState(state);
39
36
  if (!cells) {
40
37
  return false;
41
38
  }
42
- const decorations = createControlsHoverDecoration(cells, 'column', state.tr, isDragAndDropEnabled, hoveredColumns, isInDanger);
39
+ const decorations = createControlsHoverDecoration(cells, 'column', state.tr, hoveredColumns, isInDanger);
43
40
  return {
44
41
  type: 'HOVER_COLUMNS',
45
42
  data: {
@@ -54,10 +51,7 @@ export const hoverRows = (hoveredRows, isInDanger) => createCommand(state => {
54
51
  if (!cells) {
55
52
  return false;
56
53
  }
57
- const {
58
- isDragAndDropEnabled
59
- } = getPluginState(state);
60
- const decorations = createControlsHoverDecoration(cells, 'row', state.tr, isDragAndDropEnabled, hoveredRows, isInDanger);
54
+ const decorations = createControlsHoverDecoration(cells, 'row', state.tr, hoveredRows, isInDanger);
61
55
  return {
62
56
  type: 'HOVER_ROWS',
63
57
  data: {
@@ -79,10 +73,7 @@ export const hoverTable = (isInDanger, isSelected) => createCommand(state => {
79
73
  if (!cells) {
80
74
  return false;
81
75
  }
82
- const {
83
- isDragAndDropEnabled
84
- } = getPluginState(state);
85
- const decorations = createControlsHoverDecoration(cells, 'table', state.tr, isDragAndDropEnabled, [], isInDanger, isSelected);
76
+ const decorations = createControlsHoverDecoration(cells, 'table', state.tr, [], isInDanger, isSelected);
86
77
  return {
87
78
  type: 'HOVER_TABLE',
88
79
  data: {
@@ -103,13 +94,10 @@ export const clearHoverSelection = () => createCommand(state => ({
103
94
  }
104
95
  }));
105
96
  export const showResizeHandleLine = cellColumnPositioning => createCommand(state => {
106
- const {
107
- isDragAndDropEnabled
108
- } = getPluginState(state);
109
97
  return {
110
98
  type: 'SHOW_RESIZE_HANDLE_LINE',
111
99
  data: {
112
- decorationSet: updatePluginStateDecorations(state, createColumnLineResize(state.selection, cellColumnPositioning, isDragAndDropEnabled), TableDecorations.COLUMN_RESIZING_HANDLE_LINE)
100
+ decorationSet: updatePluginStateDecorations(state, createColumnLineResize(state.selection, cellColumnPositioning), TableDecorations.COLUMN_RESIZING_HANDLE_LINE)
113
101
  }
114
102
  };
115
103
  });
@@ -10,7 +10,7 @@ import { getDecorations } from '../decorations/plugin';
10
10
  import { buildColumnResizingDecorations, clearColumnResizingDecorations } from '../decorations/utils/column-resizing';
11
11
  import { createCommand, getPluginState } from '../plugin-factory';
12
12
  import { fixAutoSizedTable } from '../transforms/fix-tables';
13
- import { createColumnControlsDecoration, createColumnSelectedDecoration } from '../utils/decoration';
13
+ import { createColumnSelectedDecoration } from '../utils/decoration';
14
14
  import { checkIfHeaderColumnEnabled, checkIfHeaderRowEnabled, checkIfNumberColumnEnabled, isIsolating } from '../utils/nodes';
15
15
  import { updatePluginStateDecorations } from '../utils/update-plugin-state-decorations';
16
16
  const DARK_MODE_CELL_COLOR = '#1f1f21';
@@ -27,9 +27,6 @@ export const setTableRef = ref => createCommand(state => {
27
27
  const tableNode = ref && foundTable ? foundTable.node : undefined;
28
28
  const tablePos = ref && foundTable ? foundTable.pos : undefined;
29
29
  const tableWrapperTarget = closestElement(tableRef, `.${ClassName.TABLE_NODE_WRAPPER}`) || undefined;
30
- const {
31
- isDragAndDropEnabled
32
- } = getPluginState(state);
33
30
  return {
34
31
  type: 'SET_TABLE_REF',
35
32
  data: {
@@ -40,8 +37,6 @@ export const setTableRef = ref => createCommand(state => {
40
37
  isNumberColumnEnabled: checkIfNumberColumnEnabled(state.selection),
41
38
  isHeaderRowEnabled: checkIfHeaderRowEnabled(state.selection),
42
39
  isHeaderColumnEnabled: checkIfHeaderColumnEnabled(state.selection),
43
- // decoration set is drawn by the decoration plugin, skip this for DnD as all controls are floating
44
- decorationSet: !isDragAndDropEnabled ? updatePluginStateDecorations(state, createColumnControlsDecoration(state.selection), TableDecorations.COLUMN_CONTROLS_DECORATIONS) : undefined,
45
40
  resizeHandleRowIndex: undefined,
46
41
  resizeHandleColumnIndex: undefined
47
42
  }
@@ -14,7 +14,6 @@ export const handleDocOrSelectionChanged = (tr, decorationSet, oldState, newStat
14
14
  const isResizing = (_tableWidthPluginKey$ = tableWidthPluginKey.getState(newState)) === null || _tableWidthPluginKey$ === void 0 ? void 0 : _tableWidthPluginKey$.resizing;
15
15
  const wasResizing = (_tableWidthPluginKey$2 = tableWidthPluginKey.getState(oldState)) === null || _tableWidthPluginKey$2 === void 0 ? void 0 : _tableWidthPluginKey$2.resizing;
16
16
  const {
17
- isDragAndDropEnabled = false,
18
17
  isInDanger,
19
18
  isTableHovered
20
19
  } = tablePluginKey.getState(newState) || {};
@@ -26,10 +25,7 @@ export const handleDocOrSelectionChanged = (tr, decorationSet, oldState, newStat
26
25
  } else if (tr.docChanged || tr.selection instanceof CellSelection || changedResizing) {
27
26
  return buildColumnControlsDecorations({
28
27
  decorationSet,
29
- tr,
30
- options: {
31
- isDragAndDropEnabled
32
- }
28
+ tr
33
29
  });
34
30
  } else if (tr.selectionSet) {
35
31
  var _findTable, _findTable2;
@@ -44,10 +40,7 @@ export const handleDocOrSelectionChanged = (tr, decorationSet, oldState, newStat
44
40
  if ((isInDanger || isTableHovered) && (!insideTable(newState) || ((_findTable = findTable(newState.selection)) === null || _findTable === void 0 ? void 0 : _findTable.node) !== ((_findTable2 = findTable(oldState.selection)) === null || _findTable2 === void 0 ? void 0 : _findTable2.node))) {
45
41
  return buildColumnControlsDecorations({
46
42
  decorationSet,
47
- tr,
48
- options: {
49
- isDragAndDropEnabled
50
- }
43
+ tr
51
44
  });
52
45
  }
53
46
  }
@@ -1,9 +1,8 @@
1
1
  // @ts-ignore -- ReadonlyTransaction is a local declaration and will cause a TS2305 error in CCFE typecheck
2
2
 
3
3
  import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
4
- import { findTable } from '@atlaskit/editor-tables/utils';
5
4
  import { TableDecorations } from '../../../types';
6
- import { createColumnControlsDecoration, createColumnSelectedDecoration, findColumnControlSelectedDecoration, findControlsHoverDecoration, updateDecorations } from '../../utils/decoration';
5
+ import { createColumnSelectedDecoration, findColumnControlSelectedDecoration, findControlsHoverDecoration, updateDecorations } from '../../utils/decoration';
7
6
  import { composeDecorations } from './compose-decorations';
8
7
  const isColumnSelected = tr => tr.selection instanceof CellSelection && tr.selection.isColSelection();
9
8
 
@@ -20,16 +19,6 @@ const maybeUpdateColumnSelectedDecoration = ({
20
19
  }
21
20
  return updateDecorations(tr.doc, decorationSet, createColumnSelectedDecoration(tr), TableDecorations.COLUMN_SELECTED);
22
21
  };
23
- const maybeUpdateColumnControlsDecoration = ({
24
- decorationSet,
25
- tr
26
- }) => {
27
- const table = findTable(tr.selection);
28
- if (!table) {
29
- return decorationSet;
30
- }
31
- return updateDecorations(tr.doc, decorationSet, createColumnControlsDecoration(tr.selection), TableDecorations.COLUMN_CONTROLS_DECORATIONS);
32
- };
33
22
 
34
23
  // @see: https://product-fabric.atlassian.net/browse/ED-7304
35
24
  const removeColumnControlsSelectedDecoration = ({
@@ -50,16 +39,9 @@ export const maybeUpdateColumnControlsSelectedDecoration = ({
50
39
  };
51
40
  export const buildColumnControlsDecorations = ({
52
41
  decorationSet,
53
- tr,
54
- options
42
+ tr
55
43
  }) => {
56
- if (options.isDragAndDropEnabled) {
57
- return composeDecorations([removeColumnControlsSelectedDecoration, removeControlsHoverDecoration, maybeUpdateColumnSelectedDecoration])({
58
- decorationSet,
59
- tr
60
- });
61
- }
62
- return composeDecorations([removeColumnControlsSelectedDecoration, removeControlsHoverDecoration, maybeUpdateColumnSelectedDecoration, maybeUpdateColumnControlsDecoration])({
44
+ return composeDecorations([removeColumnControlsSelectedDecoration, removeControlsHoverDecoration, maybeUpdateColumnSelectedDecoration])({
63
45
  decorationSet,
64
46
  tr
65
47
  });