@atlaskit/editor-plugin-table 7.13.0 → 7.13.1

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 (52) hide show
  1. package/CHANGELOG.md +10 -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/ui/FloatingContextualMenu/ContextualMenu.js +11 -7
  6. package/dist/cjs/ui/FloatingContextualMenu/index.js +4 -2
  7. package/dist/cjs/ui/FloatingDragMenu/DragMenu.js +3 -2
  8. package/dist/cjs/ui/FloatingDragMenu/index.js +7 -2
  9. package/dist/cjs/ui/FloatingInsertButton/index.js +10 -4
  10. package/dist/cjs/utils/drag-menu.js +3 -2
  11. package/dist/es2019/commands/insert.js +6 -6
  12. package/dist/es2019/commands-with-analytics.js +4 -4
  13. package/dist/es2019/plugin.js +4 -2
  14. package/dist/es2019/ui/FloatingContextualMenu/ContextualMenu.js +7 -3
  15. package/dist/es2019/ui/FloatingContextualMenu/index.js +4 -2
  16. package/dist/es2019/ui/FloatingDragMenu/DragMenu.js +3 -2
  17. package/dist/es2019/ui/FloatingDragMenu/index.js +7 -2
  18. package/dist/es2019/ui/FloatingInsertButton/index.js +10 -4
  19. package/dist/es2019/utils/drag-menu.js +3 -3
  20. package/dist/esm/commands/insert.js +6 -4
  21. package/dist/esm/commands-with-analytics.js +4 -2
  22. package/dist/esm/plugin.js +4 -2
  23. package/dist/esm/ui/FloatingContextualMenu/ContextualMenu.js +11 -7
  24. package/dist/esm/ui/FloatingContextualMenu/index.js +4 -2
  25. package/dist/esm/ui/FloatingDragMenu/DragMenu.js +3 -2
  26. package/dist/esm/ui/FloatingDragMenu/index.js +7 -2
  27. package/dist/esm/ui/FloatingInsertButton/index.js +10 -4
  28. package/dist/esm/utils/drag-menu.js +3 -2
  29. package/dist/types/commands/insert.d.ts +3 -3
  30. package/dist/types/commands-with-analytics.d.ts +2 -2
  31. package/dist/types/ui/FloatingContextualMenu/index.d.ts +1 -1
  32. package/dist/types/ui/FloatingDragMenu/DragMenu.d.ts +2 -1
  33. package/dist/types/ui/FloatingDragMenu/index.d.ts +3 -2
  34. package/dist/types/ui/FloatingInsertButton/index.d.ts +2 -1
  35. package/dist/types/utils/drag-menu.d.ts +1 -1
  36. package/dist/types-ts4.5/commands/insert.d.ts +3 -3
  37. package/dist/types-ts4.5/commands-with-analytics.d.ts +2 -2
  38. package/dist/types-ts4.5/ui/FloatingContextualMenu/index.d.ts +1 -1
  39. package/dist/types-ts4.5/ui/FloatingDragMenu/DragMenu.d.ts +2 -1
  40. package/dist/types-ts4.5/ui/FloatingDragMenu/index.d.ts +3 -2
  41. package/dist/types-ts4.5/ui/FloatingInsertButton/index.d.ts +2 -1
  42. package/dist/types-ts4.5/utils/drag-menu.d.ts +1 -1
  43. package/package.json +1 -1
  44. package/src/commands/insert.ts +16 -6
  45. package/src/commands-with-analytics.ts +13 -3
  46. package/src/plugin.tsx +8 -0
  47. package/src/ui/FloatingContextualMenu/ContextualMenu.tsx +21 -8
  48. package/src/ui/FloatingContextualMenu/index.tsx +2 -0
  49. package/src/ui/FloatingDragMenu/DragMenu.tsx +3 -0
  50. package/src/ui/FloatingDragMenu/index.tsx +11 -1
  51. package/src/ui/FloatingInsertButton/index.tsx +38 -11
  52. package/src/utils/drag-menu.ts +17 -11
@@ -165,6 +165,7 @@ export var addRowAroundSelection = function addRowAroundSelection(editorAnalytic
165
165
  };
166
166
  };
167
167
  export var insertRowWithAnalytics = function insertRowWithAnalytics(editorAnalyticsAPI) {
168
+ var isCellbackgroundDuplicated = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
168
169
  return function (inputMethod, options) {
169
170
  return withEditorAnalyticsAPI(function (state) {
170
171
  var _getSelectedTableInfo = getSelectedTableInfo(state.selection),
@@ -182,7 +183,7 @@ export var insertRowWithAnalytics = function insertRowWithAnalytics(editorAnalyt
182
183
  },
183
184
  eventType: EVENT_TYPE.TRACK
184
185
  };
185
- })(editorAnalyticsAPI)(insertRow(options.index, options.moveCursorToInsertedRow));
186
+ })(editorAnalyticsAPI)(insertRow(options.index, options.moveCursorToInsertedRow, isCellbackgroundDuplicated));
186
187
  };
187
188
  };
188
189
  export var changeColumnWidthByStepWithAnalytics = function changeColumnWidthByStepWithAnalytics(editorAnalyticsAPI) {
@@ -219,6 +220,7 @@ export var changeColumnWidthByStepWithAnalytics = function changeColumnWidthBySt
219
220
  };
220
221
  export var insertColumnWithAnalytics = function insertColumnWithAnalytics(editorAnalyticsAPI) {
221
222
  var isTableScalingEnabled = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
223
+ var isCellbackgroundDuplicated = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
222
224
  return function (inputMethod, position) {
223
225
  return withEditorAnalyticsAPI(function (state) {
224
226
  var _getSelectedTableInfo3 = getSelectedTableInfo(state.selection),
@@ -236,7 +238,7 @@ export var insertColumnWithAnalytics = function insertColumnWithAnalytics(editor
236
238
  },
237
239
  eventType: EVENT_TYPE.TRACK
238
240
  };
239
- })(editorAnalyticsAPI)(insertColumn(isTableScalingEnabled)(position));
241
+ })(editorAnalyticsAPI)(insertColumn(isTableScalingEnabled, isCellbackgroundDuplicated)(position));
240
242
  };
