@atlaskit/editor-plugin-table 7.5.3 → 7.5.5

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 (229) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/cjs/commands/column-resize.js +3 -3
  3. package/dist/cjs/commands/delete.js +2 -2
  4. package/dist/cjs/commands/insert.js +15 -15
  5. package/dist/cjs/commands-with-analytics.js +7 -7
  6. package/dist/cjs/event-handlers.js +2 -2
  7. package/dist/cjs/nodeviews/TableComponent.js +46 -59
  8. package/dist/cjs/nodeviews/TableContainer.js +5 -5
  9. package/dist/cjs/nodeviews/TableResizer.js +12 -12
  10. package/dist/cjs/nodeviews/table.js +9 -9
  11. package/dist/cjs/plugin.js +58 -56
  12. package/dist/cjs/pm-plugins/drag-and-drop/plugin.js +13 -13
  13. package/dist/cjs/pm-plugins/keymap.js +6 -8
  14. package/dist/cjs/pm-plugins/main.js +4 -6
  15. package/dist/cjs/pm-plugins/sticky-headers/plugin.js +2 -3
  16. package/dist/cjs/pm-plugins/table-resizing/event-handlers.js +12 -12
  17. package/dist/cjs/pm-plugins/table-resizing/utils/colgroup.js +2 -2
  18. package/dist/cjs/pm-plugins/table-resizing/utils/consts.js +4 -2
  19. package/dist/cjs/pm-plugins/table-resizing/utils/index.js +2 -2
  20. package/dist/cjs/pm-plugins/table-resizing/utils/misc.js +3 -3
  21. package/dist/cjs/pm-plugins/table-resizing/utils/resize-column.js +3 -3
  22. package/dist/cjs/pm-plugins/table-resizing/utils/resize-state.js +11 -12
  23. package/dist/cjs/pm-plugins/table-resizing/utils/scale-table.js +13 -13
  24. package/dist/cjs/pm-plugins/table-width.js +6 -2
  25. package/dist/cjs/toolbar.js +21 -21
  26. package/dist/cjs/transforms/column-width.js +4 -4
  27. package/dist/cjs/transforms/delete-columns.js +2 -2
  28. package/dist/cjs/ui/ColumnResizeWidget/index.js +4 -5
  29. package/dist/cjs/ui/FloatingContextualMenu/ContextualMenu.js +53 -55
  30. package/dist/cjs/ui/FloatingContextualMenu/index.js +2 -4
  31. package/dist/cjs/ui/FloatingDragMenu/DragMenu.js +2 -2
  32. package/dist/cjs/ui/FloatingDragMenu/index.js +6 -6
  33. package/dist/cjs/ui/FloatingInsertButton/index.js +6 -7
  34. package/dist/cjs/utils/create.js +2 -5
  35. package/dist/cjs/utils/drag-menu.js +4 -4
  36. package/dist/cjs/utils/guidelines.js +5 -2
  37. package/dist/cjs/utils/snapping.js +14 -1
  38. package/dist/es2019/commands/column-resize.js +3 -3
  39. package/dist/es2019/commands/delete.js +2 -2
  40. package/dist/es2019/commands/insert.js +12 -12
  41. package/dist/es2019/commands-with-analytics.js +6 -6
  42. package/dist/es2019/event-handlers.js +2 -2
  43. package/dist/es2019/nodeviews/TableComponent.js +25 -36
  44. package/dist/es2019/nodeviews/TableContainer.js +6 -6
  45. package/dist/es2019/nodeviews/TableResizer.js +14 -14
  46. package/dist/es2019/nodeviews/table.js +9 -9
  47. package/dist/es2019/plugin.js +17 -17
  48. package/dist/es2019/pm-plugins/drag-and-drop/plugin.js +6 -6
  49. package/dist/es2019/pm-plugins/keymap.js +5 -8
  50. package/dist/es2019/pm-plugins/main.js +3 -5
  51. package/dist/es2019/pm-plugins/sticky-headers/plugin.js +1 -1
  52. package/dist/es2019/pm-plugins/table-resizing/event-handlers.js +5 -5
  53. package/dist/es2019/pm-plugins/table-resizing/utils/colgroup.js +2 -2
  54. package/dist/es2019/pm-plugins/table-resizing/utils/consts.js +3 -1
  55. package/dist/es2019/pm-plugins/table-resizing/utils/index.js +1 -1
  56. package/dist/es2019/pm-plugins/table-resizing/utils/misc.js +2 -2
  57. package/dist/es2019/pm-plugins/table-resizing/utils/resize-column.js +3 -2
  58. package/dist/es2019/pm-plugins/table-resizing/utils/resize-state.js +12 -13
  59. package/dist/es2019/pm-plugins/table-resizing/utils/scale-table.js +13 -13
  60. package/dist/es2019/pm-plugins/table-width.js +6 -2
  61. package/dist/es2019/toolbar.js +15 -15
  62. package/dist/es2019/transforms/column-width.js +5 -5
  63. package/dist/es2019/transforms/delete-columns.js +2 -2
  64. package/dist/es2019/ui/ColumnResizeWidget/index.js +0 -1
  65. package/dist/es2019/ui/FloatingContextualMenu/ContextualMenu.js +9 -12
  66. package/dist/es2019/ui/FloatingContextualMenu/index.js +2 -4
  67. package/dist/es2019/ui/FloatingDragMenu/DragMenu.js +2 -2
  68. package/dist/es2019/ui/FloatingDragMenu/index.js +5 -5
  69. package/dist/es2019/ui/FloatingInsertButton/index.js +5 -6
  70. package/dist/es2019/utils/create.js +2 -5
  71. package/dist/es2019/utils/drag-menu.js +4 -4
  72. package/dist/es2019/utils/guidelines.js +3 -2
  73. package/dist/es2019/utils/snapping.js +12 -1
  74. package/dist/esm/commands/column-resize.js +3 -3
  75. package/dist/esm/commands/delete.js +2 -2
  76. package/dist/esm/commands/insert.js +15 -15
  77. package/dist/esm/commands-with-analytics.js +7 -7
  78. package/dist/esm/event-handlers.js +2 -2
  79. package/dist/esm/nodeviews/TableComponent.js +45 -58
  80. package/dist/esm/nodeviews/TableContainer.js +6 -6
  81. package/dist/esm/nodeviews/TableResizer.js +14 -14
  82. package/dist/esm/nodeviews/table.js +9 -9
  83. package/dist/esm/plugin.js +58 -56
  84. package/dist/esm/pm-plugins/drag-and-drop/plugin.js +13 -13
  85. package/dist/esm/pm-plugins/keymap.js +6 -8
  86. package/dist/esm/pm-plugins/main.js +4 -6
  87. package/dist/esm/pm-plugins/sticky-headers/plugin.js +2 -3
  88. package/dist/esm/pm-plugins/table-resizing/event-handlers.js +12 -12
  89. package/dist/esm/pm-plugins/table-resizing/utils/colgroup.js +2 -2
  90. package/dist/esm/pm-plugins/table-resizing/utils/consts.js +3 -1
  91. package/dist/esm/pm-plugins/table-resizing/utils/index.js +1 -1
  92. package/dist/esm/pm-plugins/table-resizing/utils/misc.js +2 -2
  93. package/dist/esm/pm-plugins/table-resizing/utils/resize-column.js +4 -3
  94. package/dist/esm/pm-plugins/table-resizing/utils/resize-state.js +13 -14
  95. package/dist/esm/pm-plugins/table-resizing/utils/scale-table.js +13 -13
  96. package/dist/esm/pm-plugins/table-width.js +6 -2
  97. package/dist/esm/toolbar.js +21 -21
  98. package/dist/esm/transforms/column-width.js +5 -5
  99. package/dist/esm/transforms/delete-columns.js +2 -2
  100. package/dist/esm/ui/ColumnResizeWidget/index.js +0 -1
  101. package/dist/esm/ui/FloatingContextualMenu/ContextualMenu.js +53 -55
  102. package/dist/esm/ui/FloatingContextualMenu/index.js +2 -4
  103. package/dist/esm/ui/FloatingDragMenu/DragMenu.js +2 -2
  104. package/dist/esm/ui/FloatingDragMenu/index.js +6 -6
  105. package/dist/esm/ui/FloatingInsertButton/index.js +6 -7
  106. package/dist/esm/utils/create.js +2 -5
  107. package/dist/esm/utils/drag-menu.js +4 -4
  108. package/dist/esm/utils/guidelines.js +5 -2
  109. package/dist/esm/utils/snapping.js +14 -1
  110. package/dist/types/commands/column-resize.d.ts +1 -1
  111. package/dist/types/commands/delete.d.ts +1 -1
  112. package/dist/types/commands/insert.d.ts +7 -7
  113. package/dist/types/commands-with-analytics.d.ts +3 -3
  114. package/dist/types/event-handlers.d.ts +1 -1
  115. package/dist/types/nodeviews/TableComponent.d.ts +2 -3
  116. package/dist/types/nodeviews/TableContainer.d.ts +4 -4
  117. package/dist/types/nodeviews/TableResizer.d.ts +2 -2
  118. package/dist/types/nodeviews/table.d.ts +1 -1
  119. package/dist/types/nodeviews/types.d.ts +1 -0
  120. package/dist/types/plugin.d.ts +1 -0
  121. package/dist/types/pm-plugins/drag-and-drop/plugin.d.ts +1 -2
  122. package/dist/types/pm-plugins/keymap.d.ts +2 -2
  123. package/dist/types/pm-plugins/main.d.ts +1 -1
  124. package/dist/types/pm-plugins/sticky-headers/plugin.d.ts +2 -3
  125. package/dist/types/pm-plugins/table-resizing/utils/colgroup.d.ts +1 -1
  126. package/dist/types/pm-plugins/table-resizing/utils/consts.d.ts +1 -0
  127. package/dist/types/pm-plugins/table-resizing/utils/index.d.ts +1 -1
  128. package/dist/types/pm-plugins/table-resizing/utils/misc.d.ts +1 -1
  129. package/dist/types/pm-plugins/table-resizing/utils/resize-column.d.ts +2 -1
  130. package/dist/types/pm-plugins/table-resizing/utils/resize-state.d.ts +4 -4
  131. package/dist/types/pm-plugins/table-resizing/utils/scale-table.d.ts +4 -4
  132. package/dist/types/pm-plugins/table-width.d.ts +1 -2
  133. package/dist/types/toolbar.d.ts +2 -2
  134. package/dist/types/transforms/column-width.d.ts +1 -1
  135. package/dist/types/transforms/delete-columns.d.ts +1 -1
  136. package/dist/types/types.d.ts +1 -0
  137. package/dist/types/ui/ColumnResizeWidget/index.d.ts +2 -2
  138. package/dist/types/ui/FloatingContextualMenu/index.d.ts +1 -1
  139. package/dist/types/ui/FloatingDragMenu/DragMenu.d.ts +2 -2
  140. package/dist/types/ui/FloatingDragMenu/index.d.ts +2 -3
  141. package/dist/types/ui/FloatingInsertButton/index.d.ts +1 -2
  142. package/dist/types/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.d.ts +2 -2
  143. package/dist/types/ui/TableFloatingColumnControls/ColumnDropTargets/index.d.ts +2 -2
  144. package/dist/types/ui/TableFloatingColumnControls/index.d.ts +2 -2
  145. package/dist/types/utils/create.d.ts +1 -2
  146. package/dist/types/utils/drag-menu.d.ts +2 -2
  147. package/dist/types/utils/guidelines.d.ts +1 -0
  148. package/dist/types/utils/snapping.d.ts +2 -0
  149. package/dist/types-ts4.5/commands/column-resize.d.ts +1 -1
  150. package/dist/types-ts4.5/commands/delete.d.ts +1 -1
  151. package/dist/types-ts4.5/commands/insert.d.ts +7 -7
  152. package/dist/types-ts4.5/commands-with-analytics.d.ts +3 -3
  153. package/dist/types-ts4.5/event-handlers.d.ts +1 -1
  154. package/dist/types-ts4.5/nodeviews/TableComponent.d.ts +2 -3
  155. package/dist/types-ts4.5/nodeviews/TableContainer.d.ts +4 -4
  156. package/dist/types-ts4.5/nodeviews/TableResizer.d.ts +2 -2
  157. package/dist/types-ts4.5/nodeviews/table.d.ts +1 -1
  158. package/dist/types-ts4.5/nodeviews/types.d.ts +1 -0
  159. package/dist/types-ts4.5/plugin.d.ts +1 -0
  160. package/dist/types-ts4.5/pm-plugins/drag-and-drop/plugin.d.ts +1 -2
  161. package/dist/types-ts4.5/pm-plugins/keymap.d.ts +2 -2
  162. package/dist/types-ts4.5/pm-plugins/main.d.ts +1 -1
  163. package/dist/types-ts4.5/pm-plugins/sticky-headers/plugin.d.ts +2 -3
  164. package/dist/types-ts4.5/pm-plugins/table-resizing/utils/colgroup.d.ts +1 -1
  165. package/dist/types-ts4.5/pm-plugins/table-resizing/utils/consts.d.ts +1 -0
  166. package/dist/types-ts4.5/pm-plugins/table-resizing/utils/index.d.ts +1 -1
  167. package/dist/types-ts4.5/pm-plugins/table-resizing/utils/misc.d.ts +1 -1
  168. package/dist/types-ts4.5/pm-plugins/table-resizing/utils/resize-column.d.ts +2 -1
  169. package/dist/types-ts4.5/pm-plugins/table-resizing/utils/resize-state.d.ts +4 -4
  170. package/dist/types-ts4.5/pm-plugins/table-resizing/utils/scale-table.d.ts +4 -4
  171. package/dist/types-ts4.5/pm-plugins/table-width.d.ts +1 -2
  172. package/dist/types-ts4.5/toolbar.d.ts +2 -2
  173. package/dist/types-ts4.5/transforms/column-width.d.ts +1 -1
  174. package/dist/types-ts4.5/transforms/delete-columns.d.ts +1 -1
  175. package/dist/types-ts4.5/types.d.ts +1 -0
  176. package/dist/types-ts4.5/ui/ColumnResizeWidget/index.d.ts +2 -2
  177. package/dist/types-ts4.5/ui/FloatingContextualMenu/index.d.ts +1 -1
  178. package/dist/types-ts4.5/ui/FloatingDragMenu/DragMenu.d.ts +2 -2
  179. package/dist/types-ts4.5/ui/FloatingDragMenu/index.d.ts +2 -3
  180. package/dist/types-ts4.5/ui/FloatingInsertButton/index.d.ts +1 -2
  181. package/dist/types-ts4.5/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.d.ts +2 -2
  182. package/dist/types-ts4.5/ui/TableFloatingColumnControls/ColumnDropTargets/index.d.ts +2 -2
  183. package/dist/types-ts4.5/ui/TableFloatingColumnControls/index.d.ts +2 -2
  184. package/dist/types-ts4.5/utils/create.d.ts +1 -2
  185. package/dist/types-ts4.5/utils/drag-menu.d.ts +2 -2
  186. package/dist/types-ts4.5/utils/guidelines.d.ts +1 -0
  187. package/dist/types-ts4.5/utils/snapping.d.ts +2 -0
  188. package/package.json +2 -2
  189. package/src/commands/column-resize.ts +4 -3
  190. package/src/commands/delete.ts +2 -2
  191. package/src/commands/insert.ts +15 -27
  192. package/src/commands-with-analytics.ts +6 -9
  193. package/src/event-handlers.ts +2 -2
  194. package/src/nodeviews/TableComponent.tsx +31 -46
  195. package/src/nodeviews/TableContainer.tsx +16 -7
  196. package/src/nodeviews/TableResizer.tsx +44 -24
  197. package/src/nodeviews/table.tsx +6 -5
  198. package/src/nodeviews/types.ts +1 -0
  199. package/src/plugin.tsx +12 -28
  200. package/src/pm-plugins/drag-and-drop/plugin.ts +10 -15
  201. package/src/pm-plugins/keymap.ts +6 -13
  202. package/src/pm-plugins/main.ts +3 -3
  203. package/src/pm-plugins/sticky-headers/plugin.ts +2 -11
  204. package/src/pm-plugins/table-resizing/event-handlers.ts +6 -4
  205. package/src/pm-plugins/table-resizing/utils/colgroup.ts +2 -2
  206. package/src/pm-plugins/table-resizing/utils/consts.ts +2 -0
  207. package/src/pm-plugins/table-resizing/utils/index.ts +1 -1
  208. package/src/pm-plugins/table-resizing/utils/misc.ts +2 -2
  209. package/src/pm-plugins/table-resizing/utils/resize-column.ts +5 -2
  210. package/src/pm-plugins/table-resizing/utils/resize-state.ts +18 -13
  211. package/src/pm-plugins/table-resizing/utils/scale-table.ts +14 -14
  212. package/src/pm-plugins/table-width.ts +4 -6
  213. package/src/toolbar.tsx +16 -19
  214. package/src/transforms/column-width.ts +7 -6
  215. package/src/transforms/delete-columns.ts +2 -2
  216. package/src/types.ts +1 -0
  217. package/src/ui/ColumnResizeWidget/index.tsx +2 -4
  218. package/src/ui/FloatingContextualMenu/ContextualMenu.tsx +11 -16
  219. package/src/ui/FloatingContextualMenu/index.tsx +0 -2
  220. package/src/ui/FloatingDragMenu/DragMenu.tsx +3 -3
  221. package/src/ui/FloatingDragMenu/index.tsx +4 -8
  222. package/src/ui/FloatingInsertButton/index.tsx +11 -22
  223. package/src/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.tsx +2 -2
  224. package/src/ui/TableFloatingColumnControls/ColumnDropTargets/index.tsx +2 -2
  225. package/src/ui/TableFloatingColumnControls/index.tsx +2 -2
  226. package/src/utils/create.ts +2 -5
  227. package/src/utils/drag-menu.ts +8 -13
  228. package/src/utils/guidelines.ts +12 -1
  229. package/src/utils/snapping.ts +36 -0
