@atlaskit/editor-plugin-table 7.16.17 → 7.16.19

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 (134) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/cjs/commands/column-resize.js +4 -3
  3. package/dist/cjs/commands/delete.js +3 -2
  4. package/dist/cjs/commands/insert.js +12 -8
  5. package/dist/cjs/commands-with-analytics.js +10 -7
  6. package/dist/cjs/event-handlers.js +3 -2
  7. package/dist/cjs/nodeviews/TableComponent.js +32 -19
  8. package/dist/cjs/nodeviews/TableContainer.js +4 -0
  9. package/dist/cjs/nodeviews/TableResizer.js +8 -7
  10. package/dist/cjs/nodeviews/table.js +6 -4
  11. package/dist/cjs/plugin.js +9 -6
  12. package/dist/cjs/pm-plugins/drag-and-drop/plugin.js +12 -13
  13. package/dist/cjs/pm-plugins/keymap.js +11 -9
  14. package/dist/cjs/pm-plugins/main.js +4 -1
  15. package/dist/cjs/pm-plugins/table-resizing/event-handlers.js +10 -9
  16. package/dist/cjs/pm-plugins/table-resizing/utils/resize-state.js +4 -3
  17. package/dist/cjs/pm-plugins/table-resizing/utils/scale-table.js +4 -3
  18. package/dist/cjs/toolbar.js +54 -37
  19. package/dist/cjs/transforms/column-width.js +3 -3
  20. package/dist/cjs/transforms/delete-columns.js +3 -2
  21. package/dist/cjs/ui/FloatingContextualMenu/ContextualMenu.js +21 -15
  22. package/dist/cjs/ui/FloatingDragMenu/DragMenu.js +3 -2
  23. package/dist/cjs/ui/FloatingDragMenu/index.js +6 -3
  24. package/dist/cjs/ui/FloatingInsertButton/index.js +7 -8
  25. package/dist/cjs/utils/drag-menu.js +5 -4
  26. package/dist/es2019/commands/column-resize.js +4 -3
  27. package/dist/es2019/commands/delete.js +2 -2
  28. package/dist/es2019/commands/insert.js +8 -8
  29. package/dist/es2019/commands-with-analytics.js +9 -8
  30. package/dist/es2019/event-handlers.js +2 -2
  31. package/dist/es2019/nodeviews/TableComponent.js +28 -17
  32. package/dist/es2019/nodeviews/TableContainer.js +4 -0
  33. package/dist/es2019/nodeviews/TableResizer.js +9 -8
  34. package/dist/es2019/nodeviews/table.js +5 -4
  35. package/dist/es2019/plugin.js +9 -6
  36. package/dist/es2019/pm-plugins/drag-and-drop/plugin.js +7 -10
  37. package/dist/es2019/pm-plugins/keymap.js +9 -9
  38. package/dist/es2019/pm-plugins/main.js +4 -1
  39. package/dist/es2019/pm-plugins/table-resizing/event-handlers.js +10 -9
  40. package/dist/es2019/pm-plugins/table-resizing/utils/resize-state.js +4 -4
  41. package/dist/es2019/pm-plugins/table-resizing/utils/scale-table.js +4 -4
  42. package/dist/es2019/toolbar.js +51 -39
  43. package/dist/es2019/transforms/column-width.js +2 -3
  44. package/dist/es2019/transforms/delete-columns.js +2 -2
  45. package/dist/es2019/ui/FloatingContextualMenu/ContextualMenu.js +12 -7
  46. package/dist/es2019/ui/FloatingDragMenu/DragMenu.js +3 -2
  47. package/dist/es2019/ui/FloatingDragMenu/index.js +5 -3
  48. package/dist/es2019/ui/FloatingInsertButton/index.js +6 -8
  49. package/dist/es2019/utils/drag-menu.js +4 -4
  50. package/dist/esm/commands/column-resize.js +4 -3
  51. package/dist/esm/commands/delete.js +3 -2
  52. package/dist/esm/commands/insert.js +12 -8
  53. package/dist/esm/commands-with-analytics.js +10 -7
  54. package/dist/esm/event-handlers.js +3 -2
  55. package/dist/esm/nodeviews/TableComponent.js +32 -19
  56. package/dist/esm/nodeviews/TableContainer.js +4 -0
  57. package/dist/esm/nodeviews/TableResizer.js +9 -8
  58. package/dist/esm/nodeviews/table.js +6 -4
  59. package/dist/esm/plugin.js +9 -6
  60. package/dist/esm/pm-plugins/drag-and-drop/plugin.js +12 -13
  61. package/dist/esm/pm-plugins/keymap.js +11 -9
  62. package/dist/esm/pm-plugins/main.js +4 -1
  63. package/dist/esm/pm-plugins/table-resizing/event-handlers.js +10 -9
  64. package/dist/esm/pm-plugins/table-resizing/utils/resize-state.js +4 -3
  65. package/dist/esm/pm-plugins/table-resizing/utils/scale-table.js +4 -3
  66. package/dist/esm/toolbar.js +54 -37
  67. package/dist/esm/transforms/column-width.js +3 -3
  68. package/dist/esm/transforms/delete-columns.js +3 -2
  69. package/dist/esm/ui/FloatingContextualMenu/ContextualMenu.js +21 -15
  70. package/dist/esm/ui/FloatingDragMenu/DragMenu.js +3 -2
  71. package/dist/esm/ui/FloatingDragMenu/index.js +6 -3
  72. package/dist/esm/ui/FloatingInsertButton/index.js +7 -8
  73. package/dist/esm/utils/drag-menu.js +5 -4
  74. package/dist/types/commands/column-resize.d.ts +2 -1
  75. package/dist/types/commands/delete.d.ts +1 -1
  76. package/dist/types/commands/insert.d.ts +4 -4
  77. package/dist/types/commands-with-analytics.d.ts +4 -4
  78. package/dist/types/event-handlers.d.ts +1 -1
  79. package/dist/types/nodeviews/TableContainer.d.ts +4 -2
  80. package/dist/types/nodeviews/TableResizer.d.ts +2 -1
  81. package/dist/types/nodeviews/table.d.ts +1 -0
  82. package/dist/types/pm-plugins/drag-and-drop/plugin.d.ts +1 -1
  83. package/dist/types/pm-plugins/keymap.d.ts +1 -1
  84. package/dist/types/pm-plugins/table-resizing/utils/resize-state.d.ts +1 -1
  85. package/dist/types/pm-plugins/table-resizing/utils/scale-table.d.ts +1 -1
  86. package/dist/types/toolbar.d.ts +5 -5
  87. package/dist/types/transforms/column-width.d.ts +1 -1
  88. package/dist/types/transforms/delete-columns.d.ts +1 -1
  89. package/dist/types/ui/FloatingDragMenu/DragMenu.d.ts +2 -1
  90. package/dist/types/ui/FloatingInsertButton/index.d.ts +1 -0
  91. package/dist/types/utils/drag-menu.d.ts +1 -1
  92. package/dist/types-ts4.5/commands/column-resize.d.ts +2 -1
  93. package/dist/types-ts4.5/commands/delete.d.ts +1 -1
  94. package/dist/types-ts4.5/commands/insert.d.ts +4 -4
  95. package/dist/types-ts4.5/commands-with-analytics.d.ts +4 -4
  96. package/dist/types-ts4.5/event-handlers.d.ts +1 -1
  97. package/dist/types-ts4.5/nodeviews/TableContainer.d.ts +4 -2
  98. package/dist/types-ts4.5/nodeviews/TableResizer.d.ts +2 -1
  99. package/dist/types-ts4.5/nodeviews/table.d.ts +1 -0
  100. package/dist/types-ts4.5/pm-plugins/drag-and-drop/plugin.d.ts +1 -1
  101. package/dist/types-ts4.5/pm-plugins/keymap.d.ts +1 -1
  102. package/dist/types-ts4.5/pm-plugins/table-resizing/utils/resize-state.d.ts +1 -1
  103. package/dist/types-ts4.5/pm-plugins/table-resizing/utils/scale-table.d.ts +1 -1
  104. package/dist/types-ts4.5/toolbar.d.ts +5 -5
  105. package/dist/types-ts4.5/transforms/column-width.d.ts +1 -1
  106. package/dist/types-ts4.5/transforms/delete-columns.d.ts +1 -1
  107. package/dist/types-ts4.5/ui/FloatingDragMenu/DragMenu.d.ts +2 -1
  108. package/dist/types-ts4.5/ui/FloatingInsertButton/index.d.ts +1 -0
  109. package/dist/types-ts4.5/utils/drag-menu.d.ts +1 -1
  110. package/package.json +5 -8
  111. package/src/commands/column-resize.ts +6 -6
  112. package/src/commands/delete.ts +7 -1
  113. package/src/commands/insert.ts +33 -5
  114. package/src/commands-with-analytics.ts +14 -2
  115. package/src/event-handlers.ts +2 -0
  116. package/src/nodeviews/TableComponent.tsx +28 -28
  117. package/src/nodeviews/TableContainer.tsx +6 -0
  118. package/src/nodeviews/TableResizer.tsx +16 -6
  119. package/src/nodeviews/table.tsx +4 -2
  120. package/src/plugin.tsx +17 -7
  121. package/src/pm-plugins/drag-and-drop/plugin.ts +26 -13
  122. package/src/pm-plugins/keymap.ts +30 -4
  123. package/src/pm-plugins/main.ts +2 -0
  124. package/src/pm-plugins/table-resizing/event-handlers.ts +12 -14
  125. package/src/pm-plugins/table-resizing/utils/resize-state.ts +5 -5
  126. package/src/pm-plugins/table-resizing/utils/scale-table.ts +6 -4
  127. package/src/toolbar.tsx +97 -40
  128. package/src/transforms/column-width.ts +7 -3
  129. package/src/transforms/delete-columns.ts +6 -2
  130. package/src/ui/FloatingContextualMenu/ContextualMenu.tsx +12 -4
  131. package/src/ui/FloatingDragMenu/DragMenu.tsx +3 -0
  132. package/src/ui/FloatingDragMenu/index.tsx +4 -4
  133. package/src/ui/FloatingInsertButton/index.tsx +12 -9
  134. package/src/utils/drag-menu.ts +13 -4