241
243
  };
242
244
  export var deleteRowsWithAnalytics = function deleteRowsWithAnalytics(editorAnalyticsAPI) {
@@ -361,7 +361,8 @@ var tablesPlugin = function tablesPlugin(_ref) {
361
361
  hasStickyHeaders: stickyHeader && stickyHeader.sticky,
362
362
  dispatchAnalyticsEvent: dispatchAnalyticsEvent,
363
363
  editorAnalyticsAPI: editorAnalyticsAPI,
364
- getEditorContainerWidth: defaultGetEditorContainerWidth
364
+ getEditorContainerWidth: defaultGetEditorContainerWidth,
365
+ getEditorFeatureFlags: (options === null || options === void 0 ? void 0 : options.getEditorFeatureFlags) || defaultGetEditorFeatureFlags
365
366
  }), (options === null || options === void 0 ? void 0 : options.allowContextualMenu) && /*#__PURE__*/React.createElement(FloatingContextualMenu, {
366
367
  editorView: editorView,
367
368
  mountPoint: popupsMountPoint,
@@ -386,7 +387,8 @@ var tablesPlugin = function tablesPlugin(_ref) {
386
387
  editorAnalyticsAPI: editorAnalyticsAPI,
387
388
  stickyHeaders: stickyHeader,
388
389
  pluginConfig: pluginConfig,
389
- isTableScalingEnabled: options === null || options === void 0 ? void 0 : options.isTableScalingEnabled
390
+ isTableScalingEnabled: options === null || options === void 0 ? void 0 : options.isTableScalingEnabled,
391
+ getEditorFeatureFlags: (options === null || options === void 0 ? void 0 : options.getEditorFeatureFlags) || defaultGetEditorFeatureFlags
390
392
  }), allowControls && !isDragAndDropEnabled && !isResizing && /*#__PURE__*/React.createElement(FloatingDeleteButton, {
391
393
  editorView: editorView,
392
394
  selection: editorView.state.selection,
@@ -365,7 +365,8 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
365
365
  editorView = _this$props10.editorView,
366
366
  selectionRect = _this$props10.selectionRect,
367
367
  editorAnalyticsAPI = _this$props10.editorAnalyticsAPI,
368
- getEditorContainerWidth = _this$props10.getEditorContainerWidth;
368
+ getEditorContainerWidth = _this$props10.getEditorContainerWidth,
369
+ getEditorFeatureFlags = _this$props10.getEditorFeatureFlags;
369
370
  // TargetCellPosition could be outdated: https://product-fabric.atlassian.net/browse/ED-8129
370
371
  var state = editorView.state,
371
372
  dispatch = editorView.dispatch;
@@ -373,6 +374,9 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
373
374
  targetCellPosition = _getPluginState11.targetCellPosition,
374
375
  _getPluginState11$isT = _getPluginState11.isTableScalingEnabled,
375
376
  isTableScalingEnabled = _getPluginState11$isT === void 0 ? false : _getPluginState11$isT;
377
+ var _ref2 = getEditorFeatureFlags ? getEditorFeatureFlags() : {},
378
+ _ref2$tableDuplicateC = _ref2.tableDuplicateCellColouring,
379
+ tableDuplicateCellColouring = _ref2$tableDuplicateC === void 0 ? false : _ref2$tableDuplicateC;
376
380
  switch (item.value.name) {
377
381
  case 'sort_column_desc':
378
382
  sortColumnWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.CONTEXT_MENU, selectionRect.left, SortOrder.DESC)(state, dispatch);
@@ -402,11 +406,11 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
402
406
  _this.toggleOpen();
403
407
  break;
404
408
  case 'insert_column':
405
- insertColumnWithAnalytics(editorAnalyticsAPI, isTableScalingEnabled)(INPUT_METHOD.CONTEXT_MENU, selectionRect.right)(state, dispatch, editorView);
409
+ insertColumnWithAnalytics(editorAnalyticsAPI, isTableScalingEnabled, tableDuplicateCellColouring)(INPUT_METHOD.CONTEXT_MENU, selectionRect.right)(state, dispatch, editorView);
406
410
  _this.toggleOpen();
407
411
  break;
408
412
  case 'insert_row':
409
- insertRowWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.CONTEXT_MENU, {
413
+ insertRowWithAnalytics(editorAnalyticsAPI, tableDuplicateCellColouring)(INPUT_METHOD.CONTEXT_MENU, {
410
414
  index: selectionRect.bottom,
411
415
  moveCursorToInsertedRow: true
412
416
  })(state, dispatch);
@@ -446,8 +450,8 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
446
450
  isSubmenuOpen: false
447
451
  });
448
452
  });
