@atlaskit/editor-plugin-table 7.13.0 → 7.13.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 (74) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/cjs/commands/insert.js +6 -4
  3. package/dist/cjs/commands-with-analytics.js +4 -2
  4. package/dist/cjs/plugin.js +4 -2
  5. package/dist/cjs/pm-plugins/table-resizing/event-handlers.js +10 -3
  6. package/dist/cjs/pm-plugins/table-resizing/utils/index.js +6 -0
  7. package/dist/cjs/pm-plugins/table-resizing/utils/misc.js +8 -1
  8. package/dist/cjs/pm-plugins/table-resizing/utils/resize-column.js +51 -34
  9. package/dist/cjs/ui/FloatingContextualMenu/ContextualMenu.js +11 -7
  10. package/dist/cjs/ui/FloatingContextualMenu/index.js +4 -2
  11. package/dist/cjs/ui/FloatingDragMenu/DragMenu.js +3 -2
  12. package/dist/cjs/ui/FloatingDragMenu/index.js +7 -2
  13. package/dist/cjs/ui/FloatingInsertButton/index.js +10 -4
  14. package/dist/cjs/utils/drag-menu.js +3 -2
  15. package/dist/es2019/commands/insert.js +6 -6
  16. package/dist/es2019/commands-with-analytics.js +4 -4
  17. package/dist/es2019/plugin.js +4 -2
  18. package/dist/es2019/pm-plugins/table-resizing/event-handlers.js +11 -4
  19. package/dist/es2019/pm-plugins/table-resizing/utils/index.js +1 -1
  20. package/dist/es2019/pm-plugins/table-resizing/utils/misc.js +7 -0
  21. package/dist/es2019/pm-plugins/table-resizing/utils/resize-column.js +49 -34
  22. package/dist/es2019/ui/FloatingContextualMenu/ContextualMenu.js +7 -3
  23. package/dist/es2019/ui/FloatingContextualMenu/index.js +4 -2
  24. package/dist/es2019/ui/FloatingDragMenu/DragMenu.js +3 -2
  25. package/dist/es2019/ui/FloatingDragMenu/index.js +7 -2
  26. package/dist/es2019/ui/FloatingInsertButton/index.js +10 -4
  27. package/dist/es2019/utils/drag-menu.js +3 -3
  28. package/dist/esm/commands/insert.js +6 -4
  29. package/dist/esm/commands-with-analytics.js +4 -2
  30. package/dist/esm/plugin.js +4 -2
  31. package/dist/esm/pm-plugins/table-resizing/event-handlers.js +11 -4
  32. package/dist/esm/pm-plugins/table-resizing/utils/index.js +1 -1
  33. package/dist/esm/pm-plugins/table-resizing/utils/misc.js +7 -0
  34. package/dist/esm/pm-plugins/table-resizing/utils/resize-column.js +50 -33
  35. package/dist/esm/ui/FloatingContextualMenu/ContextualMenu.js +11 -7
  36. package/dist/esm/ui/FloatingContextualMenu/index.js +4 -2
  37. package/dist/esm/ui/FloatingDragMenu/DragMenu.js +3 -2
  38. package/dist/esm/ui/FloatingDragMenu/index.js +7 -2
  39. package/dist/esm/ui/FloatingInsertButton/index.js +10 -4
  40. package/dist/esm/utils/drag-menu.js +3 -2
  41. package/dist/types/commands/insert.d.ts +3 -3
  42. package/dist/types/commands-with-analytics.d.ts +2 -2
  43. package/dist/types/pm-plugins/table-resizing/utils/index.d.ts +1 -1
  44. package/dist/types/pm-plugins/table-resizing/utils/misc.d.ts +1 -0
  45. package/dist/types/pm-plugins/table-resizing/utils/resize-column.d.ts +1 -0
  46. package/dist/types/ui/FloatingContextualMenu/index.d.ts +1 -1
  47. package/dist/types/ui/FloatingDragMenu/DragMenu.d.ts +2 -1
  48. package/dist/types/ui/FloatingDragMenu/index.d.ts +3 -2
  49. package/dist/types/ui/FloatingInsertButton/index.d.ts +2 -1
  50. package/dist/types/utils/drag-menu.d.ts +1 -1
  51. package/dist/types-ts4.5/commands/insert.d.ts +3 -3
  52. package/dist/types-ts4.5/commands-with-analytics.d.ts +2 -2
  53. package/dist/types-ts4.5/pm-plugins/table-resizing/utils/index.d.ts +1 -1
  54. package/dist/types-ts4.5/pm-plugins/table-resizing/utils/misc.d.ts +1 -0
  55. package/dist/types-ts4.5/pm-plugins/table-resizing/utils/resize-column.d.ts +1 -0
  56. package/dist/types-ts4.5/ui/FloatingContextualMenu/index.d.ts +1 -1
  57. package/dist/types-ts4.5/ui/FloatingDragMenu/DragMenu.d.ts +2 -1
  58. package/dist/types-ts4.5/ui/FloatingDragMenu/index.d.ts +3 -2
  59. package/dist/types-ts4.5/ui/FloatingInsertButton/index.d.ts +2 -1
  60. package/dist/types-ts4.5/utils/drag-menu.d.ts +1 -1
  61. package/package.json +2 -2
  62. package/src/commands/insert.ts +16 -6
  63. package/src/commands-with-analytics.ts +13 -3
  64. package/src/plugin.tsx +8 -0
  65. package/src/pm-plugins/table-resizing/event-handlers.ts +43 -21
  66. package/src/pm-plugins/table-resizing/utils/index.ts +1 -1
  67. package/src/pm-plugins/table-resizing/utils/misc.ts +11 -0
  68. package/src/pm-plugins/table-resizing/utils/resize-column.ts +85 -65
  69. package/src/ui/FloatingContextualMenu/ContextualMenu.tsx +21 -8
  70. package/src/ui/FloatingContextualMenu/index.tsx +2 -0
  71. package/src/ui/FloatingDragMenu/DragMenu.tsx +3 -0
  72. package/src/ui/FloatingDragMenu/index.tsx +11 -1
  73. package/src/ui/FloatingInsertButton/index.tsx +38 -11
  74. package/src/utils/drag-menu.ts +17 -11
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @atlaskit/editor-plugin-table
2
2
 