@@ -26,7 +26,6 @@ var _tableMap = require("@atlaskit/editor-tables/table-map");
26
26
  var _utils3 = require("@atlaskit/editor-tables/utils");
27
27
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
28
28
  var _commandsWithAnalytics = require("../../commands-with-analytics");
29
- var _pluginFactory = require("../../pm-plugins/plugin-factory");
30
29
  var _types = require("../../types");
31
30
  var _utils4 = require("../../utils");
32
31
  var _getPopupOptions = _interopRequireDefault(require("./getPopupOptions"));
@@ -200,19 +199,19 @@ var FloatingInsertButton = exports.FloatingInsertButton = /*#__PURE__*/function
200
199
  editorView = _this$props4.editorView,
201
200
  insertColumnButtonIndex = _this$props4.insertColumnButtonIndex,
202
201
  editorAnalyticsAPI = _this$props4.editorAnalyticsAPI,
203
- getEditorFeatureFlags = _this$props4.getEditorFeatureFlags;
202
+ getEditorFeatureFlags = _this$props4.getEditorFeatureFlags,
203
+ isTableScalingEnabled = _this$props4.isTableScalingEnabled;
204
204
  if (typeof insertColumnButtonIndex !== 'undefined') {
205
205
  event.preventDefault();
206
- var _getPluginState = (0, _pluginFactory.getPluginState)(editorView.state),
207
- _getPluginState$isTab = _getPluginState.isTableScalingEnabled,
208
- isTableScalingEnabled = _getPluginState$isTab === void 0 ? false : _getPluginState$isTab;
209
- var shouldUseIncreasedScalingPercent = isTableScalingEnabled && (0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.preserve-widths-with-lock-button') && (0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.use-increased-scaling-percent');
210
206
  var _ref = getEditorFeatureFlags ? getEditorFeatureFlags() : {},
211
207
  _ref$tableDuplicateCe = _ref.tableDuplicateCellColouring,
212
- tableDuplicateCellColouring = _ref$tableDuplicateCe === void 0 ? false : _ref$tableDuplicateCe;
208
+ tableDuplicateCellColouring = _ref$tableDuplicateCe === void 0 ? false : _ref$tableDuplicateCe,
209
+ _ref$tableWithFixedCo = _ref.tableWithFixedColumnWidthsOption,
210
+ tableWithFixedColumnWidthsOption = _ref$tableWithFixedCo === void 0 ? false : _ref$tableWithFixedCo;
211
+ var shouldUseIncreasedScalingPercent = isTableScalingEnabled && tableWithFixedColumnWidthsOption && (0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.use-increased-scaling-percent');
213
212
  var state = editorView.state,
214
213
  dispatch = editorView.dispatch;
215
- (0, _commandsWithAnalytics.insertColumnWithAnalytics)(editorAnalyticsAPI, isTableScalingEnabled, tableDuplicateCellColouring, shouldUseIncreasedScalingPercent)(_analytics.INPUT_METHOD.BUTTON, insertColumnButtonIndex)(state, dispatch, editorView);
214
+ (0, _commandsWithAnalytics.insertColumnWithAnalytics)(editorAnalyticsAPI, isTableScalingEnabled, tableDuplicateCellColouring, tableWithFixedColumnWidthsOption, shouldUseIncreasedScalingPercent)(_analytics.INPUT_METHOD.BUTTON, insertColumnButtonIndex)(state, dispatch, editorView);
216
215
  }
217
216
  }
218
217
  }]);
@@ -79,7 +79,8 @@ var getDragMenuConfig = exports.getDragMenuConfig = function getDragMenuConfig(d
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
81
  var tableDuplicateCellColouring = arguments.length > 12 && arguments[12] !== undefined ? arguments[12] : false;
82
- var shouldUseIncreasedScalingPercent = arguments.length > 13 && arguments[13] !== undefined ? arguments[13] : false;
82
+ var isTableFixedColumnWidthsOptionEnabled = arguments.length > 13 && arguments[13] !== undefined ? arguments[13] : false;
83
+ var shouldUseIncreasedScalingPercent = arguments.length > 14 && arguments[14] !== undefined ? arguments[14] : false;
83
84
  var addOptions = direction === 'row' ? [{
84
85
  label: 'above',
85
86
  offset: 0,
@@ -164,7 +165,7 @@ var getDragMenuConfig = exports.getDragMenuConfig = function getDragMenuConfig(d
164
165
  moveCursorToInsertedRow: true
165
166
  })(state, dispatch);
166
167
  } else {
167
- (0, _commandsWithAnalytics.insertColumnWithAnalytics)(editorAnalyticsAPI, isTableScalingEnabled, tableDuplicateCellColouring, shouldUseIncreasedScalingPercent)(_analytics.INPUT_METHOD.TABLE_CONTEXT_MENU, (index !== null && index !== void 0 ? index : 0) + offset)(state, dispatch, editorView);
168
+ (0, _commandsWithAnalytics.insertColumnWithAnalytics)(editorAnalyticsAPI, isTableScalingEnabled, tableDuplicateCellColouring, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent)(_analytics.INPUT_METHOD.TABLE_CONTEXT_MENU, (index !== null && index !== void 0 ? index : 0) + offset)(state, dispatch, editorView);
168
169
  }
169
170
  return true;
170
171
  },