449
- _defineProperty(_assertThisInitialized(_this), "handleItemMouseEnter", function (_ref2) {
450
- var item = _ref2.item;
453
+ _defineProperty(_assertThisInitialized(_this), "handleItemMouseEnter", function (_ref3) {
454
+ var item = _ref3.item;
451
455
  var _this$props12 = _this.props,
452
456
  _this$props12$editorV = _this$props12.editorView,
453
457
  state = _this$props12$editorV.state,
@@ -470,8 +474,8 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
470
474
  hoverMergedCells()(state, dispatch);
471
475
  }
472
476
  });
473
- _defineProperty(_assertThisInitialized(_this), "handleItemMouseLeave", function (_ref3) {
474
- var item = _ref3.item;
477
+ _defineProperty(_assertThisInitialized(_this), "handleItemMouseLeave", function (_ref4) {
478
+ var item = _ref4.item;
475
479
  var _this$props$editorVie2 = _this.props.editorView,
476
480
  state = _this$props$editorVie2.state,
477
481
  dispatch = _this$props$editorVie2.dispatch;
@@ -16,7 +16,8 @@ var FloatingContextualMenu = function FloatingContextualMenu(_ref) {
16
16
  isOpen = _ref.isOpen,
17
17
  pluginConfig = _ref.pluginConfig,
18
18
  editorAnalyticsAPI = _ref.editorAnalyticsAPI,
19
- getEditorContainerWidth = _ref.getEditorContainerWidth;
19
+ getEditorContainerWidth = _ref.getEditorContainerWidth,
20
+ getEditorFeatureFlags = _ref.getEditorFeatureFlags;
20
21
  // TargetCellPosition could be outdated: https://product-fabric.atlassian.net/browse/ED-8129
21
22
  var _getPluginState = getPluginState(editorView.state),
22
23
  targetCellPosition = _getPluginState.targetCellPosition,
@@ -64,7 +65,8 @@ var FloatingContextualMenu = function FloatingContextualMenu(_ref) {
64
65
  selectionRect: selectionRect,
65
66
  boundariesElement: boundariesElement,
66
67
  editorAnalyticsAPI: editorAnalyticsAPI,
67
- getEditorContainerWidth: getEditorContainerWidth
68
+ getEditorContainerWidth: getEditorContainerWidth,
69
+ getEditorFeatureFlags: getEditorFeatureFlags
68
70
  })));
69
71
  };
70
72
  FloatingContextualMenu.displayName = 'FloatingContextualMenu';
@@ -180,7 +180,8 @@ export var DragMenu = /*#__PURE__*/React.memo(function (_ref) {
180
180
  mountPoint = _ref.mountPoint,
181
181
  scrollableElement = _ref.scrollableElement,
182
182
  boundariesElement = _ref.boundariesElement,
183
- isTableScalingEnabled = _ref.isTableScalingEnabled;
183
+ isTableScalingEnabled = _ref.isTableScalingEnabled,
184
+ tableDuplicateCellColouring = _ref.tableDuplicateCellColouring;
184
185
  var state = editorView.state,
185
186
  dispatch = editorView.dispatch;
186
187
  var selection = state.selection;
@@ -204,7 +205,7 @@ export var DragMenu = /*#__PURE__*/React.memo(function (_ref) {
204
205
  hasMergedCellsInTable = getMergedCellsPositions(state.tr).length > 0;
205
206
  }
206
207
  var allowBackgroundColor = (_pluginConfig$allowBa = pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.allowBackgroundColor) !== null && _pluginConfig$allowBa !== void 0 ? _pluginConfig$allowBa : false;
207
- var dragMenuConfig = getDragMenuConfig(direction, getEditorContainerWidth, !shouldMoveDisabled, hasMergedCellsInTable, editorView, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI, pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.isHeaderRowRequired, isTableScalingEnabled);
208
+ var dragMenuConfig = getDragMenuConfig(direction, getEditorContainerWidth, !shouldMoveDisabled, hasMergedCellsInTable, editorView, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI, pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.isHeaderRowRequired, isTableScalingEnabled, tableDuplicateCellColouring);
208
209
  var _convertToDropdownIte = convertToDropdownItems(dragMenuConfig, formatMessage, selectionRect),
209
210
  menuItems = _convertToDropdownIte.menuItems,
210
211
  menuCallback = _convertToDropdownIte.menuCallback;
@@ -18,7 +18,8 @@ var FloatingDragMenu = function FloatingDragMenu(_ref) {
18
18
  editorAnalyticsAPI = _ref.editorAnalyticsAPI,
19
19
  stickyHeaders = _ref.stickyHeaders,
20
20
  pluginConfig = _ref.pluginConfig,
21
- isTableScalingEnabled = _ref.isTableScalingEnabled;
21
+ isTableScalingEnabled = _ref.isTableScalingEnabled,
22
+ getEditorFeatureFlags = _ref.getEditorFeatureFlags;
22
23
  if (!isOpen || !targetCellPosition || editorView.state.doc.nodeSize <= targetCellPosition) {
23
24
  return null;
24
25
  }
@@ -28,6 +29,9 @@ var FloatingDragMenu = function FloatingDragMenu(_ref) {
28
29
  if (!targetHandleRef || !(editorView.state.selection instanceof CellSelection)) {
29
30
  return null;
30
31
  }
32
+ var _ref2 = getEditorFeatureFlags ? getEditorFeatureFlags() : {},
33
+ _ref2$tableDuplicateC = _ref2.tableDuplicateCellColouring,
34
+ tableDuplicateCellColouring = _ref2$tableDuplicateC === void 0 ? false : _ref2$tableDuplicateC;
31
35
  return /*#__PURE__*/React.createElement(Popup, {
32
36
  alignX: direction === 'row' ? 'right' : undefined,
33
37
  alignY: direction === 'row' ? 'start' : undefined,
@@ -61,7 +65,8 @@ var FloatingDragMenu = function FloatingDragMenu(_ref) {
61
65
  mountPoint: mountPoint,
62
66
  boundariesElement: boundariesElement,
63
67
  scrollableElement: scrollableElement,
64
- isTableScalingEnabled: isTableScalingEnabled
68
+ isTableScalingEnabled: isTableScalingEnabled,
69
+ tableDuplicateCellColouring: tableDuplicateCellColouring
65
70
  }));
66
71
  };
67
72
  FloatingDragMenu.displayName = 'FloatingDragMenu';
@@ -169,12 +169,14 @@ export var FloatingInsertButton = /*#__PURE__*/function (_React$Component) {
169
169
  var _this$props3 = this.props,
170
170
  editorView = _this$props3.editorView,
171
171
  insertRowButtonIndex = _this$props3.insertRowButtonIndex,
172
- editorAnalyticsAPI = _this$props3.editorAnalyticsAPI;
172
+ editorAnalyticsAPI = _this$props3.editorAnalyticsAPI,
173
+ getEditorFeatureFlags = _this$props3.getEditorFeatureFlags;
173
174
  if (typeof insertRowButtonIndex !== 'undefined') {
174
175
  event.preventDefault();
175
176
  var state = editorView.state,
176
177
  dispatch = editorView.dispatch;
177
- insertRowWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.BUTTON, {
178
+ var featureFlags = !!getEditorFeatureFlags && getEditorFeatureFlags();
179
+ insertRowWithAnalytics(editorAnalyticsAPI, featureFlags && featureFlags.tableDuplicateCellColouring)(INPUT_METHOD.BUTTON, {
178
180
  index: insertRowButtonIndex,
179
181
  moveCursorToInsertedRow: true
180
182
  })(state, dispatch);
@@ -186,15 +188,19 @@ export var FloatingInsertButton = /*#__PURE__*/function (_React$Component) {
186
188
  var _this$props4 = this.props,
187
189
  editorView = _this$props4.editorView,
188
190
  insertColumnButtonIndex = _this$props4.insertColumnButtonIndex,
189
- editorAnalyticsAPI = _this$props4.editorAnalyticsAPI;
191
+ editorAnalyticsAPI = _this$props4.editorAnalyticsAPI,
192
+ getEditorFeatureFlags = _this$props4.getEditorFeatureFlags;
190
193
  if (typeof insertColumnButtonIndex !== 'undefined') {
191
194
  event.preventDefault();
192
195
  var _getPluginState = getPluginState(editorView.state),
193
196
  _getPluginState$isTab = _getPluginState.isTableScalingEnabled,
194
197
  isTableScalingEnabled = _getPluginState$isTab === void 0 ? false : _getPluginState$isTab;
198
+ var _ref = getEditorFeatureFlags ? getEditorFeatureFlags() : {},
199
+ _ref$tableDuplicateCe = _ref.tableDuplicateCellColouring,
200
+ tableDuplicateCellColouring = _ref$tableDuplicateCe === void 0 ? false : _ref$tableDuplicateCe;
195
201
  var state = editorView.state,
196
202
  dispatch = editorView.dispatch;
197
- insertColumnWithAnalytics(editorAnalyticsAPI, isTableScalingEnabled)(INPUT_METHOD.BUTTON, insertColumnButtonIndex)(state, dispatch, editorView);
203
+ insertColumnWithAnalytics(editorAnalyticsAPI, isTableScalingEnabled, tableDuplicateCellColouring)(INPUT_METHOD.BUTTON, insertColumnButtonIndex)(state, dispatch, editorView);
198
204
  }
199
205
  }
200
206
  }]);
@@ -71,6 +71,7 @@ var defaultSelectionRect = {
71
71
  export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorContainerWidth, canDrag, hasMergedCellsInTable, editorView, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI, isHeaderRowRequired) {
72
72
  var _tableMap$height, _tableMap$height2, _tableMap$width, _tableMap$width2;
73
73
  var isTableScalingEnabled = arguments.length > 11 && arguments[11] !== undefined ? arguments[11] : false;
74
+ var tableDuplicateCellColouring = arguments.length > 12 && arguments[12] !== undefined ? arguments[12] : false;
74
75
  var addOptions = direction === 'row' ? [{
75
76
  label: 'above',
76
77
  offset: 0,
@@ -150,12 +151,12 @@ export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorCo
150
151
  icon: icon,
151
152
  onClick: function onClick(state, dispatch) {
152
153
  if (direction === 'row') {
153
- insertRowWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.TABLE_CONTEXT_MENU, {
154
+ insertRowWithAnalytics(editorAnalyticsAPI, tableDuplicateCellColouring)(INPUT_METHOD.TABLE_CONTEXT_MENU, {
154
155
  index: (index !== null && index !== void 0 ? index : 0) + offset,
155
156
  moveCursorToInsertedRow: true
156
157
  })(state, dispatch);
157
158
  } else {
158
- insertColumnWithAnalytics(editorAnalyticsAPI, isTableScalingEnabled)(INPUT_METHOD.TABLE_CONTEXT_MENU, (index !== null && index !== void 0 ? index : 0) + offset)(state, dispatch, editorView);
159
+ insertColumnWithAnalytics(editorAnalyticsAPI, isTableScalingEnabled, tableDuplicateCellColouring)(INPUT_METHOD.TABLE_CONTEXT_MENU, (index !== null && index !== void 0 ? index : 0) + offset)(state, dispatch, editorView);
159
160
  }
160
161
  return true;
161
162
  },
@@ -2,10 +2,10 @@ import type { EditorAnalyticsAPI, INPUT_METHOD } from '@atlaskit/editor-common/a
2
2
  import type { Command, EditorCommand } from '@atlaskit/editor-common/types';
3
3
  import type { Transaction } from '@atlaskit/editor-prosemirror/state';
4
4
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
5
- export declare function addColumnAt(isTableScalingEnabled?: boolean): (column: number, allowAddColumnCustomStep: boolean | undefined, view: EditorView | undefined) => (tr: Transaction) => Transaction;
5
+ export declare function addColumnAt(isTableScalingEnabled?: boolean, isCellBackgroundDuplicated?: boolean): (column: number, allowAddColumnCustomStep: boolean | undefined, view: EditorView | undefined) => (tr: Transaction) => Transaction;
6
6
  export declare const addColumnBefore: (isTableScalingEnabled?: boolean) => Command;
7
7
  export declare const addColumnAfter: (isTableScalingEnabled?: boolean) => Command;
8
- export declare const insertColumn: (isTableScalingEnabled?: boolean) => (column: number) => Command;
9
- export declare const insertRow: (row: number, moveCursorToTheNewRow: boolean) => Command;
8
+ export declare const insertColumn: (isTableScalingEnabled?: boolean, isCellBackgroundDuplicated?: boolean) => (column: number) => Command;
9
+ export declare const insertRow: (row: number, moveCursorToTheNewRow: boolean, isCellBackgroundDuplicated?: boolean) => Command;
10
10
  export declare const createTable: (isTableScalingEnabled?: boolean, isFullWidthModeEnabled?: boolean) => Command;
11
11
  export declare const insertTableWithSize: (isFullWidthModeEnabled?: boolean, isTableScalingEnabled?: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI) => (rowsCount: number, colsCount: number, inputMethod?: INPUT_METHOD.PICKER) => EditorCommand;
@@ -12,9 +12,9 @@ export declare const mergeCellsWithAnalytics: (editorAnalyticsAPI: EditorAnalyti
12
12
  export declare const splitCellWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.FLOATING_TB) => Command;
13
13
  export declare const setColorWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.FLOATING_TB | INPUT_METHOD.TABLE_CONTEXT_MENU, cellColor: string, targetCellPosition?: number, editorView?: EditorView | null) => Command;
14
14
  export declare const addRowAroundSelection: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (side: RowInsertPosition) => Command;
15
- export declare const insertRowWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: InsertRowMethods, options: InsertRowOptions) => Command;
15
+ export declare const insertRowWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, isCellbackgroundDuplicated?: boolean) => (inputMethod: InsertRowMethods, options: InsertRowOptions) => Command;
16
16
  export declare const changeColumnWidthByStepWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (stepSize: number, getEditorContainerWidth: GetEditorContainerWidth, isTableScalingEnabled: boolean, inputMethod: INPUT_METHOD.SHORTCUT, ariaNotify?: ((message: string) => void) | undefined, getIntl?: () => IntlShape) => Command;
17
- export declare const insertColumnWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, isTableScalingEnabled?: boolean) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.BUTTON | INPUT_METHOD.SHORTCUT | INPUT_METHOD.FLOATING_TB | INPUT_METHOD.TABLE_CONTEXT_MENU, position: number) => Command;
17
+ export declare const insertColumnWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, isTableScalingEnabled?: boolean, isCellbackgroundDuplicated?: boolean) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.BUTTON | INPUT_METHOD.SHORTCUT | INPUT_METHOD.FLOATING_TB | INPUT_METHOD.TABLE_CONTEXT_MENU, position: number) => Command;
18
18
  export declare const deleteRowsWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.BUTTON | INPUT_METHOD.FLOATING_TB | INPUT_METHOD.SHORTCUT | INPUT_METHOD.TABLE_CONTEXT_MENU, rect: Rect, isHeaderRowRequired: boolean) => Command;
19
19
  export declare const deleteColumnsWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, isTableScalingEnabled?: boolean) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.BUTTON | INPUT_METHOD.FLOATING_TB | INPUT_METHOD.SHORTCUT | INPUT_METHOD.TABLE_CONTEXT_MENU, rect: Rect) => Command;