@@ -328,7 +328,7 @@ export function handleTripleClick(view, pos) {
328
328
  return false;
329
329
  }
330
330
  export var handleCut = function handleCut(oldTr, oldState, newState, editorAnalyticsAPI, editorView) {
331
- var tablePreserveWidth = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
331
+ var isTableScalingEnabled = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
332
332
  var oldSelection = oldState.tr.selection;
333
333
  var tr = newState.tr;
334
334
  if (oldSelection instanceof CellSelection) {
@@ -371,7 +371,7 @@ export var handleCut = function handleCut(oldTr, oldState, newState, editorAnaly
371
371
  isHeaderRowRequired = _getPluginState9.pluginConfig.isHeaderRowRequired;
372
372
  tr = deleteRows(rect, isHeaderRowRequired)(tr);
373
373
  } else if (tr.selection.isColSelection()) {
374
- tr = deleteColumns(rect, getAllowAddColumnCustomStep(oldState), editorView, tablePreserveWidth)(tr);
374
+ tr = deleteColumns(rect, getAllowAddColumnCustomStep(oldState), editorView, isTableScalingEnabled)(tr);
375
375
  }
376
376
  }
377
377
  }
@@ -17,7 +17,7 @@ import rafSchedule from 'raf-schd';
17
17
  import { ACTION_SUBJECT, EVENT_TYPE, TABLE_ACTION } from '@atlaskit/editor-common/analytics';