@@ -177,7 +178,7 @@ var getDragMenuConfig = exports.getDragMenuConfig = function getDragMenuConfig(d
177
178
  onClick: function onClick(state, dispatch) {
178
179
  var selectionRect = (0, _toolbar.getClosestSelectionRect)(state);
179
180
  if (selectionRect) {
180
- var newResizeState = (0, _resizeState.getNewResizeStateFromSelectedColumns)(selectionRect, state, editorView.domAtPos.bind(editorView), getEditorContainerWidth, isTableScalingEnabled);
181
+ var newResizeState = (0, _resizeState.getNewResizeStateFromSelectedColumns)(selectionRect, state, editorView.domAtPos.bind(editorView), getEditorContainerWidth, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled);
181
182
  if (newResizeState) {
182
183
  (0, _commandsWithAnalytics.distributeColumnsWidthsWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.TABLE_CONTEXT_MENU, newResizeState)(state, dispatch);
183
184
  return true;
@@ -203,7 +204,7 @@ var getDragMenuConfig = exports.getDragMenuConfig = function getDragMenuConfig(d
203
204
  if (direction === 'row') {
204
205
  (0, _commandsWithAnalytics.deleteRowsWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.TABLE_CONTEXT_MENU, selectionRect !== null && selectionRect !== void 0 ? selectionRect : defaultSelectionRect, !!isHeaderRowRequired)(state, dispatch);
205
206
  } else {
206
- (0, _commandsWithAnalytics.deleteColumnsWithAnalytics)(editorAnalyticsAPI, isTableScalingEnabled)(_analytics.INPUT_METHOD.TABLE_CONTEXT_MENU, selectionRect !== null && selectionRect !== void 0 ? selectionRect : defaultSelectionRect)(state, dispatch, editorView);
207
+ (0, _commandsWithAnalytics.deleteColumnsWithAnalytics)(editorAnalyticsAPI, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent)(_analytics.INPUT_METHOD.TABLE_CONTEXT_MENU, selectionRect !== null && selectionRect !== void 0 ? selectionRect : defaultSelectionRect)(state, dispatch, editorView);
207
208
  }
208
209
  return true;
209
210
  },
@@ -154,6 +154,7 @@ export const changeColumnWidthByStep = ({
154
154
  stepSize,
155
155
  getEditorContainerWidth,
156
156
  isTableScalingEnabled,
157
+ isTableFixedColumnWidthsOptionEnabled,
157
158
  ariaNotify,
158
159
  getIntl
159
160
  }) => (state, dispatch, view) => {
@@ -206,11 +207,11 @@ export const changeColumnWidthByStep = ({
206
207
  getEditorContainerWidth
207
208
  });
208
209
  let isTableScalingEnabledOnCurrentTable = isTableScalingEnabled;
209
- const isTableScalingEnabledWithLockButton = isTableScalingEnabled && getBooleanFF('platform.editor.table.preserve-widths-with-lock-button');
210
- if (isTableScalingEnabledWithLockButton) {
210
+ const isTableScalingWithFixedColumnWidthsOptionEnabled = isTableScalingEnabled && isTableFixedColumnWidthsOptionEnabled;
211
+ if (isTableScalingWithFixedColumnWidthsOptionEnabled) {
211
212
  isTableScalingEnabledOnCurrentTable = originalTable.attrs.displayMode !== 'fixed';
212
213
  }
213
- const shouldUseIncreasedScalingPercent = isTableScalingEnabledWithLockButton && getBooleanFF('platform.editor.table.use-increased-scaling-percent');
214
+ const shouldUseIncreasedScalingPercent = isTableScalingWithFixedColumnWidthsOptionEnabled && getBooleanFF('platform.editor.table.use-increased-scaling-percent');
214
215
  const initialResizeState = getResizeState({
215
216
  minWidth: tableCellMinWidth,
216
217
  maxSize,
@@ -1,7 +1,7 @@
1
1
  import { deleteColumns } from '../transforms/delete-columns';
2
2
  import { getAllowAddColumnCustomStep } from '../utils/get-allow-add-column-custom-step';
3
- export const deleteColumnsCommand = (rect, isTableScalingEnabled = false, shouldUseIncreasedScalingPercent = false) => (state, dispatch, view) => {
4
- const tr = deleteColumns(rect, getAllowAddColumnCustomStep(state), view, isTableScalingEnabled, shouldUseIncreasedScalingPercent)(state.tr);
3
+ export const deleteColumnsCommand = (rect, isTableScalingEnabled = false, isTableFixedColumnWidthsOptionEnabled = false, shouldUseIncreasedScalingPercent = false) => (state, dispatch, view) => {
4
+ const tr = deleteColumns(rect, getAllowAddColumnCustomStep(state), view, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent)(state.tr);
5
5
  if (dispatch) {
6
6
  dispatch(tr);
7
7
  return true;
@@ -19,7 +19,7 @@ function addColumnAtCustomStep(column) {
19
19
  return tr;
20
20
  };
21
21
  }
22
- export function addColumnAt(isTableScalingEnabled = false, isCellBackgroundDuplicated, shouldUseIncreasedScalingPercent) {
22
+ export function addColumnAt(isTableScalingEnabled = false, isCellBackgroundDuplicated, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent) {
23
23
  return (column, allowAddColumnCustomStep = false, view) => {
24
24
  return tr => {
25
25
  let updatedTr = tr;
@@ -31,7 +31,7 @@ export function addColumnAt(isTableScalingEnabled = false, isCellBackgroundDupli
31
31
  const table = findTable(updatedTr.selection);
32
32
  if (table) {
33
33
  // [ED-8288] Update colwidths manually to avoid multiple dispatch in TableComponent
34
- updatedTr = rescaleColumns(isTableScalingEnabled, shouldUseIncreasedScalingPercent)(table, view)(updatedTr);
34
+ updatedTr = rescaleColumns(isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent)(table, view)(updatedTr);
35
35
  }
36
36
  if (view) {
37
37
  updatedTr = updateRowOrColumnMovedTransform({
@@ -48,33 +48,33 @@ export function addColumnAt(isTableScalingEnabled = false, isCellBackgroundDupli
48
48
 
49
49
  // :: (EditorState, dispatch: ?(tr: Transaction)) → bool
50
50
  // Command to add a column before the column with the selection.
51
- export const addColumnBefore = (isTableScalingEnabled = false, shouldUseIncreasedScalingPercent = false) => (state, dispatch, view) => {
51
+ export const addColumnBefore = (isTableScalingEnabled = false, isCellBackgroundDuplicated = false, isTableFixedColumnWidthsOptionEnabled = false, shouldUseIncreasedScalingPercent = false) => (state, dispatch, view) => {
52
52
  const table = findTable(state.selection);
53
53
  if (!table) {
54
54
  return false;
55
55
  }
56
56
  if (dispatch) {
57
57
  let rect = selectedRect(state);
58
- dispatch(addColumnAt(isTableScalingEnabled, shouldUseIncreasedScalingPercent)(rect.left, getAllowAddColumnCustomStep(state), view)(state.tr));
58
+ dispatch(addColumnAt(isTableScalingEnabled, isCellBackgroundDuplicated, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent)(rect.left, getAllowAddColumnCustomStep(state), view)(state.tr));
59
59
  }
60
60
  return true;
61
61
  };
62
62
 
63
63
  // :: (EditorState, dispatch: ?(tr: Transaction)) → bool
64
64
  // Command to add a column after the column with the selection.
65
- export const addColumnAfter = (isTableScalingEnabled, shouldUseIncreasedScalingPercent) => (state, dispatch, view) => {
65
+ export const addColumnAfter = (isTableScalingEnabled, isCellBackgroundDuplicated, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent) => (state, dispatch, view) => {
66
66
  const table = findTable(state.selection);
67
67
  if (!table) {
68
68
  return false;
69
69
  }
70
70
  if (dispatch) {
71
71
  let rect = selectedRect(state);
72
- dispatch(addColumnAt(isTableScalingEnabled, shouldUseIncreasedScalingPercent)(rect.right, getAllowAddColumnCustomStep(state), view)(state.tr));
72
+ dispatch(addColumnAt(isTableScalingEnabled, isCellBackgroundDuplicated, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent)(rect.right, getAllowAddColumnCustomStep(state), view)(state.tr));
73
73
  }
74
74
  return true;
75
75
  };
76
- export const insertColumn = (isTableScalingEnabled = false, isCellBackgroundDuplicated, shouldUseIncreasedScalingPercent) => column => (state, dispatch, view) => {
77
- let tr = addColumnAt(isTableScalingEnabled, isCellBackgroundDuplicated, shouldUseIncreasedScalingPercent)(column, getAllowAddColumnCustomStep(state), view)(state.tr);
76
+ export const insertColumn = (isTableScalingEnabled = false, isCellBackgroundDuplicated, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent) => column => (state, dispatch, view) => {
77
+ let tr = addColumnAt(isTableScalingEnabled, isCellBackgroundDuplicated, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent)(column, getAllowAddColumnCustomStep(state), view)(state.tr);
78
78
  const table = findTable(tr.selection);
79
79
  if (!table) {
80
80
  return false;
@@ -171,7 +171,7 @@ export const insertRowWithAnalytics = (editorAnalyticsAPI, isCellbackgroundDupli
171
171
  eventType: EVENT_TYPE.TRACK
172
172
  };
173
173
  })(editorAnalyticsAPI)(insertRow(options.index, options.moveCursorToInsertedRow, isCellbackgroundDuplicated));
174
- export const changeColumnWidthByStepWithAnalytics = editorAnalyticsAPI => (stepSize, getEditorContainerWidth, isTableScalingEnabled, inputMethod, ariaNotify, getIntl) => withEditorAnalyticsAPI(state => {
174
+ export const changeColumnWidthByStepWithAnalytics = editorAnalyticsAPI => (stepSize, getEditorContainerWidth, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, inputMethod, ariaNotify, getIntl) => withEditorAnalyticsAPI(state => {
175
175
  const {
176
176
  table,
177
177
  totalRowCount,
@@ -199,11 +199,12 @@ export const changeColumnWidthByStepWithAnalytics = editorAnalyticsAPI => (stepS
199
199
  })(editorAnalyticsAPI)(changeColumnWidthByStep({
200
200
  stepSize: stepSize,
201
201
  getEditorContainerWidth: getEditorContainerWidth,
202
- isTableScalingEnabled: isTableScalingEnabled,
202
+ isTableScalingEnabled,
203
+ isTableFixedColumnWidthsOptionEnabled,
203
204
  ariaNotify: ariaNotify,
204
205
  getIntl: getIntl
205
206
  }));
206
- export const insertColumnWithAnalytics = (editorAnalyticsAPI, isTableScalingEnabled = false, isCellbackgroundDuplicated = false, shouldUseIncreasedScalingPercent = false) => (inputMethod, position) => withEditorAnalyticsAPI(state => {
207
+ export const insertColumnWithAnalytics = (editorAnalyticsAPI, isTableScalingEnabled = false, isCellbackgroundDuplicated = false, isTableFixedColumnWidthsOptionEnabled = false, shouldUseIncreasedScalingPercent = false) => (inputMethod, position) => withEditorAnalyticsAPI(state => {
207
208
  const {
208
209
  totalRowCount,
209
210
  totalColumnCount
@@ -220,7 +221,7 @@ export const insertColumnWithAnalytics = (editorAnalyticsAPI, isTableScalingEnab
220
221
  },
221
222
  eventType: EVENT_TYPE.TRACK
222
223
  };
223
- })(editorAnalyticsAPI)(insertColumn(isTableScalingEnabled, isCellbackgroundDuplicated, shouldUseIncreasedScalingPercent)(position));
224
+ })(editorAnalyticsAPI)(insertColumn(isTableScalingEnabled, isCellbackgroundDuplicated, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent)(position));
224
225
  export const deleteRowsWithAnalytics = editorAnalyticsAPI => (inputMethod, rect, isHeaderRowRequired) => withEditorAnalyticsAPI(({
225
226
  selection
226
227
  }) => {
@@ -247,7 +248,7 @@ export const deleteRowsWithAnalytics = editorAnalyticsAPI => (inputMethod, rect,
247
248
  }
248
249
  return true;
249
250
  });
250
- export const deleteColumnsWithAnalytics = (editorAnalyticsAPI, isTableScalingEnabled = false, shouldUseIncreasedScalingPercent = false) => (inputMethod, rect) => withEditorAnalyticsAPI(({
251
+ export const deleteColumnsWithAnalytics = (editorAnalyticsAPI, isTableScalingEnabled = false, isTableFixedColumnWidthsOptionEnabled = false, shouldUseIncreasedScalingPercent = false) => (inputMethod, rect) => withEditorAnalyticsAPI(({
251
252
  selection
252
253
  }) => {
253
254
  const {
@@ -267,8 +268,8 @@ export const deleteColumnsWithAnalytics = (editorAnalyticsAPI, isTableScalingEna
267
268
  },
268
269
  eventType: EVENT_TYPE.TRACK
269
270
  };
270
- })(editorAnalyticsAPI)(deleteColumnsCommand(rect, isTableScalingEnabled, shouldUseIncreasedScalingPercent));
271
- export const deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut = (editorAnalyticsAPI, isTableScalingEnabled, shouldUseIncreasedScalingPercent) => (state, dispatch) => {
271
+ })(editorAnalyticsAPI)(deleteColumnsCommand(rect, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent));
272
+ export const deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut = (editorAnalyticsAPI, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent) => (state, dispatch) => {
272
273
  const {
273
274
  selection
274
275
  } = state;
@@ -288,7 +289,7 @@ export const deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut = (editorAnalyt
288
289
  const isHeaderRowRequired = pluginConfig.isHeaderRowRequired || false;
289
290
  return deleteRowsWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT, rect, isHeaderRowRequired)(state, dispatch);
290
291
  } else if (selectionType === 'column') {
291
- return deleteColumnsWithAnalytics(editorAnalyticsAPI, isTableScalingEnabled, shouldUseIncreasedScalingPercent)(INPUT_METHOD.SHORTCUT, rect)(state, dispatch);
292
+ return deleteColumnsWithAnalytics(editorAnalyticsAPI, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent)(INPUT_METHOD.SHORTCUT, rect)(state, dispatch);
292
293
  } else {
293
294
  return false;
294
295
  }
@@ -361,7 +361,7 @@ export function handleTripleClick(view, pos) {
361
361
  }
362
362
  return false;
363
363
  }
364
- export const handleCut = (oldTr, oldState, newState, editorAnalyticsAPI, editorView, isTableScalingEnabled = false, shouldUseIncreasedScalingPercent = false) => {
364
+ export const handleCut = (oldTr, oldState, newState, editorAnalyticsAPI, editorView, isTableScalingEnabled = false, isTableFixedColumnWidthsOptionEnabled = false, shouldUseIncreasedScalingPercent = false) => {
365
365
  const oldSelection = oldState.tr.selection;
366
366
  let {
367
367
  tr
@@ -410,7 +410,7 @@ export const handleCut = (oldTr, oldState, newState, editorAnalyticsAPI, editorV
410
410
  } = getPluginState(newState);
411
411
  tr = deleteRows(rect, isHeaderRowRequired)(tr);
412
412
  } else if (tr.selection.isColSelection()) {
413
- tr = deleteColumns(rect, getAllowAddColumnCustomStep(oldState), editorView, isTableScalingEnabled, shouldUseIncreasedScalingPercent)(tr);
413
+ tr = deleteColumns(rect, getAllowAddColumnCustomStep(oldState), editorView, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent)(tr);
414
414
  }
415
415
  }
416
416
  }
@@ -344,19 +344,20 @@ class TableComponent extends React.Component {
344
344
  this === null || this === void 0 ? void 0 : (_this$table = this.table) === null || _this$table === void 0 ? void 0 : _this$table.addEventListener('mouseenter', this.handleMouseEnter);
345
345
  }
346
346
  }
347
- if (isTableScalingEnabled && !getBooleanFF('platform.editor.table.preserve-widths-with-lock-button')) {
347
+ const {
348
+ tableWithFixedColumnWidthsOption = false,
349
+ stickyScrollbar
350
+ } = getEditorFeatureFlags();
351
+ if (isTableScalingEnabled && !tableWithFixedColumnWidthsOption) {
348
352
  this.handleColgroupUpdates(true);
349
353
  }
350
- if (isTableScalingEnabled && getBooleanFF('platform.editor.table.preserve-widths-with-lock-button') && getNode().attrs.displayMode !== 'fixed') {
354
+ if (isTableScalingEnabled && tableWithFixedColumnWidthsOption && getNode().attrs.displayMode !== 'fixed') {
351
355
  this.handleColgroupUpdates(true);
352
356
  }
353
357
  if (allowColumnResizing && this.wrapper && !isIE11) {
354
358
  this.wrapper.addEventListener('scroll', this.handleScrollDebounced, {
355
359
  passive: true
356
360
  });
357
- const {
358
- stickyScrollbar
359
- } = getEditorFeatureFlags();
360
361
  if (stickyScrollbar) {
361
362
  if (this.table) {
362
363
  this.stickyScrollbar = new TableStickyScrollbar(this.wrapper, this.props.view);
@@ -441,7 +442,8 @@ class TableComponent extends React.Component {
441
442
  containerWidth,
442
443
  isResizing,
443
444
  view,
444
- getPos
445
+ getPos,
446
+ getEditorFeatureFlags
445
447
  } = this.props;
446
448
  if (!this.table) {
447
449
  return;
@@ -475,8 +477,11 @@ class TableComponent extends React.Component {
475
477
  const isColumnsDistributed = wasTableResized && !isTableResized;
476
478
  const isTableDisplayModeChanged = this.node.attrs.displayMode !== tableNode.attrs.displayMode;
477
479
  const shouldUpdateColgroup = isWidthChanged || isColumnsDistributed || isTableResizedFullWidth || isTableWidthChanged || isTableDisplayModeChanged || isNumberColumnChanged || isNumberOfColumnsChanged;
478
- const isTableScalingEnabledWithLockButton = ((_this$props$options = this.props.options) === null || _this$props$options === void 0 ? void 0 : _this$props$options.isTableScalingEnabled) && getBooleanFF('platform.editor.table.preserve-widths-with-lock-button');
479
- const shouldUseIncreasedScalingPercent = isTableScalingEnabledWithLockButton && getBooleanFF('platform.editor.table.use-increased-scaling-percent') || false;
480
+ const {
481
+ tableWithFixedColumnWidthsOption = false
482
+ } = getEditorFeatureFlags();
483
+ const isTableScalingWithFixedColumnWidthsOptionEnabled = ((_this$props$options = this.props.options) === null || _this$props$options === void 0 ? void 0 : _this$props$options.isTableScalingEnabled) && tableWithFixedColumnWidthsOption;
484
+ const shouldUseIncreasedScalingPercent = isTableScalingWithFixedColumnWidthsOptionEnabled && getBooleanFF('platform.editor.table.use-increased-scaling-percent') || false;
480
485
  if (force || !isResizing && shouldUpdateColgroup) {
481
486
  var _this$props$options2;
482
487
  const resizeState = getResizeState({
@@ -490,10 +495,10 @@ class TableComponent extends React.Component {
490
495
  shouldUseIncreasedScalingPercent
491
496
  });
492
497
  let shouldScaleOnColgroupUpdate = false;
493
- if ((_this$props$options2 = this.props.options) !== null && _this$props$options2 !== void 0 && _this$props$options2.isTableScalingEnabled && !getBooleanFF('platform.editor.table.preserve-widths-with-lock-button')) {
498
+ if ((_this$props$options2 = this.props.options) !== null && _this$props$options2 !== void 0 && _this$props$options2.isTableScalingEnabled && !tableWithFixedColumnWidthsOption) {
494
499
  shouldScaleOnColgroupUpdate = true;
495
500
  }
496
- if (isTableScalingEnabledWithLockButton && tableNode.attrs.displayMode !== 'fixed') {
501
+ if (isTableScalingWithFixedColumnWidthsOptionEnabled && tableNode.attrs.displayMode !== 'fixed') {
497
502
  shouldScaleOnColgroupUpdate = true;
498
503
  }
499
504
 
@@ -518,7 +523,8 @@ class TableComponent extends React.Component {
518
523
  options,
519
524
  isTableScalingEnabled,
520
525
  // we could use options.isTableScalingEnabled here
521
- getPos
526
+ getPos,
527
+ getEditorFeatureFlags
522
528
  } = this.props;
523
529
  let {
524
530
  isInDanger
@@ -530,13 +536,16 @@ class TableComponent extends React.Component {
530
536
  }
531
537
  let shouldScale = false;
532
538
  let shouldHandleColgroupUpdates = false;
533
- if (isTableScalingEnabled && !getBooleanFF('platform.editor.table.preserve-widths-with-lock-button')) {
539
+ const {
540
+ tableWithFixedColumnWidthsOption = false
541
+ } = getEditorFeatureFlags();
542
+ if (isTableScalingEnabled && !tableWithFixedColumnWidthsOption) {
534
543
  shouldScale = true;
535
544
  shouldHandleColgroupUpdates = true;
536
545
  }
537
- const isTableScalingEnabledWithLockButton = isTableScalingEnabled && getBooleanFF('platform.editor.table.preserve-widths-with-lock-button');
538
- const shouldUseIncreasedScalingPercent = isTableScalingEnabledWithLockButton && getBooleanFF('platform.editor.table.use-increased-scaling-percent');
539
- if (isTableScalingEnabledWithLockButton && getNode().attrs.displayMode !== 'fixed') {
546
+ const isTableScalingWithFixedColumnWidthsOptionEnabled = isTableScalingEnabled && tableWithFixedColumnWidthsOption;
547
+ const shouldUseIncreasedScalingPercent = isTableScalingWithFixedColumnWidthsOptionEnabled && getBooleanFF('platform.editor.table.use-increased-scaling-percent');
548
+ if (isTableScalingWithFixedColumnWidthsOptionEnabled && getNode().attrs.displayMode !== 'fixed') {
540
549
  shouldScale = true;
541
550
  shouldHandleColgroupUpdates = true;
542
551
  }
@@ -743,9 +752,10 @@ class TableComponent extends React.Component {
743
752
  const isNested = isTableNested(view.state, tablePos);
744
753
  const topStickyShadowPosition = isDragAndDropEnabled ? this.state.stickyHeader && this.state.stickyHeader.top + this.state.stickyHeader.padding + 2 : this.state.stickyHeader && this.state.stickyHeader.top + this.state.stickyHeader.padding + shadowPadding + 2;
745
754
  const {
746
- stickyScrollbar
755
+ stickyScrollbar,
756
+ tableWithFixedColumnWidthsOption = false
747
757
  } = getEditorFeatureFlags();
748
- const shouldUseIncreasedScalingPercent = isTableScalingEnabled && getBooleanFF('platform.editor.table.preserve-widths-with-lock-button') && getBooleanFF('platform.editor.table.use-increased-scaling-percent');
758
+ const shouldUseIncreasedScalingPercent = isTableScalingEnabled && tableWithFixedColumnWidthsOption && getBooleanFF('platform.editor.table.use-increased-scaling-percent');
749
759
  return /*#__PURE__*/React.createElement(TableContainer
750
760
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
751
761
  , {
@@ -766,6 +776,7 @@ class TableComponent extends React.Component {
766
776
  isTableResizingEnabled: options === null || options === void 0 ? void 0 : options.isTableResizingEnabled,
767
777
  isResizing: isResizing,
768
778
  isTableScalingEnabled: isTableScalingEnabled,
779
+ isTableWithFixedColumnWidthsOptionEnabled: tableWithFixedColumnWidthsOption,
769
780
  isWholeTableInDanger: isWholeTableInDanger,
770
781
  isTableAlignmentEnabled: isTableAlignmentEnabled,
771
782
  shouldUseIncreasedScalingPercent: shouldUseIncreasedScalingPercent
@@ -123,6 +123,7 @@ export const ResizableTableContainer = /*#__PURE__*/React.memo(({
123
123
  tableWrapperHeight,
124
124
  isWholeTableInDanger,
125
125
  isTableScalingEnabled,
126
+ isTableWithFixedColumnWidthsOptionEnabled,
126
127
  isTableAlignmentEnabled,
127
128
  shouldUseIncreasedScalingPercent
128
129
  }) => {
@@ -231,6 +232,7 @@ export const ResizableTableContainer = /*#__PURE__*/React.memo(({
231
232
  isTableAlignmentEnabled,
232
233
  isFullWidthModeEnabled,
233
234
  isTableScalingEnabled,
235
+ isTableWithFixedColumnWidthsOptionEnabled,
234
236
  isWholeTableInDanger,
235
237
  shouldUseIncreasedScalingPercent,
236
238
  pluginInjectionApi,
@@ -287,6 +289,7 @@ export const TableContainer = ({
287
289
  isWholeTableInDanger,
288
290
  isTableResizingEnabled,
289
291
  isTableScalingEnabled,
292
+ isTableWithFixedColumnWidthsOptionEnabled,
290
293
  isTableAlignmentEnabled,
291
294
  shouldUseIncreasedScalingPercent
292
295
  }) => {
@@ -305,6 +308,7 @@ export const TableContainer = ({
305
308
  isResizing: isResizing,
306
309
  pluginInjectionApi: pluginInjectionApi,
307
310
  isTableScalingEnabled: isTableScalingEnabled,
311
+ isTableWithFixedColumnWidthsOptionEnabled: isTableWithFixedColumnWidthsOptionEnabled,
308
312
  isWholeTableInDanger: isWholeTableInDanger,
309
313
  isTableAlignmentEnabled: isTableAlignmentEnabled,
310
314
  shouldUseIncreasedScalingPercent: shouldUseIncreasedScalingPercent
@@ -9,7 +9,7 @@ import { tableMessages as messages } from '@atlaskit/editor-common/messages';
9
9
  import { ResizerNext } from '@atlaskit/editor-common/resizer';
10
10
  import { browser } from '@atlaskit/editor-common/utils';
11
11
  import { chainCommands } from '@atlaskit/editor-prosemirror/commands';
12
- import { akEditorGutterPadding } from '@atlaskit/editor-shared-styles';
12
+ import { akEditorGutterPaddingDynamic } from '@atlaskit/editor-shared-styles';
13
13
  import { findTable } from '@atlaskit/editor-tables/utils';
14
14
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
15
15
  import { setTableAlignmentWithTableContentWithPosWithAnalytics } from '../commands-with-analytics';
@@ -81,7 +81,7 @@ const getVisibleGuidelines = (guidelines, containerWidth, lineLength, isTableSca
81
81
  // guidelineVisibleAdjustment is set as a negative value, so we making it positive and adding + 1
82
82
  const preserve_table_widths_adjustment = -1 * PRESERVE_TABLE_GUIDELINES_LENGTH_OFFSET + 1;
83
83
  guidelineVisibleAdjustment = isFullWidthModeEnabled ? preserve_table_widths_adjustment // guidelineVisibleAdjustment = -2, if lineLength = 1180, 1181 < 1180 + 2 is true.
84
- : -2 * akEditorGutterPadding + preserve_table_widths_adjustment; // guidelineVisibleAdjustment = -62, if containerWidth is 1244, 1181 < 1244 - 62 = 1182 is true.
84
+ : -2 * akEditorGutterPaddingDynamic() + preserve_table_widths_adjustment; // guidelineVisibleAdjustment = -62, if containerWidth is 1244, 1181 < 1244 - 62 = 1182 is true.
85
85
  }
86
86
  const width = isTableScalingEnabled && isFullWidthModeEnabled ? lineLength : containerWidth;
87
87
  return guidelines.filter(guideline => {
@@ -105,6 +105,7 @@ export const TableResizer = ({
105
105
  attachAnalyticsEvent,
106
106
  displayGapCursor,
107
107
  isTableScalingEnabled,
108
+ isTableWithFixedColumnWidthsOptionEnabled,
108
109
  isTableAlignmentEnabled,
109
110
  isWholeTableInDanger,
110
111
  shouldUseIncreasedScalingPercent,
@@ -148,14 +149,14 @@ export const TableResizer = ({
148
149
  }) => {
149
150
  if (gap !== currentGap.current) {
150
151
  currentGap.current = gap;
151
- const visibleGuidelines = getVisibleGuidelines(isTableScalingEnabled ? defaultGuidelinesForPreserveTable(PRESERVE_TABLE_GUIDELINES_LENGTH_OFFSET, isFullWidthModeEnabled ? lineLength + 2 * akEditorGutterPadding : containerWidth, excludeGuidelineConfig) : defaultGuidelines, containerWidth, lineLength, Boolean(isTableScalingEnabled), Boolean(isFullWidthModeEnabled));
152
+ const visibleGuidelines = getVisibleGuidelines(isTableScalingEnabled ? defaultGuidelinesForPreserveTable(PRESERVE_TABLE_GUIDELINES_LENGTH_OFFSET, isFullWidthModeEnabled ? lineLength + 2 * akEditorGutterPaddingDynamic() : containerWidth, excludeGuidelineConfig) : defaultGuidelines, containerWidth, lineLength, Boolean(isTableScalingEnabled), Boolean(isFullWidthModeEnabled));
152
153
  displayGuideline(getGuidelinesWithHighlights(gap, TABLE_SNAP_GAP, keys, visibleGuidelines));
153
154
  }
154
155
  }, [isTableScalingEnabled, excludeGuidelineConfig, containerWidth, displayGuideline, lineLength, isFullWidthModeEnabled]);
155
156
  const guidelineSnaps = useMemo(() => snappingEnabled ? {
156
157
  x: isTableScalingEnabled ? defaultTablePreserveSnappingWidths(PRESERVE_TABLE_SNAPPING_LENGTH_OFFSET,
157
158
  // was hardcoded to 0, using PRESERVE_TABLE_SNAPPING_LENGTH_OFFSET instead.
158
- isFullWidthModeEnabled ? lineLength + 2 * akEditorGutterPadding : containerWidth, excludeGuidelineConfig) : defaultSnappingWidths
159
+ isFullWidthModeEnabled ? lineLength + 2 * akEditorGutterPaddingDynamic() : containerWidth, excludeGuidelineConfig) : defaultSnappingWidths
159
160
  } : undefined, [snappingEnabled, isTableScalingEnabled, excludeGuidelineConfig, containerWidth, lineLength, isFullWidthModeEnabled]);
160
161
  const switchToCenterAlignment = useCallback((pos, node, newWidth, state, dispatch) => {
161
162
  if (isTableAlignmentEnabled && node && node.attrs.layout === ALIGN_START && newWidth > lineLength && lineLength < FULL_WIDTH_EDITOR_CONTENT_WIDTH &&
@@ -212,7 +213,7 @@ export const TableResizer = ({
212
213
  name: TABLE_OVERFLOW_CHANGE_TRIGGER.RESIZED
213
214
  });
214
215
  dispatch(tr);
215
- const visibleGuidelines = getVisibleGuidelines(isTableScalingEnabled ? defaultGuidelinesForPreserveTable(PRESERVE_TABLE_GUIDELINES_LENGTH_OFFSET, isFullWidthModeEnabled ? lineLength + 2 * akEditorGutterPadding : containerWidth, excludeGuidelineConfig) : defaultGuidelines, containerWidth, lineLength, Boolean(isTableScalingEnabled), Boolean(isFullWidthModeEnabled));
216
+ const visibleGuidelines = getVisibleGuidelines(isTableScalingEnabled ? defaultGuidelinesForPreserveTable(PRESERVE_TABLE_GUIDELINES_LENGTH_OFFSET, isFullWidthModeEnabled ? lineLength + 2 * akEditorGutterPaddingDynamic() : containerWidth, excludeGuidelineConfig) : defaultGuidelines, containerWidth, lineLength, Boolean(isTableScalingEnabled), Boolean(isFullWidthModeEnabled));
216
217
  setSnappingEnabled(displayGuideline(visibleGuidelines));
217
218
  if (onResizeStart) {
218
219
  onResizeStart();
@@ -236,8 +237,8 @@ export const TableResizer = ({
236
237
  prevNode: node,
237
238
  start: pos + 1,
238
239
  parentWidth: newWidth
239
- }, editorView.domAtPos.bind(editorView), isTableScalingEnabled);
240
- const editorContainerWidth = isFullWidthModeEnabled ? lineLength + 2 * akEditorGutterPadding : containerWidth;
240
+ }, editorView.domAtPos.bind(editorView), isTableScalingEnabled, isTableWithFixedColumnWidthsOptionEnabled);
241
+ const editorContainerWidth = isFullWidthModeEnabled ? lineLength + 2 * akEditorGutterPaddingDynamic() : containerWidth;
241
242
  const closestSnap = findClosestSnap(newWidth, isTableScalingEnabled ? defaultTablePreserveSnappingWidths(PRESERVE_TABLE_SNAPPING_LENGTH_OFFSET, editorContainerWidth, excludeGuidelineConfig) : defaultSnappingWidths, isTableScalingEnabled ? defaultGuidelinesForPreserveTable(PRESERVE_TABLE_GUIDELINES_LENGTH_OFFSET, editorContainerWidth, excludeGuidelineConfig) : defaultGuidelines, TABLE_HIGHLIGHT_GAP, TABLE_HIGHLIGHT_TOLERANCE);
242
243
  updateActiveGuidelines(closestSnap);
243
244
 
@@ -257,7 +258,7 @@ export const TableResizer = ({
257
258
  }))(state, dispatch);
258
259
  updateWidth(shouldUpdateWidthToWidest ? TABLE_MAX_WIDTH : newWidth);
259
260
  return newWidth;
260
- }, [countFrames, isTableScalingEnabled, isFullWidthModeEnabled, excludeGuidelineConfig, tableRef, node, editorView, updateActiveGuidelines, containerWidth, lineLength, updateWidth, getPos, switchToCenterAlignment]);
261
+ }, [countFrames, isTableScalingEnabled, isTableWithFixedColumnWidthsOptionEnabled, isFullWidthModeEnabled, excludeGuidelineConfig, tableRef, node, editorView, updateActiveGuidelines, containerWidth, lineLength, updateWidth, getPos, switchToCenterAlignment]);
261
262
  const scheduleResize = useMemo(() => rafSchd(handleResize), [handleResize]);
262
263
  const handleResizeStop = useCallback((originalState, delta) => {
263
264
  var _node$attrs$localId2, _node$attrs2;
@@ -61,13 +61,14 @@ export default class TableView extends ReactNodeView {
61
61
  this.getPos = props.getPos;
62
62
  this.eventDispatcher = props.eventDispatcher;
63
63
  this.options = props.options;
64
+ this.getEditorFeatureFlags = props.getEditorFeatureFlags;
64
65
  }
65
66
  getContentDOM() {
66
67
  const rendered = DOMSerializer.renderSpec(document, toDOM(this.node, this.reactComponentProps));
67
68
  if (rendered.dom) {
68
- var _this$options, _this$options2;
69
+ var _this$options, _this$options2, _this$getEditorFeatur;
69
70
  this.table = rendered.dom;
70
- if (!((_this$options = this.options) !== null && _this$options !== void 0 && _this$options.isTableScalingEnabled) || (_this$options2 = this.options) !== null && _this$options2 !== void 0 && _this$options2.isTableScalingEnabled && getBooleanFF('platform.editor.table.preserve-widths-with-lock-button') && this.node.attrs.displayMode === 'fixed') {
71
+ if (!((_this$options = this.options) !== null && _this$options !== void 0 && _this$options.isTableScalingEnabled) || (_this$options2 = this.options) !== null && _this$options2 !== void 0 && _this$options2.isTableScalingEnabled && (_this$getEditorFeatur = this.getEditorFeatureFlags) !== null && _this$getEditorFeatur !== void 0 && _this$getEditorFeatur.call(this).tableWithFixedColumnWidthsOption && this.node.attrs.displayMode === 'fixed') {
71
72
  const tableInlineWidth = getInlineWidth(this.node, this.reactComponentProps.options, this.reactComponentProps.view.state, this.reactComponentProps.getPos());
72
73
  if (tableInlineWidth) {
73
74
  handleInlineTableWidth(this.table, tableInlineWidth);
@@ -77,7 +78,7 @@ export default class TableView extends ReactNodeView {
77
78
  return rendered;
78
79
  }
79
80
  setDomAttrs(node) {
80
- var _this$options3, _this$options4;
81
+ var _this$options3, _this$options4, _this$getEditorFeatur2;
81
82
  if (!this.table) {
82
83
  return;
83
84
  }
@@ -87,7 +88,7 @@ export default class TableView extends ReactNodeView {
87
88
  });
88
89
 
89
90
  // Preserve Table Width cannot have inline width set on the table
90
- if (!((_this$options3 = this.options) !== null && _this$options3 !== void 0 && _this$options3.isTableScalingEnabled) || (_this$options4 = this.options) !== null && _this$options4 !== void 0 && _this$options4.isTableScalingEnabled && getBooleanFF('platform.editor.table.preserve-widths-with-lock-button') && node.attrs.displayMode === 'fixed') {
91
+ if (!((_this$options3 = this.options) !== null && _this$options3 !== void 0 && _this$options3.isTableScalingEnabled) || (_this$options4 = this.options) !== null && _this$options4 !== void 0 && _this$options4.isTableScalingEnabled && (_this$getEditorFeatur2 = this.getEditorFeatureFlags) !== null && _this$getEditorFeatur2 !== void 0 && _this$getEditorFeatur2.call(this).tableWithFixedColumnWidthsOption && node.attrs.displayMode === 'fixed') {
91
92
  var _tableWidthPluginKey$;
92
93
  // handle inline style when table been resized
93
94
  const tableInlineWidth = getInlineWidth(node, this.reactComponentProps.options, this.view.state, this.getPos());
@@ -50,7 +50,7 @@ const tablesPlugin = ({
50
50
  config: options,
51
51
  api
52
52
  }) => {
53
- var _api$analytics, _api$analytics2;
53
+ var _api$analytics, _options$getEditorFea, _options$getEditorFea2, _api$analytics2;
54
54
  const editorViewRef = {
55
55
  current: null
56
56
  };
@@ -61,8 +61,10 @@ const tablesPlugin = ({
61
61
  };
62
62
  };
63
63
  const editorAnalyticsAPI = api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions;
64
- const isTableScalingWithFixedColumnWidthsOptionEnabled = (options === null || options === void 0 ? void 0 : options.isTableScalingEnabled) && getBooleanFF('platform.editor.table.preserve-widths-with-lock-button');
65
- const shouldUseIncreasedScalingPercent = isTableScalingWithFixedColumnWidthsOptionEnabled && getBooleanFF('platform.editor.table.use-increased-scaling-percent');
64
+ const isTableFixedColumnWidthsOptionEnabled = (options === null || options === void 0 ? void 0 : (_options$getEditorFea = options.getEditorFeatureFlags) === null || _options$getEditorFea === void 0 ? void 0 : _options$getEditorFea.call(options).tableWithFixedColumnWidthsOption) || false;
65
+ const shouldUseIncreasedScalingPercent = options === null || options === void 0 ? void 0 : options.isTableScalingEnabled;
66
+ isTableFixedColumnWidthsOptionEnabled && getBooleanFF('platform.editor.table.use-increased-scaling-percent');
67
+ const isCellBackgroundDuplicated = (options === null || options === void 0 ? void 0 : (_options$getEditorFea2 = options.getEditorFeatureFlags) === null || _options$getEditorFea2 === void 0 ? void 0 : _options$getEditorFea2.call(options).tableDuplicateCellColouring) || false;
66
68
  return {
67
69
  name: 'table',
68
70
  // Use getSharedState to store fullWidthEnabled and wasFullWidthModeEnabled to guarantee access
@@ -193,7 +195,7 @@ const tablesPlugin = ({
193
195
  isTableAlignmentEnabled = false,
194
196
  fullWidthEnabled = false
195
197
  } = options || {};
196
- return keymapPlugin(defaultGetEditorContainerWidth, editorAnalyticsAPI, dragAndDropEnabled, isTableScalingEnabled, isTableAlignmentEnabled, fullWidthEnabled, api, getIntl, shouldUseIncreasedScalingPercent);
198
+ return keymapPlugin(defaultGetEditorContainerWidth, editorAnalyticsAPI, dragAndDropEnabled, isTableScalingEnabled, isTableAlignmentEnabled, fullWidthEnabled, api, getIntl, isCellBackgroundDuplicated, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent);
197
199
  }
198
200
  }, {
199
201
  name: 'tableSelectionKeymap',
@@ -233,7 +235,7 @@ const tablesPlugin = ({
233
235
  plugin: ({
234
236
  dispatch
235
237
  }) => {
236
- return options !== null && options !== void 0 && options.dragAndDropEnabled ? createDragAndDropPlugin(dispatch, editorAnalyticsAPI) : undefined;
238
+ return options !== null && options !== void 0 && options.dragAndDropEnabled ? createDragAndDropPlugin(dispatch, editorAnalyticsAPI, options === null || options === void 0 ? void 0 : options.isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled) : undefined;
237
239
  }
238
240
  }, {
239
241
  name: 'tableViewModeSort',
@@ -369,6 +371,7 @@ const tablesPlugin = ({
369
371
  isHeaderColumnEnabled: isHeaderColumnEnabled,
370
372
  isHeaderRowEnabled: isHeaderRowEnabled,
371
373
  isDragAndDropEnabled: isDragAndDropEnabled,
374
+ isTableScalingEnabled: options === null || options === void 0 ? void 0 : options.isTableScalingEnabled,
372
375
  editorView: editorView,
373
376
  mountPoint: popupsMountPoint,
374
377
  boundariesElement: popupsBoundariesElement,
@@ -461,7 +464,7 @@ const tablesPlugin = ({
461
464
  return tr;
462
465
  }
463
466
  }],
464
- floatingToolbar: getToolbarConfig(defaultGetEditorContainerWidth, editorAnalyticsAPI, (options === null || options === void 0 ? void 0 : options.getEditorFeatureFlags) || defaultGetEditorFeatureFlags, () => editorViewRef.current, options, isTableScalingWithFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent)(pluginConfig(options === null || options === void 0 ? void 0 : options.tableOptions))
467
+ floatingToolbar: getToolbarConfig(defaultGetEditorContainerWidth, editorAnalyticsAPI, (options === null || options === void 0 ? void 0 : options.getEditorFeatureFlags) || defaultGetEditorFeatureFlags, () => editorViewRef.current, options, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent)(pluginConfig(options === null || options === void 0 ? void 0 : options.tableOptions))
465
468
  }
466
469
  };
467
470
  };
@@ -18,7 +18,7 @@ import { DropTargetType } from './consts';
18
18
  import { createPluginState, getPluginState } from './plugin-factory';
19
19
  import { pluginKey } from './plugin-key';
20
20
  import { getDraggableDataFromEvent } from './utils/monitor';
21
- const destroyFn = (editorView, editorAnalyticsAPI) => {
21
+ const destroyFn = (editorView, editorAnalyticsAPI, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled) => {
22
22
  const editorPageScrollContainer = document.querySelector('.fabric-editor-popup-scroll-parent');
23
23
  const rowAutoScrollers = editorPageScrollContainer ? [monitorForElements({
24
24
  canMonitor({
@@ -168,16 +168,13 @@ const destroyFn = (editorView, editorAnalyticsAPI) => {
168
168
  tableNode
169
169
  } = getTablePluginState(editorView.state);
170
170
  if (tableRef && tableNode) {
171
- const {
172
- isTableScalingEnabled = false
173
- } = getTablePluginState(editorView.state);
174
171
  let isTableScalingEnabledOnCurrentTable = isTableScalingEnabled;
175
- const isTableScalingEnabledWithLockButton = isTableScalingEnabled && getBooleanFF('platform.editor.table.preserve-widths-with-lock-button');
176
- const shouldUseIncreasedScalingPercent = isTableScalingEnabledWithLockButton && getBooleanFF('platform.editor.table.use-increased-scaling-percent');
177
- if (isTableScalingEnabledWithLockButton) {
172
+ const isTableScalingWithFixedColumnWidthsOptionEnabled = isTableScalingEnabled && isTableFixedColumnWidthsOptionEnabled;
173
+ if (isTableScalingWithFixedColumnWidthsOptionEnabled) {
178
174
  isTableScalingEnabledOnCurrentTable = tableNode.attrs.displayMode !== 'fixed';
179
175
  }
180
- insertColgroupFromNode(tableRef, tableNode, isTableScalingEnabledOnCurrentTable, shouldUseIncreasedScalingPercent);
176
+ const shouldUseIncreasedScalingPercent = isTableScalingWithFixedColumnWidthsOptionEnabled && getBooleanFF('platform.editor.table.use-increased-scaling-percent');
177
+ insertColgroupFromNode(tableRef, tableNode, isTableScalingEnabledOnCurrentTable, undefined, shouldUseIncreasedScalingPercent);
181
178
  }
182
179
  }
183
180
  editorView.focus();
@@ -185,7 +182,7 @@ const destroyFn = (editorView, editorAnalyticsAPI) => {
185
182
  }
186
183
  }));
187
184
  };
188
- export const createPlugin = (dispatch, editorAnalyticsAPI) => {
185
+ export const createPlugin = (dispatch, editorAnalyticsAPI, isTableScalingEnabled = false, isTableFixedColumnWidthsOptionEnabled = false) => {
189
186
  return new SafePlugin({
190
187
  state: createPluginState(dispatch, state => ({
191
188
  decorationSet: DecorationSet.empty,
@@ -254,7 +251,7 @@ export const createPlugin = (dispatch, editorAnalyticsAPI) => {
254
251
  },
255
252
  view: editorView => {
256
253
  return {
257
- destroy: destroyFn(editorView, editorAnalyticsAPI)
254
+ destroy: destroyFn(editorView, editorAnalyticsAPI, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled)
258
255
  };
259
256
  },
260
257
  props: {