20
20
  export declare const deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => Command;
@@ -17,7 +17,7 @@ export interface Props {
17
17
  editorAnalyticsAPI?: EditorAnalyticsAPI;
18
18
  }
19
19
  declare const FloatingContextualMenu: {
20
- ({ mountPoint, boundariesElement, scrollableElement, editorView, isOpen, pluginConfig, editorAnalyticsAPI, getEditorContainerWidth, }: Props): jsx.JSX.Element | null;
20
+ ({ mountPoint, boundariesElement, scrollableElement, editorView, isOpen, pluginConfig, editorAnalyticsAPI, getEditorContainerWidth, getEditorFeatureFlags, }: Props): jsx.JSX.Element | null;
21
21
  displayName: string;
22
22
  };
23
23
  export default FloatingContextualMenu;
@@ -25,8 +25,9 @@ type DragMenuProps = {
25
25
  boundariesElement?: HTMLElement;
26
26
  scrollableElement?: HTMLElement;
27
27
  isTableScalingEnabled?: boolean;
28
+ tableDuplicateCellColouring?: boolean;
28
29
  };
29
- export declare const DragMenu: React.MemoExoticComponent<({ direction, index, target, isOpen, editorView, tableNode, targetCellPosition, getEditorContainerWidth, editorAnalyticsAPI, pluginConfig, intl: { formatMessage }, fitHeight, fitWidth, mountPoint, scrollableElement, boundariesElement, isTableScalingEnabled, }: DragMenuProps & WrappedComponentProps) => jsx.JSX.Element | null>;
30
+ export declare const DragMenu: React.MemoExoticComponent<({ direction, index, target, isOpen, editorView, tableNode, targetCellPosition, getEditorContainerWidth, editorAnalyticsAPI, pluginConfig, intl: { formatMessage }, fitHeight, fitWidth, mountPoint, scrollableElement, boundariesElement, isTableScalingEnabled, tableDuplicateCellColouring, }: DragMenuProps & WrappedComponentProps) => jsx.JSX.Element | null>;
30
31
  declare const _default: React.FC<import("react-intl-next").WithIntlProps<DragMenuProps & WrappedComponentProps>> & {
31
32
  WrappedComponent: React.ComponentType<DragMenuProps & WrappedComponentProps>;
32
33
  };
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
3
- import type { GetEditorContainerWidth } from '@atlaskit/editor-common/types';
3
+ import type { GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
4
4
  import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
5
5
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
6
6
  import type { RowStickyState } from '../../pm-plugins/sticky-headers';
@@ -21,9 +21,10 @@ export interface Props {
21
21
  stickyHeaders?: RowStickyState;
22
22
  pluginConfig?: PluginConfig;
23
23
  isTableScalingEnabled?: boolean;
24
+ getEditorFeatureFlags?: GetEditorFeatureFlags;
24
25
  }
25
26
  declare const FloatingDragMenu: {
26
- ({ mountPoint, boundariesElement, scrollableElement, editorView, isOpen, tableNode, direction, index, targetCellPosition, getEditorContainerWidth, editorAnalyticsAPI, stickyHeaders, pluginConfig, isTableScalingEnabled, }: Props): JSX.Element | null;
27
+ ({ mountPoint, boundariesElement, scrollableElement, editorView, isOpen, tableNode, direction, index, targetCellPosition, getEditorContainerWidth, editorAnalyticsAPI, stickyHeaders, pluginConfig, isTableScalingEnabled, getEditorFeatureFlags, }: Props): JSX.Element | null;
27
28
  displayName: string;
28
29
  };
29
30
  export default FloatingDragMenu;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import type { WrappedComponentProps } from 'react-intl-next';
3
3
  import type { DispatchAnalyticsEvent, EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
4
- import type { GetEditorContainerWidth } from '@atlaskit/editor-common/types';
4
+ import type { GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
5
5
  import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
6
6
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
7
7
  export interface Props {
@@ -20,6 +20,7 @@ export interface Props {
20
20
  hasStickyHeaders?: boolean;
21
21
  dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
22
22
  editorAnalyticsAPI?: EditorAnalyticsAPI;
23
+ getEditorFeatureFlags?: GetEditorFeatureFlags;
23
24
  }
24
25
  export declare class FloatingInsertButton extends React.Component<Props & WrappedComponentProps, any> {
25
26
  static displayName: string;
@@ -13,4 +13,4 @@ export interface DragMenuConfig extends DropdownOptionT<Command> {
13
13
  icon?: React.ComponentType<React.PropsWithChildren<IconProps>>;
14
14
  keymap?: string;
15
15
  }
16
- export declare const getDragMenuConfig: (direction: TableDirection, getEditorContainerWidth: GetEditorContainerWidth, canDrag: boolean, hasMergedCellsInTable: boolean, editorView: EditorView, tableMap?: TableMap, index?: number, targetCellPosition?: number, selectionRect?: Rect, editorAnalyticsAPI?: EditorAnalyticsAPI, isHeaderRowRequired?: boolean, isTableScalingEnabled?: boolean) => DragMenuConfig[];
16
+ export declare const getDragMenuConfig: (direction: TableDirection, getEditorContainerWidth: GetEditorContainerWidth, canDrag: boolean, hasMergedCellsInTable: boolean, editorView: EditorView, tableMap?: TableMap, index?: number, targetCellPosition?: number, selectionRect?: Rect, editorAnalyticsAPI?: EditorAnalyticsAPI, isHeaderRowRequired?: boolean, isTableScalingEnabled?: boolean, tableDuplicateCellColouring?: boolean) => DragMenuConfig[];
@@ -2,10 +2,10 @@ import type { EditorAnalyticsAPI, INPUT_METHOD } from '@atlaskit/editor-common/a
2
2
  import type { Command, EditorCommand } from '@atlaskit/editor-common/types';
3
3
  import type { Transaction } from '@atlaskit/editor-prosemirror/state';
4
4
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
5
- export declare function addColumnAt(isTableScalingEnabled?: boolean): (column: number, allowAddColumnCustomStep: boolean | undefined, view: EditorView | undefined) => (tr: Transaction) => Transaction;
5
+ export declare function addColumnAt(isTableScalingEnabled?: boolean, isCellBackgroundDuplicated?: boolean): (column: number, allowAddColumnCustomStep: boolean | undefined, view: EditorView | undefined) => (tr: Transaction) => Transaction;
6
6
  export declare const addColumnBefore: (isTableScalingEnabled?: boolean) => Command;
7
7
  export declare const addColumnAfter: (isTableScalingEnabled?: boolean) => Command;
8
- export declare const insertColumn: (isTableScalingEnabled?: boolean) => (column: number) => Command;
9
- export declare const insertRow: (row: number, moveCursorToTheNewRow: boolean) => Command;
8
+ export declare const insertColumn: (isTableScalingEnabled?: boolean, isCellBackgroundDuplicated?: boolean) => (column: number) => Command;
9
+ export declare const insertRow: (row: number, moveCursorToTheNewRow: boolean, isCellBackgroundDuplicated?: boolean) => Command;
10
10
  export declare const createTable: (isTableScalingEnabled?: boolean, isFullWidthModeEnabled?: boolean) => Command;
11
11
  export declare const insertTableWithSize: (isFullWidthModeEnabled?: boolean, isTableScalingEnabled?: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI) => (rowsCount: number, colsCount: number, inputMethod?: INPUT_METHOD.PICKER) => EditorCommand;
@@ -12,9 +12,9 @@ export declare const mergeCellsWithAnalytics: (editorAnalyticsAPI: EditorAnalyti
12
12
  export declare const splitCellWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.FLOATING_TB) => Command;
13
13
  export declare const setColorWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.FLOATING_TB | INPUT_METHOD.TABLE_CONTEXT_MENU, cellColor: string, targetCellPosition?: number, editorView?: EditorView | null) => Command;
14
14
  export declare const addRowAroundSelection: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (side: RowInsertPosition) => Command;
15
- export declare const insertRowWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: InsertRowMethods, options: InsertRowOptions) => Command;
15
+ export declare const insertRowWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, isCellbackgroundDuplicated?: boolean) => (inputMethod: InsertRowMethods, options: InsertRowOptions) => Command;
16
16
  export declare const changeColumnWidthByStepWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (stepSize: number, getEditorContainerWidth: GetEditorContainerWidth, isTableScalingEnabled: boolean, inputMethod: INPUT_METHOD.SHORTCUT, ariaNotify?: ((message: string) => void) | undefined, getIntl?: () => IntlShape) => Command;
17
- export declare const insertColumnWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, isTableScalingEnabled?: boolean) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.BUTTON | INPUT_METHOD.SHORTCUT | INPUT_METHOD.FLOATING_TB | INPUT_METHOD.TABLE_CONTEXT_MENU, position: number) => Command;
17
+ export declare const insertColumnWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, isTableScalingEnabled?: boolean, isCellbackgroundDuplicated?: boolean) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.BUTTON | INPUT_METHOD.SHORTCUT | INPUT_METHOD.FLOATING_TB | INPUT_METHOD.TABLE_CONTEXT_MENU, position: number) => Command;
18
18
  export declare const deleteRowsWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.BUTTON | INPUT_METHOD.FLOATING_TB | INPUT_METHOD.SHORTCUT | INPUT_METHOD.TABLE_CONTEXT_MENU, rect: Rect, isHeaderRowRequired: boolean) => Command;