18
18
  import { getParentNodeWidth, getTableContainerWidth } from '@atlaskit/editor-common/node-width';
19
19
  import { tableMarginSides } from '@atlaskit/editor-common/styles';
20
- import { browser, calcTableColumnWidths, isValidPosition } from '@atlaskit/editor-common/utils';
20
+ import { browser, isValidPosition } from '@atlaskit/editor-common/utils';
21
21
  import { MAX_BROWSER_SCROLLBAR_HEIGHT, akEditorTableToolbarSize as tableToolbarSize } from '@atlaskit/editor-shared-styles';
22
22
  import { findTable, isTableSelected } from '@atlaskit/editor-tables/utils';
23
23
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
@@ -29,6 +29,7 @@ import { findStickyHeaderForTable, pluginKey as stickyHeadersPluginKey } from '.
29
29
  import { META_KEYS } from '../pm-plugins/table-analytics';
30
30
  import { COLUMN_MIN_WIDTH, getLayoutSize, getResizeState, insertColgroupFromNode, scaleTable, updateColgroup } from '../pm-plugins/table-resizing/utils';
31
31
  import { hasTableBeenResized } from '../pm-plugins/table-resizing/utils/colgroup';
32
+ import { TABLE_EDITOR_MARGIN } from '../pm-plugins/table-resizing/utils/consts';
32
33
  import { updateControls } from '../pm-plugins/table-resizing/utils/dom';