3
+ ## 7.13.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#97570](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/97570)
8
+ [`d53d6981c3ce`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/d53d6981c3ce) -
9
+ Clean up resizing logic and stop growing table container when overflowed
10
+
11
+ ## 7.13.1
12
+
13
+ ### Patch Changes
14
+
15
+ - [#94829](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/94829)
16
+ [`815fda434fe7`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/815fda434fe7) -
17
+ [ED-22849] Align add column and row behaviour behind
18
+ platform_editor_table_duplicate_cell_colouring flag so that adding a column will copy cell
19
+ background from the left and adding a row will copy background colour from row above
20
+
3
21
  ## 7.13.0
4
22
 
5
23
  ### Minor Changes
@@ -30,6 +30,7 @@ function addColumnAtCustomStep(column) {
30
30
  }
31
31
  function addColumnAt() {
32
32
  var isTableScalingEnabled = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
33
+ var isCellBackgroundDuplicated = arguments.length > 1 ? arguments[1] : undefined;
33
34
  return function (column) {
34
35
  var allowAddColumnCustomStep = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
35
36
  var view = arguments.length > 2 ? arguments[2] : undefined;
@@ -38,7 +39,7 @@ function addColumnAt() {
38
39
  if (allowAddColumnCustomStep) {
39
40
  updatedTr = addColumnAtCustomStep(column)(updatedTr);
40
41
  } else {
41
- updatedTr = (0, _utils2.addColumnAt)(column)(updatedTr);
42
+ updatedTr = (0, _utils2.addColumnAt)(column, isCellBackgroundDuplicated)(updatedTr);
42
43
  }
43
44
  var table = (0, _utils2.findTable)(updatedTr.selection);
44
45
  if (table) {
@@ -92,9 +93,10 @@ var addColumnAfter = exports.addColumnAfter = function addColumnAfter(isTableSca
92
93
  };
93
94
  var insertColumn = exports.insertColumn = function insertColumn() {
94
95
  var isTableScalingEnabled = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
96
+ var isCellBackgroundDuplicated = arguments.length > 1 ? arguments[1] : undefined;
95
97
  return function (column) {
96
98
  return function (state, dispatch, view) {
97
- var tr = addColumnAt(isTableScalingEnabled)(column, (0, _getAllowAddColumnCustomStep.getAllowAddColumnCustomStep)(state), view)(state.tr);
99
+ var tr = addColumnAt(isTableScalingEnabled, isCellBackgroundDuplicated)(column, (0, _getAllowAddColumnCustomStep.getAllowAddColumnCustomStep)(state), view)(state.tr);
98
100
  var table = (0, _utils2.findTable)(tr.selection);
99
101
  if (!table) {
100
102
  return false;
@@ -108,7 +110,7 @@ var insertColumn = exports.insertColumn = function insertColumn() {
108
110
  };
109
111
  };
110
112
  };
111
- var insertRow = exports.insertRow = function insertRow(row, moveCursorToTheNewRow) {
113
+ var insertRow = exports.insertRow = function insertRow(row, moveCursorToTheNewRow, isCellBackgroundDuplicated) {
112
114
  return function (state, dispatch) {
113
115
  // Don't clone the header row
114
116
  var headerRowEnabled = (0, _utils3.checkIfHeaderRowEnabled)(state.selection);
@@ -119,7 +121,7 @@ var insertRow = exports.insertRow = function insertRow(row, moveCursorToTheNewRo
119
121
  if (row === 0 && headerRowEnabled) {
120
122
  return false;
121
123
  }
122
- var tr = clonePreviousRow ? (0, _utils3.copyPreviousRow)(state.schema)(row)(state.tr) : (0, _utils2.addRowAt)(row)(state.tr);
124
+ var tr = clonePreviousRow ? (0, _utils3.copyPreviousRow)(state.schema)(row)(state.tr) : (0, _utils2.addRowAt)(row, undefined, isCellBackgroundDuplicated)(state.tr);
123
125
  var table = (0, _utils2.findTable)(tr.selection);
124
126
  if (!table) {
125
127
  return false;
@@ -172,6 +172,7 @@ var addRowAroundSelection = exports.addRowAroundSelection = function addRowAroun
172
172
  };
173
173
  };
174
174
  var insertRowWithAnalytics = exports.insertRowWithAnalytics = function insertRowWithAnalytics(editorAnalyticsAPI) {
175
+ var isCellbackgroundDuplicated = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
175
176
  return function (inputMethod, options) {
176
177
  return (0, _analytics2.withEditorAnalyticsAPI)(function (state) {
177
178
  var _getSelectedTableInfo = (0, _utils2.getSelectedTableInfo)(state.selection),
@@ -189,7 +190,7 @@ var insertRowWithAnalytics = exports.insertRowWithAnalytics = function insertRow
189
190
  },
190
191
  eventType: _analytics.EVENT_TYPE.TRACK
191
192
  };
192
- })(editorAnalyticsAPI)((0, _insert.insertRow)(options.index, options.moveCursorToInsertedRow));
193
+ })(editorAnalyticsAPI)((0, _insert.insertRow)(options.index, options.moveCursorToInsertedRow, isCellbackgroundDuplicated));
193
194
  };
194
195
  };
195
196
  var changeColumnWidthByStepWithAnalytics = exports.changeColumnWidthByStepWithAnalytics = function changeColumnWidthByStepWithAnalytics(editorAnalyticsAPI) {
@@ -226,6 +227,7 @@ var changeColumnWidthByStepWithAnalytics = exports.changeColumnWidthByStepWithAn
226
227
  };
227
228
  var insertColumnWithAnalytics = exports.insertColumnWithAnalytics = function insertColumnWithAnalytics(editorAnalyticsAPI) {
228
229
  var isTableScalingEnabled = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
230
+ var isCellbackgroundDuplicated = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
229
231
  return function (inputMethod, position) {
230
232
  return (0, _analytics2.withEditorAnalyticsAPI)(function (state) {
231
233
  var _getSelectedTableInfo3 = (0, _utils2.getSelectedTableInfo)(state.selection),
@@ -243,7 +245,7 @@ var insertColumnWithAnalytics = exports.insertColumnWithAnalytics = function ins
243
245
  },
244
246
  eventType: _analytics.EVENT_TYPE.TRACK
245
247
  };
246
- })(editorAnalyticsAPI)((0, _insert.insertColumn)(isTableScalingEnabled)(position));
248
+ })(editorAnalyticsAPI)((0, _insert.insertColumn)(isTableScalingEnabled, isCellbackgroundDuplicated)(position));
247
249
  };
248
250
  };
249
251
  var deleteRowsWithAnalytics = exports.deleteRowsWithAnalytics = function deleteRowsWithAnalytics(editorAnalyticsAPI) {
@@ -368,7 +368,8 @@ var tablesPlugin = function tablesPlugin(_ref) {
368
368
  hasStickyHeaders: stickyHeader && stickyHeader.sticky,
369
369
  dispatchAnalyticsEvent: dispatchAnalyticsEvent,
370
370
  editorAnalyticsAPI: editorAnalyticsAPI,
371
- getEditorContainerWidth: defaultGetEditorContainerWidth
371
+ getEditorContainerWidth: defaultGetEditorContainerWidth,
372
+ getEditorFeatureFlags: (options === null || options === void 0 ? void 0 : options.getEditorFeatureFlags) || defaultGetEditorFeatureFlags
372
373
  }), (options === null || options === void 0 ? void 0 : options.allowContextualMenu) && /*#__PURE__*/_react.default.createElement(_FloatingContextualMenu.default, {
373
374
  editorView: editorView,
374
375
  mountPoint: popupsMountPoint,
@@ -393,7 +394,8 @@ var tablesPlugin = function tablesPlugin(_ref) {
393
394
  editorAnalyticsAPI: editorAnalyticsAPI,
394
395
  stickyHeaders: stickyHeader,
395
396
  pluginConfig: pluginConfig,
396
- isTableScalingEnabled: options === null || options === void 0 ? void 0 : options.isTableScalingEnabled
397
+ isTableScalingEnabled: options === null || options === void 0 ? void 0 : options.isTableScalingEnabled,
398
+ getEditorFeatureFlags: (options === null || options === void 0 ? void 0 : options.getEditorFeatureFlags) || defaultGetEditorFeatureFlags
397
399
  }), allowControls && !isDragAndDropEnabled && !isResizing && /*#__PURE__*/_react.default.createElement(_FloatingDeleteButton.default, {
398
400
  editorView: editorView,
399
401
  selection: editorView.state.selection,
@@ -141,11 +141,14 @@ var handleMouseDown = exports.handleMouseDown = function handleMouseDown(view, e
141
141
  if (isTableScalingEnabled && (0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.preserve-widths-with-lock-button')) {
142
142
  _shouldScale = _shouldScale && originalTable.attrs.displayMode !== 'fixed';
143
143
  }
144
- var newResizeState = (0, _utils3.resizeColumn)(resizeState, colIndex, clientX - startX, dom, originalTable, resizingSelectedColumns ? selectedColumns : undefined, _shouldScale);
145
144
  var resizedDelta = clientX - startX;
146
- tr = (0, _transforms.updateColumnWidths)(newResizeState, table, start)(tr);
147
145
  if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.colum-resizing-improvements')) {
146
+ var newResizeState = (0, _utils3.resizeColumnAndTable)(resizeState, colIndex, clientX - startX, dom, originalTable, resizingSelectedColumns ? selectedColumns : undefined, _shouldScale);
147
+ tr = (0, _transforms.updateColumnWidths)(newResizeState, table, start)(tr);
148
148
  tr.setNodeAttribute(start - 1, 'width', newResizeState.tableWidth);
149
+ } else {
150
+ var _newResizeState = (0, _utils3.resizeColumn)(resizeState, colIndex, clientX - startX, dom, originalTable, resizingSelectedColumns ? selectedColumns : undefined, _shouldScale);
151
+ tr = (0, _transforms.updateColumnWidths)(_newResizeState, table, start)(tr);
149
152
  }
150
153
  if (colIndex === map.width - 1) {
151
154
  var mouseUpTime = event.timeStamp;
@@ -215,7 +218,11 @@ var handleMouseDown = exports.handleMouseDown = function handleMouseDown(view, e
215
218
  if (isTableScalingEnabled && (0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.preserve-widths-with-lock-button')) {
216
219
  shouldScale = shouldScale && originalTable.attrs.displayMode !== 'fixed';
217
220
  }
218
- (0, _utils3.resizeColumn)(resizeState, colIndex, clientX - dragging.startX, dom, table, undefined, shouldScale);
221
+ if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.colum-resizing-improvements')) {
222
+ (0, _utils3.resizeColumnAndTable)(resizeState, colIndex, clientX - dragging.startX, dom, table, undefined, shouldScale);
223
+ } else {
224
+ (0, _utils3.resizeColumn)(resizeState, colIndex, clientX - dragging.startX, dom, table, undefined, shouldScale);
225
+ }
219
226
  (0, _utils3.updateControls)()(state);
220
227
  }
221
228
  window.addEventListener('mouseup', finish);
@@ -207,6 +207,12 @@ Object.defineProperty(exports, "resizeColumn", {
207
207
  return _resizeColumn.resizeColumn;
208
208
  }
209
209
  });
210
+ Object.defineProperty(exports, "resizeColumnAndTable", {
211
+ enumerable: true,
212
+ get: function get() {
213
+ return _resizeColumn.resizeColumnAndTable;
214
+ }
215
+ });
210
216
  Object.defineProperty(exports, "scale", {
211
217
  enumerable: true,
212
218
  get: function get() {
@@ -7,7 +7,7 @@ exports.currentColWidth = currentColWidth;
7
7
  exports.domCellAround = domCellAround;
8
8
  exports.getDefaultLayoutMaxWidth = getDefaultLayoutMaxWidth;
9
9
  exports.getLayoutSize = getLayoutSize;
10
- exports.getTableScalingPercent = exports.getTableMaxWidth = exports.getTableElementWidth = exports.getTableContainerElementWidth = void 0;
10
+ exports.getTableScalingPercent = exports.getTableMaxWidth = exports.getTableElementWidth = exports.getTableContainerElementWidth = exports.getStaticTableScalingPercent = void 0;
11
11
  exports.pointsAtCell = pointsAtCell;
12
12
  var _nodeWidth = require("@atlaskit/editor-common/node-width");
13
13
  var _styles = require("@atlaskit/editor-common/styles");
@@ -108,4 +108,11 @@ var getTableScalingPercent = exports.getTableScalingPercent = function getTableS
108
108
  var scalePercent = (renderWidth - 1) / tableWidth;
109
109
  scalePercent = Math.max(scalePercent, 1 - _consts.MAX_SCALING_PERCENT);
110
110
  return Math.min(scalePercent, 1);
111
+ };
112
+ var getStaticTableScalingPercent = exports.getStaticTableScalingPercent = function getStaticTableScalingPercent(table, tableRenderWidth) {
113
+ var tableWidth = getTableContainerElementWidth(table);
114
+ // minus 1 here to avoid any 1px scroll in Firefox
115
+ var scalePercent = (tableRenderWidth - 1) / tableWidth;
116
+ scalePercent = Math.max(scalePercent, 1 - _consts.MAX_SCALING_PERCENT);
117
+ return Math.min(scalePercent, 1);
111
118
  };
@@ -4,9 +4,8 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.resizeColumn = void 0;
7
+ exports.resizeColumnAndTable = exports.resizeColumn = void 0;
8
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
10
9
  var _types = require("../../../types");
11
10
  var _misc = require("./misc");
12
11
  var _resizeLogic = require("./resize-logic");
@@ -15,47 +14,65 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
15
14
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } // Resize a given column by an amount from the current state
16
15
  var resizeColumn = exports.resizeColumn = function resizeColumn(resizeState, colIndex, amount, tableRef, tableNode, selectedColumns) {
17
16
  var isTableScalingEnabled = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
18
- // If table resize to show overflowed content, we need to re calculate the resize amount because now offset = amount amount instead of amount * 2
19
17
  var scalePercent = 1;
20
- var resizeAmount;
21
- if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.colum-resizing-improvements')) {
22
- var _tableRef$closest;
23
- // when table initially not overflow, but enter overflow, we need to calculate the resize amount by two part, before and after overflow, before overflow should be double, after should not be double.
24
- var tableWidth = tableRef === null || tableRef === void 0 ? void 0 : tableRef.clientWidth;
25
- var tableContainerWidth = tableRef === null || tableRef === void 0 || (_tableRef$closest = tableRef.closest('.resizer-item')) === null || _tableRef$closest === void 0 ? void 0 : _tableRef$closest.clientWidth;
26
- var isOverflowed = !!(tableWidth && tableContainerWidth && tableWidth > tableContainerWidth);
27
- resizeAmount = amount * 2;
28
- if (isOverflowed) {
29
- resizeAmount = amount < 0 ? amount : resizeAmount - (tableNode.attrs.width + resizeAmount - tableContainerWidth) / 2;
30
- } else {
31
- resizeAmount = amount > 0 && tableContainerWidth ? resizeAmount - (tableNode.attrs.width + resizeAmount - tableContainerWidth) / 2 : resizeAmount;
32
- }
33
- } else {
34
- resizeAmount = amount;
35
- }
36
-
37
- // This need to be clean up if clean up the FF, we will not need this scale logic because now full table width changed/updated in resizeColumn
38
- if (isTableScalingEnabled && !(0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.colum-resizing-improvements')) {
18
+ var resizeAmount = amount;
19
+ if (isTableScalingEnabled) {
39
20
  scalePercent = (0, _misc.getTableScalingPercent)(tableNode, tableRef);
40
21
  resizeAmount = amount / scalePercent;
41
22
  }
42
- var newState = (0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.colum-resizing-improvements') ? (0, _resizeLogic.updateAffectedColumn)(resizeState, colIndex, resizeAmount) : resizeAmount > 0 ? (0, _resizeLogic.growColumn)(resizeState, colIndex, resizeAmount, selectedColumns) : resizeAmount < 0 ? (0, _resizeLogic.shrinkColumn)(resizeState, colIndex, resizeAmount, selectedColumns) : resizeState;
43
- (0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.colum-resizing-improvements') ? (0, _resizeState.updateColgroup)(newState, tableRef, tableNode, false) : (0, _resizeState.updateColgroup)(newState, tableRef, tableNode, isTableScalingEnabled);
44
- if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.colum-resizing-improvements')) {
45
- // use the difference in width from affected column to update overall table width
46
- var delta = newState.cols[colIndex].width - resizeState.cols[colIndex].width;
47
- updateTable(delta, tableRef, tableNode);
48
- return _objectSpread(_objectSpread({}, newState), {}, {
49
- tableWidth: resizeState.tableWidth + delta
50
- });
51
- }
23
+ var newState = resizeAmount > 0 ? (0, _resizeLogic.growColumn)(resizeState, colIndex, resizeAmount, selectedColumns) : resizeAmount < 0 ? (0, _resizeLogic.shrinkColumn)(resizeState, colIndex, resizeAmount, selectedColumns) : resizeState;
24
+ (0, _resizeState.updateColgroup)(newState, tableRef, tableNode, isTableScalingEnabled);
52
25
  return newState;
53
26
  };
54
- var updateTable = function updateTable(resizeAmount, tableRef, tableNode) {
27
+
28
+ // try not scale table during resize
29
+ var resizeColumnAndTable = exports.resizeColumnAndTable = function resizeColumnAndTable(resizeState, colIndex, amount, tableRef, tableNode, selectedColumns) {
30
+ var _tableRef$closest;
31
+ var isTableScalingEnabled = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
32
+ var originalTableWidth = arguments.length > 7 ? arguments[7] : undefined;
33
+ // TODO: can we use document state, and apply scaling factor?
34
+ var tableWidth = tableRef.clientWidth;
35
+ var tableContainerWidth = (_tableRef$closest = tableRef.closest('.pm-table-container')) === null || _tableRef$closest === void 0 ? void 0 : _tableRef$closest.clientWidth;
36
+ var isOverflowed = !!(tableWidth && tableContainerWidth && tableWidth > tableContainerWidth);
37
+ var resizeAmount = amount * 2;
38
+
39
+ // todo: reimplement - use getTableScalingPercentFrozen to get scaled percent before table width changes dynamically
40
+ // let scalePercent = 1;
41
+ // if (isTableScalingEnabled) {
42
+ // import from ./misc
43
+ // scalePercent = getStaticTableScalingPercent(
44
+ // tableNode,
45
+ // originalTableWidth || resizeState.maxSize,
46
+ // );
47
+ // resizeAmount = amount / scalePercent;
48
+ // }
49
+
50
+ // need to look at the resize amount and try to adjust the colgroups
51
+ if (isOverflowed) {
52
+ resizeAmount = amount < 0 ? amount : resizeAmount - (tableNode.attrs.width + resizeAmount - tableContainerWidth) / 2;
53
+ } else {
54
+ resizeAmount = amount > 0 && tableContainerWidth ? resizeAmount - (tableNode.attrs.width + resizeAmount - tableContainerWidth) / 2 : resizeAmount;
55
+ }
56
+ var newState = (0, _resizeLogic.updateAffectedColumn)(resizeState, colIndex, resizeAmount);
57
+
58
+ // this function only updates the colgroup in DOM, it reverses the scalePercent
59
+ // todo: change isScalingEnabled to true when reimplementing scaling
60
+ (0, _resizeState.updateColgroup)(newState, tableRef, tableNode, false);
61
+
62
+ // use the difference in width from affected column to update overall table width
63
+ var delta = newState.cols[colIndex].width - resizeState.cols[colIndex].width;
64
+ if (!isOverflowed) {
65
+ updateTablePreview(delta, tableRef, tableNode);
66
+ }
67
+ return _objectSpread(_objectSpread({}, newState), {}, {
68
+ tableWidth: isOverflowed ? tableContainerWidth : resizeState.tableWidth + delta
69
+ });
70
+ };
71
+ var updateTablePreview = function updateTablePreview(resizeAmount, tableRef, tableNode) {
55
72
  var currentWidth = (0, _misc.getTableContainerElementWidth)(tableNode);
56
73
  var resizingContainer = tableRef === null || tableRef === void 0 ? void 0 : tableRef.closest(".".concat(_types.TableCssClassName.TABLE_RESIZER_CONTAINER));
57
74
  var resizingItem = resizingContainer === null || resizingContainer === void 0 ? void 0 : resizingContainer.querySelector('.resizer-item');
58
- if (resizingContainer && resizingItem) {
75
+ if (resizingItem) {
59
76
  var newWidth = "".concat(currentWidth + resizeAmount, "px");
60
77
  if (tableRef) {
61
78
  tableRef.style.width = newWidth;
@@ -370,7 +370,8 @@ var ContextualMenu = exports.ContextualMenu = /*#__PURE__*/function (_Component)
370
370
  editorView = _this$props10.editorView,
371
371
  selectionRect = _this$props10.selectionRect,
372
372
  editorAnalyticsAPI = _this$props10.editorAnalyticsAPI,
373
- getEditorContainerWidth = _this$props10.getEditorContainerWidth;
373
+ getEditorContainerWidth = _this$props10.getEditorContainerWidth,
374
+ getEditorFeatureFlags = _this$props10.getEditorFeatureFlags;
374
375
  // TargetCellPosition could be outdated: https://product-fabric.atlassian.net/browse/ED-8129
375
376
  var state = editorView.state,
376
377
  dispatch = editorView.dispatch;
@@ -378,6 +379,9 @@ var ContextualMenu = exports.ContextualMenu = /*#__PURE__*/function (_Component)
378
379
  targetCellPosition = _getPluginState11.targetCellPosition,
379
380
  _getPluginState11$isT = _getPluginState11.isTableScalingEnabled,
380
381
  isTableScalingEnabled = _getPluginState11$isT === void 0 ? false : _getPluginState11$isT;
382
+ var _ref2 = getEditorFeatureFlags ? getEditorFeatureFlags() : {},
383
+ _ref2$tableDuplicateC = _ref2.tableDuplicateCellColouring,
384
+ tableDuplicateCellColouring = _ref2$tableDuplicateC === void 0 ? false : _ref2$tableDuplicateC;
381
385
  switch (item.value.name) {
382
386
  case 'sort_column_desc':
383
387
  (0, _commandsWithAnalytics.sortColumnWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.CONTEXT_MENU, selectionRect.left, _customSteps.TableSortOrder.DESC)(state, dispatch);
@@ -407,11 +411,11 @@ var ContextualMenu = exports.ContextualMenu = /*#__PURE__*/function (_Component)
407
411
  _this.toggleOpen();
408
412
  break;
409
413
  case 'insert_column':
410
- (0, _commandsWithAnalytics.insertColumnWithAnalytics)(editorAnalyticsAPI, isTableScalingEnabled)(_analytics.INPUT_METHOD.CONTEXT_MENU, selectionRect.right)(state, dispatch, editorView);
414
+ (0, _commandsWithAnalytics.insertColumnWithAnalytics)(editorAnalyticsAPI, isTableScalingEnabled, tableDuplicateCellColouring)(_analytics.INPUT_METHOD.CONTEXT_MENU, selectionRect.right)(state, dispatch, editorView);
411
415
  _this.toggleOpen();
412
416
  break;
413
417
  case 'insert_row':
414
- (0, _commandsWithAnalytics.insertRowWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.CONTEXT_MENU, {
418
+ (0, _commandsWithAnalytics.insertRowWithAnalytics)(editorAnalyticsAPI, tableDuplicateCellColouring)(_analytics.INPUT_METHOD.CONTEXT_MENU, {
415
419
  index: selectionRect.bottom,
416
420
  moveCursorToInsertedRow: true
417
421
  })(state, dispatch);
@@ -451,8 +455,8 @@ var ContextualMenu = exports.ContextualMenu = /*#__PURE__*/function (_Component)
451
455
  isSubmenuOpen: false
452
456
  });
453
457
  });
454
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleItemMouseEnter", function (_ref2) {
455
- var item = _ref2.item;
458
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleItemMouseEnter", function (_ref3) {
459
+ var item = _ref3.item;
456
460
  var _this$props12 = _this.props,
457
461
  _this$props12$editorV = _this$props12.editorView,
458
462
  state = _this$props12$editorV.state,
@@ -475,8 +479,8 @@ var ContextualMenu = exports.ContextualMenu = /*#__PURE__*/function (_Component)
475
479
  (0, _commands.hoverMergedCells)()(state, dispatch);
476
480
  }
477
481
  });
478
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleItemMouseLeave", function (_ref3) {
479
- var item = _ref3.item;
482
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleItemMouseLeave", function (_ref4) {
483
+ var item = _ref4.item;
480
484
  var _this$props$editorVie2 = _this.props.editorView,
481
485
  state = _this$props$editorVie2.state,
482
486
  dispatch = _this$props$editorVie2.dispatch;
@@ -24,7 +24,8 @@ var FloatingContextualMenu = function FloatingContextualMenu(_ref) {
24
24
  isOpen = _ref.isOpen,
25
25
  pluginConfig = _ref.pluginConfig,
26
26
  editorAnalyticsAPI = _ref.editorAnalyticsAPI,
27
- getEditorContainerWidth = _ref.getEditorContainerWidth;
27
+ getEditorContainerWidth = _ref.getEditorContainerWidth,
28
+ getEditorFeatureFlags = _ref.getEditorFeatureFlags;
28
29
  // TargetCellPosition could be outdated: https://product-fabric.atlassian.net/browse/ED-8129
29
30
  var _getPluginState = (0, _pluginFactory.getPluginState)(editorView.state),
30
31
  targetCellPosition = _getPluginState.targetCellPosition,
@@ -72,7 +73,8 @@ var FloatingContextualMenu = function FloatingContextualMenu(_ref) {
72
73
  selectionRect: selectionRect,
73
74
  boundariesElement: boundariesElement,
74
75
  editorAnalyticsAPI: editorAnalyticsAPI,
75
- getEditorContainerWidth: getEditorContainerWidth
76
+ getEditorContainerWidth: getEditorContainerWidth,
77
+ getEditorFeatureFlags: getEditorFeatureFlags
76
78
  })));
77
79
  };
78
80
  FloatingContextualMenu.displayName = 'FloatingContextualMenu';
@@ -191,7 +191,8 @@ var DragMenu = exports.DragMenu = /*#__PURE__*/_react.default.memo(function (_re
191
191
  mountPoint = _ref.mountPoint,
192
192
  scrollableElement = _ref.scrollableElement,
193
193
  boundariesElement = _ref.boundariesElement,
194
- isTableScalingEnabled = _ref.isTableScalingEnabled;
194
+ isTableScalingEnabled = _ref.isTableScalingEnabled,
195
+ tableDuplicateCellColouring = _ref.tableDuplicateCellColouring;
195
196
  var state = editorView.state,
196
197
  dispatch = editorView.dispatch;
197
198
  var selection = state.selection;
@@ -215,7 +216,7 @@ var DragMenu = exports.DragMenu = /*#__PURE__*/_react.default.memo(function (_re
215
216
  hasMergedCellsInTable = (0, _utils3.getMergedCellsPositions)(state.tr).length > 0;
216
217
  }
217
218
  var allowBackgroundColor = (_pluginConfig$allowBa = pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.allowBackgroundColor) !== null && _pluginConfig$allowBa !== void 0 ? _pluginConfig$allowBa : false;
218
- var dragMenuConfig = (0, _dragMenu.getDragMenuConfig)(direction, getEditorContainerWidth, !shouldMoveDisabled, hasMergedCellsInTable, editorView, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI, pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.isHeaderRowRequired, isTableScalingEnabled);
219
+ var dragMenuConfig = (0, _dragMenu.getDragMenuConfig)(direction, getEditorContainerWidth, !shouldMoveDisabled, hasMergedCellsInTable, editorView, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI, pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.isHeaderRowRequired, isTableScalingEnabled, tableDuplicateCellColouring);
219
220
  var _convertToDropdownIte = convertToDropdownItems(dragMenuConfig, formatMessage, selectionRect),
220
221
  menuItems = _convertToDropdownIte.menuItems,
221
222
  menuCallback = _convertToDropdownIte.menuCallback;
@@ -25,7 +25,8 @@ var FloatingDragMenu = function FloatingDragMenu(_ref) {
25
25
  editorAnalyticsAPI = _ref.editorAnalyticsAPI,
26
26
  stickyHeaders = _ref.stickyHeaders,
27
27
  pluginConfig = _ref.pluginConfig,
28
- isTableScalingEnabled = _ref.isTableScalingEnabled;
28
+ isTableScalingEnabled = _ref.isTableScalingEnabled,
29
+ getEditorFeatureFlags = _ref.getEditorFeatureFlags;
29
30
  if (!isOpen || !targetCellPosition || editorView.state.doc.nodeSize <= targetCellPosition) {
30
31
  return null;
31
32
  }
@@ -35,6 +36,9 @@ var FloatingDragMenu = function FloatingDragMenu(_ref) {
35
36
  if (!targetHandleRef || !(editorView.state.selection instanceof _cellSelection.CellSelection)) {
36
37
  return null;
37
38
  }
39
+ var _ref2 = getEditorFeatureFlags ? getEditorFeatureFlags() : {},
40
+ _ref2$tableDuplicateC = _ref2.tableDuplicateCellColouring,
41
+ tableDuplicateCellColouring = _ref2$tableDuplicateC === void 0 ? false : _ref2$tableDuplicateC;
38
42
  return /*#__PURE__*/_react.default.createElement(_ui.Popup, {
39
43
  alignX: direction === 'row' ? 'right' : undefined,
40
44
  alignY: direction === 'row' ? 'start' : undefined,
@@ -68,7 +72,8 @@ var FloatingDragMenu = function FloatingDragMenu(_ref) {
68
72
  mountPoint: mountPoint,
69
73
  boundariesElement: boundariesElement,
70
74
  scrollableElement: scrollableElement,
71
- isTableScalingEnabled: isTableScalingEnabled
75
+ isTableScalingEnabled: isTableScalingEnabled,
76
+ tableDuplicateCellColouring: tableDuplicateCellColouring
72
77
  }));
73
78
  };
74
79
  FloatingDragMenu.displayName = 'FloatingDragMenu';
@@ -179,12 +179,14 @@ var FloatingInsertButton = exports.FloatingInsertButton = /*#__PURE__*/function
179
179
  var _this$props3 = this.props,
180
180
  editorView = _this$props3.editorView,
181
181
  insertRowButtonIndex = _this$props3.insertRowButtonIndex,
182
- editorAnalyticsAPI = _this$props3.editorAnalyticsAPI;
182
+ editorAnalyticsAPI = _this$props3.editorAnalyticsAPI,
183
+ getEditorFeatureFlags = _this$props3.getEditorFeatureFlags;
183
184
  if (typeof insertRowButtonIndex !== 'undefined') {
184
185
  event.preventDefault();
185
186
  var state = editorView.state,
186
187
  dispatch = editorView.dispatch;
187
- (0, _commandsWithAnalytics.insertRowWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.BUTTON, {
188
+ var featureFlags = !!getEditorFeatureFlags && getEditorFeatureFlags();
189
+ (0, _commandsWithAnalytics.insertRowWithAnalytics)(editorAnalyticsAPI, featureFlags && featureFlags.tableDuplicateCellColouring)(_analytics.INPUT_METHOD.BUTTON, {
188
190
  index: insertRowButtonIndex,
189
191
  moveCursorToInsertedRow: true
190
192
  })(state, dispatch);
@@ -196,15 +198,19 @@ var FloatingInsertButton = exports.FloatingInsertButton = /*#__PURE__*/function
196
198
  var _this$props4 = this.props,
197
199
  editorView = _this$props4.editorView,
198
200
  insertColumnButtonIndex = _this$props4.insertColumnButtonIndex,
199
- editorAnalyticsAPI = _this$props4.editorAnalyticsAPI;
201
+ editorAnalyticsAPI = _this$props4.editorAnalyticsAPI,
202
+ getEditorFeatureFlags = _this$props4.getEditorFeatureFlags;
200
203
  if (typeof insertColumnButtonIndex !== 'undefined') {
201
204
  event.preventDefault();
202
205
  var _getPluginState = (0, _pluginFactory.getPluginState)(editorView.state),
203
206
  _getPluginState$isTab = _getPluginState.isTableScalingEnabled,
204
207
  isTableScalingEnabled = _getPluginState$isTab === void 0 ? false : _getPluginState$isTab;
208
+ var _ref = getEditorFeatureFlags ? getEditorFeatureFlags() : {},
209
+ _ref$tableDuplicateCe = _ref.tableDuplicateCellColouring,
210
+ tableDuplicateCellColouring = _ref$tableDuplicateCe === void 0 ? false : _ref$tableDuplicateCe;
205
211
  var state = editorView.state,
206
212
  dispatch = editorView.dispatch;
207
- (0, _commandsWithAnalytics.insertColumnWithAnalytics)(editorAnalyticsAPI, isTableScalingEnabled)(_analytics.INPUT_METHOD.BUTTON, insertColumnButtonIndex)(state, dispatch, editorView);
213
+ (0, _commandsWithAnalytics.insertColumnWithAnalytics)(editorAnalyticsAPI, isTableScalingEnabled, tableDuplicateCellColouring)(_analytics.INPUT_METHOD.BUTTON, insertColumnButtonIndex)(state, dispatch, editorView);
208
214
  }
209
215
  }
210
216
  }]);
@@ -78,6 +78,7 @@ var defaultSelectionRect = {
78
78
  var getDragMenuConfig = exports.getDragMenuConfig = function getDragMenuConfig(direction, getEditorContainerWidth, canDrag, hasMergedCellsInTable, editorView, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI, isHeaderRowRequired) {
79
79
  var _tableMap$height, _tableMap$height2, _tableMap$width, _tableMap$width2;
80
80
  var isTableScalingEnabled = arguments.length > 11 && arguments[11] !== undefined ? arguments[11] : false;
81
+ var tableDuplicateCellColouring = arguments.length > 12 && arguments[12] !== undefined ? arguments[12] : false;
81
82
  var addOptions = direction === 'row' ? [{
82
83
  label: 'above',
83
84
  offset: 0,
@@ -157,12 +158,12 @@ var getDragMenuConfig = exports.getDragMenuConfig = function getDragMenuConfig(d
157
158
  icon: icon,
158
159
  onClick: function onClick(state, dispatch) {
159
160
  if (direction === 'row') {
160
- (0, _commandsWithAnalytics.insertRowWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.TABLE_CONTEXT_MENU, {
161
+ (0, _commandsWithAnalytics.insertRowWithAnalytics)(editorAnalyticsAPI, tableDuplicateCellColouring)(_analytics.INPUT_METHOD.TABLE_CONTEXT_MENU, {
161
162
  index: (index !== null && index !== void 0 ? index : 0) + offset,
162
163
  moveCursorToInsertedRow: true
163
164
  })(state, dispatch);
164
165
  } else {
165
- (0, _commandsWithAnalytics.insertColumnWithAnalytics)(editorAnalyticsAPI, isTableScalingEnabled)(_analytics.INPUT_METHOD.TABLE_CONTEXT_MENU, (index !== null && index !== void 0 ? index : 0) + offset)(state, dispatch, editorView);
166
+ (0, _commandsWithAnalytics.insertColumnWithAnalytics)(editorAnalyticsAPI, isTableScalingEnabled, tableDuplicateCellColouring)(_analytics.INPUT_METHOD.TABLE_CONTEXT_MENU, (index !== null && index !== void 0 ? index : 0) + offset)(state, dispatch, editorView);
166
167
  }
167
168
  return true;
168
169
  },
@@ -19,14 +19,14 @@ function addColumnAtCustomStep(column) {
19
19
  return tr;
20
20
  };
21
21
  }
22
- export function addColumnAt(isTableScalingEnabled = false) {
22
+ export function addColumnAt(isTableScalingEnabled = false, isCellBackgroundDuplicated) {
23
23
  return (column, allowAddColumnCustomStep = false, view) => {
24
24
  return tr => {
25
25
  let updatedTr = tr;
26
26
  if (allowAddColumnCustomStep) {
27
27
  updatedTr = addColumnAtCustomStep(column)(updatedTr);
28
28
  } else {
29
- updatedTr = addColumnAtPMUtils(column)(updatedTr);
29
+ updatedTr = addColumnAtPMUtils(column, isCellBackgroundDuplicated)(updatedTr);
30
30
  }
31
31
  const table = findTable(updatedTr.selection);
32
32
  if (table) {
@@ -73,8 +73,8 @@ export const addColumnAfter = isTableScalingEnabled => (state, dispatch, view) =
73
73
  }
74
74
  return true;
75
75
  };
76
- export const insertColumn = (isTableScalingEnabled = false) => column => (state, dispatch, view) => {
77
- let tr = addColumnAt(isTableScalingEnabled)(column, getAllowAddColumnCustomStep(state), view)(state.tr);
76
+ export const insertColumn = (isTableScalingEnabled = false, isCellBackgroundDuplicated) => column => (state, dispatch, view) => {
77
+ let tr = addColumnAt(isTableScalingEnabled, isCellBackgroundDuplicated)(column, getAllowAddColumnCustomStep(state), view)(state.tr);
78
78
  const table = findTable(tr.selection);
79
79
  if (!table) {
80
80
  return false;
@@ -86,7 +86,7 @@ export const insertColumn = (isTableScalingEnabled = false) => column => (state,
86
86
  }
87
87
  return true;
88
88
  };
89
- export const insertRow = (row, moveCursorToTheNewRow) => (state, dispatch) => {
89
+ export const insertRow = (row, moveCursorToTheNewRow, isCellBackgroundDuplicated) => (state, dispatch) => {
90
90
  // Don't clone the header row
91
91
  const headerRowEnabled = checkIfHeaderRowEnabled(state.selection);
92
92
  const clonePreviousRow = headerRowEnabled && row > 1 || !headerRowEnabled && row > 0;
@@ -96,7 +96,7 @@ export const insertRow = (row, moveCursorToTheNewRow) => (state, dispatch) => {
96
96
  if (row === 0 && headerRowEnabled) {
97
97
  return false;
98
98
  }
99
- const tr = clonePreviousRow ? copyPreviousRow(state.schema)(row)(state.tr) : addRowAt(row)(state.tr);
99
+ const tr = clonePreviousRow ? copyPreviousRow(state.schema)(row)(state.tr) : addRowAt(row, undefined, isCellBackgroundDuplicated)(state.tr);
100
100
  const table = findTable(tr.selection);
101
101
  if (!table) {
102
102
  return false;
@@ -152,7 +152,7 @@ export const addRowAroundSelection = editorAnalyticsAPI => side => (state, dispa
152
152
  moveCursorToInsertedRow: false
153
153
  })(state, dispatch);
154
154
  };
155
- export const insertRowWithAnalytics = editorAnalyticsAPI => (inputMethod, options) => withEditorAnalyticsAPI(state => {
155
+ export const insertRowWithAnalytics = (editorAnalyticsAPI, isCellbackgroundDuplicated = false) => (inputMethod, options) => withEditorAnalyticsAPI(state => {
156
156
  const {
157
157
  totalRowCount,
158
158
  totalColumnCount
@@ -169,7 +169,7 @@ export const insertRowWithAnalytics = editorAnalyticsAPI => (inputMethod, option
169
169
  },
170
170
  eventType: EVENT_TYPE.TRACK
171
171
  };
172
- })(editorAnalyticsAPI)(insertRow(options.index, options.moveCursorToInsertedRow));
172
+ })(editorAnalyticsAPI)(insertRow(options.index, options.moveCursorToInsertedRow, isCellbackgroundDuplicated));
173
173
  export const changeColumnWidthByStepWithAnalytics = editorAnalyticsAPI => (stepSize, getEditorContainerWidth, isTableScalingEnabled, inputMethod, ariaNotify, getIntl) => withEditorAnalyticsAPI(state => {
174
174
  const {
175
175
  table,
@@ -202,7 +202,7 @@ export const changeColumnWidthByStepWithAnalytics = editorAnalyticsAPI => (stepS
202
202
  ariaNotify: ariaNotify,
203
203
  getIntl: getIntl
204
204
  }));
205
- export const insertColumnWithAnalytics = (editorAnalyticsAPI, isTableScalingEnabled = false) => (inputMethod, position) => withEditorAnalyticsAPI(state => {
205
+ export const insertColumnWithAnalytics = (editorAnalyticsAPI, isTableScalingEnabled = false, isCellbackgroundDuplicated = false) => (inputMethod, position) => withEditorAnalyticsAPI(state => {
206
206
  const {
207
207
  totalRowCount,
208
208
  totalColumnCount
@@ -219,7 +219,7 @@ export const insertColumnWithAnalytics = (editorAnalyticsAPI, isTableScalingEnab
219
219
  },
220
220
  eventType: EVENT_TYPE.TRACK
221
221
  };
222
- })(editorAnalyticsAPI)(insertColumn(isTableScalingEnabled)(position));
222
+ })(editorAnalyticsAPI)(insertColumn(isTableScalingEnabled, isCellbackgroundDuplicated)(position));
223
223
  export const deleteRowsWithAnalytics = editorAnalyticsAPI => (inputMethod, rect, isHeaderRowRequired) => withEditorAnalyticsAPI(({
224
224
  selection
225
225
  }) => {
@@ -364,7 +364,8 @@ const tablesPlugin = ({
364
364
  hasStickyHeaders: stickyHeader && stickyHeader.sticky,
365
365
  dispatchAnalyticsEvent: dispatchAnalyticsEvent,
366
366
  editorAnalyticsAPI: editorAnalyticsAPI,
367
- getEditorContainerWidth: defaultGetEditorContainerWidth
367
+ getEditorContainerWidth: defaultGetEditorContainerWidth,
368
+ getEditorFeatureFlags: (options === null || options === void 0 ? void 0 : options.getEditorFeatureFlags) || defaultGetEditorFeatureFlags
368
369
  }), (options === null || options === void 0 ? void 0 : options.allowContextualMenu) && /*#__PURE__*/React.createElement(FloatingContextualMenu, {
369
370
  editorView: editorView,
370
371
  mountPoint: popupsMountPoint,
@@ -389,7 +390,8 @@ const tablesPlugin = ({
389
390
  editorAnalyticsAPI: editorAnalyticsAPI,
390
391
  stickyHeaders: stickyHeader,
391
392
  pluginConfig: pluginConfig,
392
- isTableScalingEnabled: options === null || options === void 0 ? void 0 : options.isTableScalingEnabled
393
+ isTableScalingEnabled: options === null || options === void 0 ? void 0 : options.isTableScalingEnabled,
394
+ getEditorFeatureFlags: (options === null || options === void 0 ? void 0 : options.getEditorFeatureFlags) || defaultGetEditorFeatureFlags
393
395
  }), allowControls && !isDragAndDropEnabled && !isResizing && /*#__PURE__*/React.createElement(FloatingDeleteButton, {
394
396
  editorView: editorView,
395
397
  selection: editorView.state.selection,