19
19
  export declare const deleteColumnsWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, isTableScalingEnabled?: boolean) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.BUTTON | INPUT_METHOD.FLOATING_TB | INPUT_METHOD.SHORTCUT | INPUT_METHOD.TABLE_CONTEXT_MENU, rect: Rect) => Command;
20
20
  export declare const deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => Command;
@@ -17,7 +17,7 @@ export interface Props {
17
17
  editorAnalyticsAPI?: EditorAnalyticsAPI;
18
18
  }
19
19
  declare const FloatingContextualMenu: {
20
- ({ mountPoint, boundariesElement, scrollableElement, editorView, isOpen, pluginConfig, editorAnalyticsAPI, getEditorContainerWidth, }: Props): jsx.JSX.Element | null;
20
+ ({ mountPoint, boundariesElement, scrollableElement, editorView, isOpen, pluginConfig, editorAnalyticsAPI, getEditorContainerWidth, getEditorFeatureFlags, }: Props): jsx.JSX.Element | null;
21
21
  displayName: string;
22
22
  };
23
23
  export default FloatingContextualMenu;
@@ -25,8 +25,9 @@ type DragMenuProps = {
25
25
  boundariesElement?: HTMLElement;
26
26
  scrollableElement?: HTMLElement;
27
27
  isTableScalingEnabled?: boolean;
28
+ tableDuplicateCellColouring?: boolean;
28
29
  };