33
34
  import { TableCssClassName as ClassName, ShadowEvent } from '../types';
34
35
  import { tableOverflowShadowWidth, tableOverflowShadowWidthWide } from '../ui/consts';
@@ -169,7 +170,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
169
170
  getPos = _this$props2.getPos,
170
171
  containerWidth = _this$props2.containerWidth,
171
172
  options = _this$props2.options,
172
- getEditorFeatureFlags = _this$props2.getEditorFeatureFlags;
173
+ isTableScalingEnabled = _this$props2.isTableScalingEnabled;
173
174
  var node = getNode();
174
175
  var state = view.state,
175
176
  dispatch = view.dispatch;
@@ -180,16 +181,13 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
180
181
  var domAtPos = view.domAtPos.bind(view);
181
182
  var width = containerWidth.width;
182
183
  _this.scaleTableDebounced.cancel();
183
- var _getEditorFeatureFlag = getEditorFeatureFlags(),
184
- _getEditorFeatureFlag2 = _getEditorFeatureFlag.tablePreserveWidth,
185
- tablePreserveWidth = _getEditorFeatureFlag2 === void 0 ? false : _getEditorFeatureFlag2;
186
184
  var tr = scaleTable(_this.table, _objectSpread(_objectSpread({}, scaleOptions), {}, {
187
185
  node: node,
188
186
  prevNode: _this.node || node,
189
187
  start: pos + 1,
190
188
  containerWidth: width,
191
189
  previousContainerWidth: _this.containerWidth.width || width
192
- }, options), domAtPos, tablePreserveWidth)(state.tr);
190
+ }, options), domAtPos, isTableScalingEnabled)(state.tr);
193
191
  dispatch(tr);
194
192
  });
195
193
  _defineProperty(_assertThisInitialized(_this), "setTimerToSendInitialOverflowCaptured", function (isOverflowing) {
@@ -311,13 +309,17 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
311
309
  options = _this$props7.options,
312
310
  isDragAndDropEnabled = _this$props7.isDragAndDropEnabled,
313
311
  getNode = _this$props7.getNode,
314
- getEditorFeatureFlags = _this$props7.getEditorFeatureFlags;
312
+ getEditorFeatureFlags = _this$props7.getEditorFeatureFlags,
313
+ isTableScalingEnabled = _this$props7.isTableScalingEnabled;
314
+ if (isTableScalingEnabled) {
315
+ this.handleColgroupUpdates(true);
316
+ }
315
317
  if (allowColumnResizing && this.wrapper && !isIE11) {
316
318
  this.wrapper.addEventListener('scroll', this.handleScrollDebounced, {
317
319
  passive: true
318
320
  });
319
- var _getEditorFeatureFlag3 = getEditorFeatureFlags(),
320
- stickyScrollbar = _getEditorFeatureFlag3.stickyScrollbar;
321
+ var _getEditorFeatureFlag = getEditorFeatureFlags(),
322
+ stickyScrollbar = _getEditorFeatureFlag.stickyScrollbar;
321
323
  if (stickyScrollbar) {
322
324
  if (this.table) {
323
325
  this.stickyScrollbar = new TableStickyScrollbar(this.wrapper, this.props.view);
@@ -363,8 +365,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
363
365
  if (isDragAndDropEnabled && this.dragAndDropCleanupFn) {
364
366
  this.dragAndDropCleanupFn();
365
367
  }
366
- var _getEditorFeatureFlag4 = getEditorFeatureFlags(),
367
- stickyScrollbar = _getEditorFeatureFlag4.stickyScrollbar;
368
+ var _getEditorFeatureFlag2 = getEditorFeatureFlags(),
369
+ stickyScrollbar = _getEditorFeatureFlag2.stickyScrollbar;
368
370
  if (stickyScrollbar) {
369
371
  if (this.stickyScrollbar) {
370
372
  this.stickyScrollbar.dispose();
@@ -391,23 +393,21 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
391
393
  }, {
392
394
  key: "handleColgroupUpdates",
393
395
  value: function handleColgroupUpdates() {
394
- var _this2 = this,
395
- _this$containerWidth;
396
+ var _this$containerWidth;
397
+ var force = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
396
398
  var _this$props9 = this.props,
397
399
  getNode = _this$props9.getNode,
398
400
  containerWidth = _this$props9.containerWidth,
399
401
  isResizing = _this$props9.isResizing,
400
402
  view = _this$props9.view,
401
- getPos = _this$props9.getPos,
402
- tableRef = _this$props9.tableRef;
403
- if (!tableRef) {
403
+ getPos = _this$props9.getPos;
404
+ if (!this.table) {
404
405
  return;
405
406
  }
406
- var TABLE_MARGIN = 76;
407
407
 
408
408
  // Remove any widths styles after resizing preview is completed
409
- tableRef.style.width = '';
410
- var tableRenderWidth = containerWidth.width - TABLE_MARGIN;
409
+ this.table.style.width = '';
410
+ var tableRenderWidth = containerWidth.width - TABLE_EDITOR_MARGIN;
411
411
  var tableNode = getNode();
412
412
  var start = getPos() || 0;
413
413
  var depth = view.state.doc.resolve(start).depth;
@@ -417,17 +417,10 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
417
417
  return;
418
418
  }
419
419
  var tableNodeWidth = tableNode.attrs.width;
420
- var tableColumnWidths = calcTableColumnWidths(tableNode);
421
420
  var shouldTableScale = tableRenderWidth < tableNodeWidth;
422
- var isTableColumnWidthsSame = false;
423
- if (this.tableColumnWidths) {
424
- isTableColumnWidthsSame = tableColumnWidths === null || tableColumnWidths === void 0 ? void 0 : tableColumnWidths.every(function (width, index) {
425
- return width === _this2.tableColumnWidths[index];
426
- });
427
- }
428
421
  var containerWidthValue = containerWidth.width;
429
422
  var isWidthChanged = ((_this$containerWidth = this.containerWidth) === null || _this$containerWidth === void 0 ? void 0 : _this$containerWidth.width) !== containerWidthValue;
430
- if (shouldTableScale && !isResizing && (!isTableColumnWidthsSame || isWidthChanged)) {
423
+ if (force || shouldTableScale && !isResizing && isWidthChanged) {
431
424
  var resizeState = getResizeState({
432
425
  minWidth: COLUMN_MIN_WIDTH,
433
426
  maxSize: tableRenderWidth,
@@ -435,20 +428,17 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
435
428
  tableRef: this.table,
436
429
  start: start,
437
430
  domAtPos: view.domAtPos,
438
- tablePreserveWidth: true
439
- });
440
- requestAnimationFrame(function () {
441
- updateColgroup(resizeState, _this2.table, true);
431
+ isTableScalingEnabled: true
442
432
  });
443
- this.tableColumnWidths = tableColumnWidths;
444
- this.containerWidth = containerWidth;
433
+ updateColgroup(resizeState, this.table, tableNode, true);
445
434
  }
435
+ this.containerWidth = containerWidth;
446
436
  }
447
437
  }, {
448
438
  key: "componentDidUpdate",
449
439
  value: function componentDidUpdate(_, prevState) {
450
440
  var _this$wrapper,
451
- _this3 = this;
441
+ _this2 = this;
452
442
  var _this$props10 = this.props,
453
443
  view = _this$props10.view,
454
444
  getNode = _this$props10.getNode,
@@ -456,14 +446,11 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
456
446
  allowColumnResizing = _this$props10.allowColumnResizing,
457
447
  isResizing = _this$props10.isResizing,
458
448
  options = _this$props10.options,
459
- getEditorFeatureFlags = _this$props10.getEditorFeatureFlags;
449
+ isTableScalingEnabled = _this$props10.isTableScalingEnabled;
460
450
  var _getPluginState = getPluginState(view.state),
461
451
  isInDanger = _getPluginState.isInDanger;
462
- var _getEditorFeatureFlag5 = getEditorFeatureFlags(),
463
- _getEditorFeatureFlag6 = _getEditorFeatureFlag5.tablePreserveWidth,
464
- tablePreserveWidth = _getEditorFeatureFlag6 === void 0 ? false : _getEditorFeatureFlag6;
465
452
  var table = findTable(view.state.selection);
466
- if (tablePreserveWidth) {
453
+ if (isTableScalingEnabled) {
467
454
  this.handleColgroupUpdates();
468
455
  }
469
456
  if (isInDanger && !table) {
@@ -475,7 +462,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
475
462
  // that happens when a table is nested in expand and expand's width is
476
463
  // changed via breakout button
477
464
  window.requestAnimationFrame(function () {
478
- _this3.overflowShadowsObserver = new OverflowShadowsObserver(_this3.updateShadowState, _this3.table, _this3.wrapper);
465
+ _this2.overflowShadowsObserver = new OverflowShadowsObserver(_this2.updateShadowState, _this2.table, _this2.wrapper);
479
466
  });
480
467
  } else {
481
468
  this.overflowShadowsObserver = new OverflowShadowsObserver(this.updateShadowState, this.table, this.wrapper);
@@ -500,7 +487,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
500
487
  var _view = this.props.view;
501
488
  var shouldRecreateResizeCols = !(options !== null && options !== void 0 && options.isTableResizingEnabled) || !isResizing || tablesHaveDifferentNoOfColumns(currentTable, previousTable) && isResizing;
502
489
  if (shouldRecreateResizeCols) {
503
- insertColgroupFromNode(this.table, currentTable, tablePreserveWidth);
490
+ insertColgroupFromNode(this.table, currentTable, isTableScalingEnabled);
504
491
  }
505
492
  updateControls()(_view.state);
506
493
  }
@@ -531,7 +518,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
531
518
  }, {
532
519
  key: "render",
533
520
  value: function render() {
534
- var _this4 = this,
521
+ var _this3 = this,
535
522
  _classnames;
536
523
  var _this$props11 = this.props,
537
524
  view = _this$props11.view,
@@ -548,7 +535,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
548
535
  getPos = _this$props11.getPos,
549
536
  pluginInjectionApi = _this$props11.pluginInjectionApi,
550
537
  isDragAndDropEnabled = _this$props11.isDragAndDropEnabled,
551
- getEditorFeatureFlags = _this$props11.getEditorFeatureFlags;
538
+ getEditorFeatureFlags = _this$props11.getEditorFeatureFlags,
539
+ isTableScalingEnabled = _this$props11.isTableScalingEnabled;
552
540
  var _this$state3 = this.state,
553
541
  showBeforeShadow = _this$state3.showBeforeShadow,
554
542
  showAfterShadow = _this$state3.showAfterShadow;
@@ -606,8 +594,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
606
594
  tableContainerWidth: tableContainerWidth,
607
595
  isNumberColumnEnabled: node.attrs.isNumberColumnEnabled,
608
596
  getScrollOffset: function getScrollOffset() {
609
- var _this4$wrapper;
610
- return ((_this4$wrapper = _this4.wrapper) === null || _this4$wrapper === void 0 ? void 0 : _this4$wrapper.scrollLeft) || 0;
597
+ var _this3$wrapper;
598
+ return ((_this3$wrapper = _this3.wrapper) === null || _this3$wrapper === void 0 ? void 0 : _this3$wrapper.scrollLeft) || 0;
611
599
  }
612
600
  }) : null;
613
601
  var shadowPadding = allowControls && tableActive ? -tableToolbarSize : tableMarginSides;
@@ -630,9 +618,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
630
618
  }
631
619
  var isNested = isTableNested(view.state, tablePos);
632
620
  var 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;
633
- var _getEditorFeatureFlag7 = getEditorFeatureFlags(),
634
- stickyScrollbar = _getEditorFeatureFlag7.stickyScrollbar,
635
- tablePreserveWidth = _getEditorFeatureFlag7.tablePreserveWidth;
621
+ var _getEditorFeatureFlag3 = getEditorFeatureFlags(),
622
+ stickyScrollbar = _getEditorFeatureFlag3.stickyScrollbar;
636
623
  return /*#__PURE__*/React.createElement(TableContainer, {
637
624
  className: classnames(ClassName.TABLE_CONTAINER, (_classnames = {}, _defineProperty(_classnames, ClassName.WITH_CONTROLS, allowControls && tableActive), _defineProperty(_classnames, ClassName.TABLE_STICKY, this.state.stickyHeader && hasHeaderRow), _defineProperty(_classnames, ClassName.HOVERED_DELETE_BUTTON, isInDanger), _defineProperty(_classnames, ClassName.TABLE_SELECTED, isTableSelected(view.state.selection)), _classnames)),
638
625
  editorView: view,
@@ -645,7 +632,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
645
632
  pluginInjectionApi: pluginInjectionApi,
646
633
  isTableResizingEnabled: options === null || options === void 0 ? void 0 : options.isTableResizingEnabled,
647
634
  isResizing: isResizing,
648
- tablePreserveWidth: tablePreserveWidth
635
+ isTableScalingEnabled: isTableScalingEnabled
649
636
  }, /*#__PURE__*/React.createElement("div", {
650
637
  className: ClassName.TABLE_STICKY_SENTINEL_TOP,
651
638
  "data-testid": "sticky-sentinel-top"
@@ -656,12 +643,12 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
656
643
  editorView: view,
657
644
  node: node,
658
645
  getScrollOffset: function getScrollOffset() {
659
- var _this4$wrapper2;
660
- return ((_this4$wrapper2 = _this4.wrapper) === null || _this4$wrapper2 === void 0 ? void 0 : _this4$wrapper2.scrollLeft) || 0;
646
+ var _this3$wrapper2;
647
+ return ((_this3$wrapper2 = _this3.wrapper) === null || _this3$wrapper2 === void 0 ? void 0 : _this3$wrapper2.scrollLeft) || 0;
661
648
  },
662
649
  getTableWrapperWidth: function getTableWrapperWidth() {
663
- var _this4$wrapper3;
664
- return ((_this4$wrapper3 = _this4.wrapper) === null || _this4$wrapper3 === void 0 ? void 0 : _this4$wrapper3.clientWidth) || 760;
650
+ var _this3$wrapper3;
651
+ return ((_this3$wrapper3 = _this3.wrapper) === null || _this3$wrapper3 === void 0 ? void 0 : _this3$wrapper3.clientWidth) || 760;
665
652
  }
666
653
  }), /*#__PURE__*/React.createElement("div", {
667
654
  style: shadowStyle(showBeforeShadow),
@@ -676,13 +663,13 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
676
663
  }), /*#__PURE__*/React.createElement("div", {
677
664
  className: classnames(ClassName.TABLE_NODE_WRAPPER),
678
665
  ref: function ref(elem) {
679
- _this4.wrapper = elem;
666
+ _this3.wrapper = elem;
680
667
  if (elem) {
681
- _this4.props.contentDOM(elem);
668
+ _this3.props.contentDOM(elem);
682
669
  var tableElement = elem.querySelector('table');
683
- if (tableElement !== _this4.table) {
684
- _this4.table = tableElement;
685
- _this4.createShadowSentinels(_this4.table);
670
+ if (tableElement !== _this3.table) {
671
+ _this3.table = tableElement;
672
+ _this3.createShadowSentinels(_this3.table);
686
673
  }
687
674
  }
688
675
  }
@@ -5,7 +5,7 @@ import React, { forwardRef, useCallback, useRef } from 'react';
5
5
  import classNames from 'classnames';
6
6
  import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
7
7
  import { calcTableWidth } from '@atlaskit/editor-common/styles';
8
- import { akEditorDefaultLayoutWidth, akEditorMobileBreakoutPoint } from '@atlaskit/editor-shared-styles';
8
+ import { akEditorDefaultLayoutWidth, akEditorGutterPadding, akEditorMediaResizeHandlerPaddingWide, akEditorMobileBreakoutPoint } from '@atlaskit/editor-shared-styles';
9
9
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
10
10
  import { TABLE_MAX_WIDTH } from '../pm-plugins/table-resizing/utils';
11
11
  import { TableCssClassName as ClassName } from '../types';
@@ -44,7 +44,7 @@ export var ResizableTableContainer = /*#__PURE__*/React.memo(function (_ref2) {
44
44
  tableRef = _ref2.tableRef,
45
45
  isResizing = _ref2.isResizing,
46
46
  pluginInjectionApi = _ref2.pluginInjectionApi,
47
- tablePreserveWidth = _ref2.tablePreserveWidth;
47
+ isTableScalingEnabled = _ref2.isTableScalingEnabled;
48
48
  var containerRef = useRef(null);
49
49
  var tableWidthRef = useRef(akEditorDefaultLayoutWidth);
50
50
  var updateContainerHeight = useCallback(function (height) {
@@ -108,7 +108,7 @@ export var ResizableTableContainer = /*#__PURE__*/React.memo(function (_ref2) {
108
108
  }, [pluginInjectionApi]);
109
109
  var tableWidth = getTableContainerWidth(node);
110
110
  // 76 is currently an accepted padding value considering the spacing for resizer handle
111
- var responsiveContainerWidth = containerWidth - 76;
111
+ var responsiveContainerWidth = isTableScalingEnabled ? containerWidth - akEditorGutterPadding * 2 - akEditorMediaResizeHandlerPaddingWide / 2 : containerWidth - akEditorGutterPadding * 2 - akEditorMediaResizeHandlerPaddingWide;
112
112
  var width = Math.min(tableWidth, responsiveContainerWidth);
113
113
  if (!isResizing) {
114
114
  tableWidthRef.current = width;
@@ -126,7 +126,7 @@ export var ResizableTableContainer = /*#__PURE__*/React.memo(function (_ref2) {
126
126
  displayGuideline: displayGuideline,
127
127
  attachAnalyticsEvent: attachAnalyticsEvent,
128
128
  displayGapCursor: displayGapCursor,
129
- tablePreserveWidth: tablePreserveWidth
129
+ isTableScalingEnabled: isTableScalingEnabled
130
130
  };
131
131
  if (getBooleanFF('platform.editor.resizing-table-height-improvement')) {
132
132
  tableResizerProps = _objectSpread(_objectSpread({}, tableResizerProps), {}, {
@@ -165,7 +165,7 @@ export var TableContainer = function TableContainer(_ref3) {
165
165
  isNested = _ref3.isNested,
166
166
  isResizing = _ref3.isResizing,
167
167
  pluginInjectionApi = _ref3.pluginInjectionApi,
168
- tablePreserveWidth = _ref3.tablePreserveWidth;
168
+ isTableScalingEnabled = _ref3.isTableScalingEnabled;
169
169
  if (isTableResizingEnabled && !isNested) {
170
170
  return /*#__PURE__*/React.createElement(ResizableTableContainer, {
171
171
  className: className,
@@ -176,7 +176,7 @@ export var TableContainer = function TableContainer(_ref3) {
176
176
  tableRef: tableRef,
177
177
  isResizing: isResizing,
178
178
  pluginInjectionApi: pluginInjectionApi,
179
- tablePreserveWidth: tablePreserveWidth
179
+ isTableScalingEnabled: isTableScalingEnabled
180
180
  }, children);
181
181
  }
182
182
  var tableWidth = isBreakoutEnabled ? calcTableWidth(node.attrs.layout, editorWidth) : 'inherit';
@@ -20,8 +20,8 @@ import { COLUMN_MIN_WIDTH, getColgroupChildrenLength, previewScaleTable, scaleTa
20
20
  import { pluginKey as tableWidthPluginKey } from '../pm-plugins/table-width';
21
21
  import { TABLE_GUIDELINE_VISIBLE_ADJUSTMENT, TABLE_HIGHLIGHT_GAP, TABLE_HIGHLIGHT_TOLERANCE, TABLE_SNAP_GAP } from '../ui/consts';
22
22
  import { generateResizedPayload, generateResizeFrameRatePayloads, useMeasureFramerate } from '../utils/analytics';
23
- import { defaultGuidelines } from '../utils/guidelines';
24
- import { defaultSnappingWidths, findClosestSnap } from '../utils/snapping';
23
+ import { defaultGuidelines, defaultGuidelinesForPreserveTable } from '../utils/guidelines';
24
+ import { defaultSnappingWidths, defaultTablePreserveSnappingWidths, findClosestSnap } from '../utils/snapping';
25
25
  var DEBOUNCE_TIME_FOR_SCREEN_READER_ANNOUNCER = 1000;
26
26
  var RESIZE_STEP_VALUE = 10;
27
27
  var handles = {
@@ -88,7 +88,7 @@ export var TableResizer = function TableResizer(_ref) {
88
88
  displayGuideline = _ref.displayGuideline,
89
89
  attachAnalyticsEvent = _ref.attachAnalyticsEvent,
90
90
  displayGapCursor = _ref.displayGapCursor,
91
- tablePreserveWidth = _ref.tablePreserveWidth;
91
+ isTableScalingEnabled = _ref.isTableScalingEnabled;
92
92
  var currentGap = useRef(0);
93
93
  // track resizing state - use ref over state to avoid re-render
94
94
  var isResizing = useRef(false);
@@ -135,15 +135,15 @@ export var TableResizer = function TableResizer(_ref) {
135
135
  keys = _ref2.keys;
136
136
  if (gap !== currentGap.current) {
137
137
  currentGap.current = gap;
138
- var visibleGuidelines = getVisibleGuidelines(defaultGuidelines, containerWidth);
138
+ var visibleGuidelines = getVisibleGuidelines(isTableScalingEnabled ? defaultGuidelinesForPreserveTable(containerWidth) : defaultGuidelines, containerWidth);
139
139
  displayGuideline(getGuidelinesWithHighlights(gap, TABLE_SNAP_GAP, keys, visibleGuidelines));
140
140
  }
141
- }, [displayGuideline, containerWidth]);
141
+ }, [isTableScalingEnabled, containerWidth, displayGuideline]);
142
142
  var guidelineSnaps = useMemo(function () {
143
143
  return snappingEnabled ? {
144
- x: defaultSnappingWidths
144
+ x: isTableScalingEnabled ? defaultTablePreserveSnappingWidths(containerWidth) : defaultSnappingWidths
145
145
  } : undefined;
146
- }, [snappingEnabled]);
146
+ }, [snappingEnabled, isTableScalingEnabled, containerWidth]);
147
147
  useEffect(function () {
148
148
  return function () {
149
149
  // only bring back the cursor if this table was deleted - i.e. if a user was resizing, then another
@@ -173,12 +173,12 @@ export var TableResizer = function TableResizer(_ref) {
173
173
  name: TABLE_OVERFLOW_CHANGE_TRIGGER.RESIZED
174
174
  });
175
175
  dispatch(tr);
176
- var visibleGuidelines = getVisibleGuidelines(defaultGuidelines, containerWidth);
176
+ var visibleGuidelines = getVisibleGuidelines(isTableScalingEnabled ? defaultGuidelinesForPreserveTable(containerWidth) : defaultGuidelines, containerWidth);
177
177
  setSnappingEnabled(displayGuideline(visibleGuidelines));
178
178
  if (getBooleanFF('platform.editor.resizing-table-height-improvement') && onResizeStart) {
179
179
  onResizeStart();
180
180
  }
181
- }, [displayGapCursor, displayGuideline, editorView, startMeasure, onResizeStart, containerWidth]);
181
+ }, [startMeasure, editorView, displayGapCursor, isTableScalingEnabled, containerWidth, displayGuideline, onResizeStart]);
182
182
  var handleResize = useCallback(function (originalState, delta) {
183
183
  countFrames();
184
184
  var newWidth = originalState.width + delta.width;
@@ -196,11 +196,11 @@ export var TableResizer = function TableResizer(_ref) {
196
196
  prevNode: node,
197
197
  start: pos + 1,
198
198
  parentWidth: newWidth
199
- }, editorView.domAtPos.bind(editorView), tablePreserveWidth);
200
- updateActiveGuidelines(findClosestSnap(newWidth, defaultSnappingWidths, defaultGuidelines, TABLE_HIGHLIGHT_GAP, TABLE_HIGHLIGHT_TOLERANCE));
199
+ }, editorView.domAtPos.bind(editorView), isTableScalingEnabled);
200
+ updateActiveGuidelines(findClosestSnap(newWidth, isTableScalingEnabled ? defaultTablePreserveSnappingWidths(containerWidth) : defaultSnappingWidths, isTableScalingEnabled ? defaultGuidelinesForPreserveTable(containerWidth) : defaultGuidelines, TABLE_HIGHLIGHT_GAP, TABLE_HIGHLIGHT_TOLERANCE));
201
201
  updateWidth(newWidth);
202
202
  return newWidth;
203
- }, [editorView, getPos, node, tableRef, updateWidth, updateActiveGuidelines, countFrames, tablePreserveWidth]);
203
+ }, [countFrames, isTableScalingEnabled, tableRef, node, editorView, updateActiveGuidelines, containerWidth, updateWidth, getPos]);
204
204
  var scheduleResize = useMemo(function () {
205
205
  return rafSchd(handleResize);
206
206
  }, [handleResize]);
@@ -236,7 +236,7 @@ export var TableResizer = function TableResizer(_ref) {
236
236
  prevNode: node,
237
237
  start: pos + 1,
238
238
  parentWidth: newWidth
239
- }, editorView.domAtPos.bind(editorView), tablePreserveWidth)(tr);
239
+ }, editorView.domAtPos.bind(editorView), isTableScalingEnabled)(tr);
240
240
  var scaledNode = tr.doc.nodeAt(pos);
241
241
  (_attachAnalyticsEvent2 = attachAnalyticsEvent(generateResizedPayload({
242
242
  originalNode: node,
@@ -254,7 +254,7 @@ export var TableResizer = function TableResizer(_ref) {
254
254
  onResizeStop();
255
255
  }
256
256
  return newWidth;
257
- }, [displayGapCursor, updateWidth, editorView, getPos, node, tableRef, scheduleResize, displayGuideline, attachAnalyticsEvent, endMeasure, onResizeStop, tablePreserveWidth]);
257
+ }, [displayGapCursor, updateWidth, editorView, getPos, node, tableRef, scheduleResize, displayGuideline, attachAnalyticsEvent, endMeasure, onResizeStop, isTableScalingEnabled]);
258
258
  var handleTableSizeChangeOnKeypress = useCallback(function (step) {
259
259
  var newWidth = width + step;
260
260
  if (newWidth > maxWidth || newWidth < resizerMinWidth) {
@@ -72,7 +72,7 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
72
72
  _defineProperty(_assertThisInitialized(_this), "hasHoveredRows", false);
73
73
  _this.getPos = props.getPos;
74
74
  _this.eventDispatcher = props.eventDispatcher;
75
- _this.getEditorFeatureFlags = props.getEditorFeatureFlags;
75
+ _this.options = props.options;
76
76
  return _this;
77
77
  }
78
78
  _createClass(TableView, [{
@@ -80,12 +80,10 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
80
80
  value: function getContentDOM() {
81
81
  var rendered = DOMSerializer.renderSpec(document, toDOM(this.node, this.reactComponentProps));
82
82
  if (rendered.dom) {
83
+ var _this$options;
83
84
  this.table = rendered.dom;
84
- var _this$getEditorFeatur = this.getEditorFeatureFlags(),
85
- _this$getEditorFeatur2 = _this$getEditorFeatur.tablePreserveWidth,
86
- tablePreserveWidth = _this$getEditorFeatur2 === void 0 ? false : _this$getEditorFeatur2;
87
85
  // Preserve Table Width cannot have inline width set on the table
88
- if (!tablePreserveWidth) {
86
+ if (!((_this$options = this.options) !== null && _this$options !== void 0 && _this$options.isTableScalingEnabled)) {
89
87
  var tableInlineWidth = getInlineWidth(this.node, this.reactComponentProps.options, this.reactComponentProps.view.state, this.reactComponentProps.getPos());
90
88
  if (tableInlineWidth) {
91
89
  handleInlineTableWidth(this.table, tableInlineWidth);
@@ -179,6 +177,7 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
179
177
  isHeaderRowEnabled: pluginState.isHeaderRowEnabled,
180
178
  isHeaderColumnEnabled: pluginState.isHeaderColumnEnabled,
181
179
  isDragAndDropEnabled: pluginState.isDragAndDropEnabled,
180
+ isTableScalingEnabled: pluginState.isTableScalingEnabled,
182
181
  tableActive: tableActive,
183
182
  ordering: pluginState.ordering,
184
183
  isResizing: isResizing,
@@ -187,8 +186,7 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
187
186
  contentDOM: forwardRef,
188
187
  getEditorFeatureFlags: props.getEditorFeatureFlags,
189
188
  dispatchAnalyticsEvent: props.dispatchAnalyticsEvent,
190
- pluginInjectionApi: props.pluginInjectionApi,
191
- tableRef: _this3.table
189
+ pluginInjectionApi: props.pluginInjectionApi
192
190
  });
193
191
  }
194
192
  });
@@ -261,7 +259,8 @@ export var createTableView = function createTableView(node, view, getPos, portal
261
259
  isFullWidthModeEnabled = _getPluginState2.isFullWidthModeEnabled,
262
260
  wasFullWidthModeEnabled = _getPluginState2.wasFullWidthModeEnabled,
263
261
  isTableResizingEnabled = _getPluginState2.isTableResizingEnabled,
264
- isDragAndDropEnabled = _getPluginState2.isDragAndDropEnabled;
262
+ isDragAndDropEnabled = _getPluginState2.isDragAndDropEnabled,
263
+ isTableScalingEnabled = _getPluginState2.isTableScalingEnabled;
265
264
  var _getPluginConfig = getPluginConfig(pluginConfig),
266
265
  allowColumnResizing = _getPluginConfig.allowColumnResizing;
267
266
  var hasIntlContext = true;
@@ -277,7 +276,8 @@ export var createTableView = function createTableView(node, view, getPos, portal
277
276
  isFullWidthModeEnabled: isFullWidthModeEnabled,
278
277
  wasFullWidthModeEnabled: wasFullWidthModeEnabled,
279
278
  isTableResizingEnabled: isTableResizingEnabled,
280
- isDragAndDropEnabled: isDragAndDropEnabled
279
+ isDragAndDropEnabled: isDragAndDropEnabled,
280
+ isTableScalingEnabled: isTableScalingEnabled
281
281
  },
282
282
  getEditorContainerWidth: getEditorContainerWidth,
283
283
  getEditorFeatureFlags: getEditorFeatureFlags,