29
- export declare const DragMenu: React.MemoExoticComponent<({ direction, index, target, isOpen, editorView, tableNode, targetCellPosition, getEditorContainerWidth, editorAnalyticsAPI, pluginConfig, intl: { formatMessage }, fitHeight, fitWidth, mountPoint, scrollableElement, boundariesElement, isTableScalingEnabled, }: DragMenuProps & WrappedComponentProps) => jsx.JSX.Element | null>;
30
+ export declare const DragMenu: React.MemoExoticComponent<({ direction, index, target, isOpen, editorView, tableNode, targetCellPosition, getEditorContainerWidth, editorAnalyticsAPI, pluginConfig, intl: { formatMessage }, fitHeight, fitWidth, mountPoint, scrollableElement, boundariesElement, isTableScalingEnabled, tableDuplicateCellColouring, }: DragMenuProps & WrappedComponentProps) => jsx.JSX.Element | null>;
30
31
  declare const _default: React.FC<import("react-intl-next").WithIntlProps<DragMenuProps & WrappedComponentProps>> & {
31
32
  WrappedComponent: React.ComponentType<DragMenuProps & WrappedComponentProps>;
32
33
  };
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
3
- import type { GetEditorContainerWidth } from '@atlaskit/editor-common/types';
3
+ import type { GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
4
4
  import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
5
5
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
6
6
  import type { RowStickyState } from '../../pm-plugins/sticky-headers';
@@ -21,9 +21,10 @@ export interface Props {
21
21
  stickyHeaders?: RowStickyState;
22
22
  pluginConfig?: PluginConfig;
23
23
  isTableScalingEnabled?: boolean;
24
+ getEditorFeatureFlags?: GetEditorFeatureFlags;
24
25
  }
25
26
  declare const FloatingDragMenu: {
26
- ({ mountPoint, boundariesElement, scrollableElement, editorView, isOpen, tableNode, direction, index, targetCellPosition, getEditorContainerWidth, editorAnalyticsAPI, stickyHeaders, pluginConfig, isTableScalingEnabled, }: Props): JSX.Element | null;
27
+ ({ mountPoint, boundariesElement, scrollableElement, editorView, isOpen, tableNode, direction, index, targetCellPosition, getEditorContainerWidth, editorAnalyticsAPI, stickyHeaders, pluginConfig, isTableScalingEnabled, getEditorFeatureFlags, }: Props): JSX.Element | null;
27
28
  displayName: string;
28
29
  };
29
30
  export default FloatingDragMenu;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import type { WrappedComponentProps } from 'react-intl-next';
3
3
  import type { DispatchAnalyticsEvent, EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
4
- import type { GetEditorContainerWidth } from '@atlaskit/editor-common/types';
4
+ import type { GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
5
5
  import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
6
6
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
7
7
  export interface Props {
@@ -20,6 +20,7 @@ export interface Props {
20
20
  hasStickyHeaders?: boolean;
21
21
  dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
22
22
  editorAnalyticsAPI?: EditorAnalyticsAPI;
23
+ getEditorFeatureFlags?: GetEditorFeatureFlags;
23
24
  }
24
25
  export declare class FloatingInsertButton extends React.Component<Props & WrappedComponentProps, any> {
25
26
  static displayName: string;
@@ -13,4 +13,4 @@ export interface DragMenuConfig extends DropdownOptionT<Command> {
13
13
  icon?: React.ComponentType<React.PropsWithChildren<IconProps>>;
14
14
  keymap?: string;
15
15
  }
16
- export declare const getDragMenuConfig: (direction: TableDirection, getEditorContainerWidth: GetEditorContainerWidth, canDrag: boolean, hasMergedCellsInTable: boolean, editorView: EditorView, tableMap?: TableMap, index?: number, targetCellPosition?: number, selectionRect?: Rect, editorAnalyticsAPI?: EditorAnalyticsAPI, isHeaderRowRequired?: boolean, isTableScalingEnabled?: boolean) => DragMenuConfig[];
16
+ export declare const getDragMenuConfig: (direction: TableDirection, getEditorContainerWidth: GetEditorContainerWidth, canDrag: boolean, hasMergedCellsInTable: boolean, editorView: EditorView, tableMap?: TableMap, index?: number, targetCellPosition?: number, selectionRect?: Rect, editorAnalyticsAPI?: EditorAnalyticsAPI, isHeaderRowRequired?: boolean, isTableScalingEnabled?: boolean, tableDuplicateCellColouring?: boolean) => DragMenuConfig[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "7.13.0",
3
+ "version": "7.13.1",
4
4
  "description": "Table plugin for the @atlaskit/editor",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -44,7 +44,10 @@ function addColumnAtCustomStep(column: number) {
44
44
  };
45
45
  }
46
46
 
47
- export function addColumnAt(isTableScalingEnabled = false) {
47
+ export function addColumnAt(
48
+ isTableScalingEnabled = false,
49
+ isCellBackgroundDuplicated?: boolean,
50
+ ) {
48
51
  return (
49
52
  column: number,
50
53
  allowAddColumnCustomStep: boolean = false,
@@ -55,7 +58,10 @@ export function addColumnAt(isTableScalingEnabled = false) {
55
58
  if (allowAddColumnCustomStep) {
56
59
  updatedTr = addColumnAtCustomStep(column)(updatedTr);
57
60
  } else {
58
- updatedTr = addColumnAtPMUtils(column)(updatedTr);
61
+ updatedTr = addColumnAtPMUtils(
62
+ column,
63
+ isCellBackgroundDuplicated,
64
+ )(updatedTr);
59
65
  }
60
66
  const table = findTable(updatedTr.selection);
61
67
  if (table) {
@@ -126,10 +132,10 @@ export const addColumnAfter =
126
132
  };
127
133
 
128
134
  export const insertColumn =
129
- (isTableScalingEnabled = false) =>
135
+ (isTableScalingEnabled = false, isCellBackgroundDuplicated?: boolean) =>
130
136
  (column: number): Command =>
131
137
  (state, dispatch, view) => {
132
- let tr = addColumnAt(isTableScalingEnabled)(
138
+ let tr = addColumnAt(isTableScalingEnabled, isCellBackgroundDuplicated)(
133
139
  column,
134
140
  getAllowAddColumnCustomStep(state),
135
141
  view,
@@ -150,7 +156,11 @@ export const insertColumn =
150
156
  };
151
157
 
152
158
  export const insertRow =
153
- (row: number, moveCursorToTheNewRow: boolean): Command =>
159
+ (
160
+ row: number,
161
+ moveCursorToTheNewRow: boolean,
162
+ isCellBackgroundDuplicated?: boolean,
163
+ ): Command =>
154
164
  (state, dispatch) => {
155
165
  // Don't clone the header row
156
166
  const headerRowEnabled = checkIfHeaderRowEnabled(state.selection);
@@ -165,7 +175,7 @@ export const insertRow =
165
175
 
166
176
  const tr = clonePreviousRow
167
177
  ? copyPreviousRow(state.schema)(row)(state.tr)
168
- : addRowAt(row)(state.tr);
178
+ : addRowAt(row, undefined, isCellBackgroundDuplicated)(state.tr);
169
179
 
170
180
  const table = findTable(tr.selection);
171
181
  if (!table) {
@@ -240,7 +240,10 @@ export const addRowAroundSelection =
240
240
  };
241
241
 
242
242
  export const insertRowWithAnalytics =
243
- (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) =>
243
+ (
244
+ editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null,
245
+ isCellbackgroundDuplicated = false,
246
+ ) =>
244
247
  (inputMethod: InsertRowMethods, options: InsertRowOptions) =>
245
248
  withEditorAnalyticsAPI((state) => {
246
249
  const { totalRowCount, totalColumnCount } = getSelectedTableInfo(
@@ -259,7 +262,11 @@ export const insertRowWithAnalytics =
259
262
  eventType: EVENT_TYPE.TRACK,
260
263
  };
261
264
  })(editorAnalyticsAPI)(
262
- insertRow(options.index, options.moveCursorToInsertedRow),
265
+ insertRow(
266
+ options.index,
267
+ options.moveCursorToInsertedRow,
268
+ isCellbackgroundDuplicated,
269
+ ),
263
270
  );
264
271
 
265
272
  export const changeColumnWidthByStepWithAnalytics =
@@ -308,6 +315,7 @@ export const insertColumnWithAnalytics =
308
315
  (
309
316
  editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null,
310
317
  isTableScalingEnabled = false,
318
+ isCellbackgroundDuplicated = false,
311
319
  ) =>
312
320
  (
313
321
  inputMethod:
@@ -334,7 +342,9 @@ export const insertColumnWithAnalytics =
334
342
  },
335
343
  eventType: EVENT_TYPE.TRACK,
336
344
  };
337
- })(editorAnalyticsAPI)(insertColumn(isTableScalingEnabled)(position));
345
+ })(editorAnalyticsAPI)(
346
+ insertColumn(isTableScalingEnabled, isCellbackgroundDuplicated)(position),
347
+ );
338
348
 
339
349
  export const deleteRowsWithAnalytics =
340
350
  (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) =>
package/src/plugin.tsx CHANGED
@@ -552,6 +552,10 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
552
552
  dispatchAnalyticsEvent={dispatchAnalyticsEvent}
553
553
  editorAnalyticsAPI={editorAnalyticsAPI}
554
554
  getEditorContainerWidth={defaultGetEditorContainerWidth}
555
+ getEditorFeatureFlags={
556
+ options?.getEditorFeatureFlags ||
557
+ defaultGetEditorFeatureFlags
558
+ }
555
559
  />
556
560
  )}
557
561
  {options?.allowContextualMenu && (
@@ -586,6 +590,10 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
586
590
  stickyHeaders={stickyHeader}
587
591
  pluginConfig={pluginConfig}
588
592
  isTableScalingEnabled={options?.isTableScalingEnabled}
593
+ getEditorFeatureFlags={
594
+ options?.getEditorFeatureFlags ||
595
+ defaultGetEditorFeatureFlags
596
+ }
589
597
  />
590
598
  )}
591
599
  {allowControls && !isDragAndDropEnabled && !isResizing && (