@atlaskit/editor-plugin-table 7.4.9 → 7.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (180) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/cjs/commands/column-resize.js +4 -2
  3. package/dist/cjs/commands/delete.js +2 -1
  4. package/dist/cjs/commands/insert.js +6 -3
  5. package/dist/cjs/commands-with-analytics.js +4 -2
  6. package/dist/cjs/event-handlers.js +2 -1
  7. package/dist/cjs/nodeviews/TableComponent.js +116 -47
  8. package/dist/cjs/nodeviews/TableContainer.js +8 -4
  9. package/dist/cjs/nodeviews/TableResizer.js +6 -5
  10. package/dist/cjs/nodeviews/table.js +12 -4
  11. package/dist/cjs/plugin.js +50 -47
  12. package/dist/cjs/pm-plugins/drag-and-drop/plugin.js +9 -6
  13. package/dist/cjs/pm-plugins/keymap.js +6 -3
  14. package/dist/cjs/pm-plugins/main.js +4 -1
  15. package/dist/cjs/pm-plugins/table-resizing/event-handlers.js +7 -3
  16. package/dist/cjs/pm-plugins/table-resizing/utils/colgroup.js +32 -11
  17. package/dist/cjs/pm-plugins/table-resizing/utils/consts.js +4 -2
  18. package/dist/cjs/pm-plugins/table-resizing/utils/index.js +24 -0
  19. package/dist/cjs/pm-plugins/table-resizing/utils/misc.js +20 -1
  20. package/dist/cjs/pm-plugins/table-resizing/utils/resize-column.js +2 -1
  21. package/dist/cjs/pm-plugins/table-resizing/utils/resize-state.js +52 -11
  22. package/dist/cjs/pm-plugins/table-resizing/utils/scale-table.js +19 -8
  23. package/dist/cjs/toolbar.js +17 -10
  24. package/dist/cjs/transforms/column-width.js +22 -7
  25. package/dist/cjs/transforms/delete-columns.js +2 -1
  26. package/dist/cjs/ui/FloatingContextualMenu/ContextualMenu.js +45 -38
  27. package/dist/cjs/ui/FloatingContextualMenu/index.js +4 -2
  28. package/dist/cjs/ui/FloatingDragMenu/DragMenu.js +3 -2
  29. package/dist/cjs/ui/FloatingDragMenu/index.js +7 -2
  30. package/dist/cjs/ui/FloatingInsertButton/index.js +5 -1
  31. package/dist/cjs/utils/create.js +1 -1
  32. package/dist/cjs/utils/drag-menu.js +4 -3
  33. package/dist/es2019/commands/column-resize.js +4 -3
  34. package/dist/es2019/commands/delete.js +2 -2
  35. package/dist/es2019/commands/insert.js +6 -6
  36. package/dist/es2019/commands-with-analytics.js +4 -4
  37. package/dist/es2019/event-handlers.js +2 -2
  38. package/dist/es2019/nodeviews/TableComponent.js +77 -8
  39. package/dist/es2019/nodeviews/TableContainer.js +8 -4
  40. package/dist/es2019/nodeviews/TableResizer.js +6 -5
  41. package/dist/es2019/nodeviews/table.js +12 -4
  42. package/dist/es2019/plugin.js +14 -8
  43. package/dist/es2019/pm-plugins/drag-and-drop/plugin.js +7 -4
  44. package/dist/es2019/pm-plugins/keymap.js +6 -3
  45. package/dist/es2019/pm-plugins/main.js +4 -1
  46. package/dist/es2019/pm-plugins/table-resizing/event-handlers.js +7 -3
  47. package/dist/es2019/pm-plugins/table-resizing/utils/colgroup.js +31 -12
  48. package/dist/es2019/pm-plugins/table-resizing/utils/consts.js +3 -1
  49. package/dist/es2019/pm-plugins/table-resizing/utils/index.js +2 -2
  50. package/dist/es2019/pm-plugins/table-resizing/utils/misc.js +20 -2
  51. package/dist/es2019/pm-plugins/table-resizing/utils/resize-column.js +2 -2
  52. package/dist/es2019/pm-plugins/table-resizing/utils/resize-state.js +47 -10
  53. package/dist/es2019/pm-plugins/table-resizing/utils/scale-table.js +19 -12
  54. package/dist/es2019/toolbar.js +15 -12
  55. package/dist/es2019/transforms/column-width.js +24 -10
  56. package/dist/es2019/transforms/delete-columns.js +2 -2
  57. package/dist/es2019/ui/FloatingContextualMenu/ContextualMenu.js +12 -5
  58. package/dist/es2019/ui/FloatingContextualMenu/index.js +4 -2
  59. package/dist/es2019/ui/FloatingDragMenu/DragMenu.js +3 -2
  60. package/dist/es2019/ui/FloatingDragMenu/index.js +7 -2
  61. package/dist/es2019/ui/FloatingInsertButton/index.js +5 -1
  62. package/dist/es2019/utils/create.js +1 -1
  63. package/dist/es2019/utils/drag-menu.js +4 -4
  64. package/dist/esm/commands/column-resize.js +4 -2
  65. package/dist/esm/commands/delete.js +2 -1
  66. package/dist/esm/commands/insert.js +6 -3
  67. package/dist/esm/commands-with-analytics.js +4 -2
  68. package/dist/esm/event-handlers.js +2 -1
  69. package/dist/esm/nodeviews/TableComponent.js +118 -49
  70. package/dist/esm/nodeviews/TableContainer.js +8 -4
  71. package/dist/esm/nodeviews/TableResizer.js +6 -5
  72. package/dist/esm/nodeviews/table.js +12 -4
  73. package/dist/esm/plugin.js +50 -47
  74. package/dist/esm/pm-plugins/drag-and-drop/plugin.js +9 -6
  75. package/dist/esm/pm-plugins/keymap.js +6 -3
  76. package/dist/esm/pm-plugins/main.js +4 -1
  77. package/dist/esm/pm-plugins/table-resizing/event-handlers.js +7 -3
  78. package/dist/esm/pm-plugins/table-resizing/utils/colgroup.js +32 -11
  79. package/dist/esm/pm-plugins/table-resizing/utils/consts.js +3 -1
  80. package/dist/esm/pm-plugins/table-resizing/utils/index.js +2 -2
  81. package/dist/esm/pm-plugins/table-resizing/utils/misc.js +22 -2
  82. package/dist/esm/pm-plugins/table-resizing/utils/resize-column.js +2 -1
  83. package/dist/esm/pm-plugins/table-resizing/utils/resize-state.js +52 -11
  84. package/dist/esm/pm-plugins/table-resizing/utils/scale-table.js +19 -8
  85. package/dist/esm/toolbar.js +17 -10
  86. package/dist/esm/transforms/column-width.js +23 -8
  87. package/dist/esm/transforms/delete-columns.js +2 -1
  88. package/dist/esm/ui/FloatingContextualMenu/ContextualMenu.js +45 -38
  89. package/dist/esm/ui/FloatingContextualMenu/index.js +4 -2
  90. package/dist/esm/ui/FloatingDragMenu/DragMenu.js +3 -2
  91. package/dist/esm/ui/FloatingDragMenu/index.js +7 -2
  92. package/dist/esm/ui/FloatingInsertButton/index.js +5 -1
  93. package/dist/esm/utils/create.js +1 -1
  94. package/dist/esm/utils/drag-menu.js +4 -3
  95. package/dist/types/commands/column-resize.d.ts +1 -1
  96. package/dist/types/commands/delete.d.ts +1 -1
  97. package/dist/types/commands/insert.d.ts +3 -3
  98. package/dist/types/commands-with-analytics.d.ts +2 -2
  99. package/dist/types/event-handlers.d.ts +1 -1
  100. package/dist/types/nodeviews/TableComponent.d.ts +3 -0
  101. package/dist/types/nodeviews/TableContainer.d.ts +4 -2
  102. package/dist/types/nodeviews/TableResizer.d.ts +2 -1
  103. package/dist/types/nodeviews/table.d.ts +1 -0
  104. package/dist/types/pm-plugins/drag-and-drop/plugin.d.ts +3 -2
  105. package/dist/types/pm-plugins/keymap.d.ts +2 -2
  106. package/dist/types/pm-plugins/table-resizing/utils/colgroup.d.ts +2 -2
  107. package/dist/types/pm-plugins/table-resizing/utils/consts.d.ts +2 -0
  108. package/dist/types/pm-plugins/table-resizing/utils/index.d.ts +2 -2
  109. package/dist/types/pm-plugins/table-resizing/utils/misc.d.ts +7 -0
  110. package/dist/types/pm-plugins/table-resizing/utils/resize-column.d.ts +1 -1
  111. package/dist/types/pm-plugins/table-resizing/utils/resize-state.d.ts +4 -3
  112. package/dist/types/pm-plugins/table-resizing/utils/scale-table.d.ts +4 -4
  113. package/dist/types/toolbar.d.ts +2 -2
  114. package/dist/types/transforms/column-width.d.ts +1 -1
  115. package/dist/types/transforms/delete-columns.d.ts +1 -1
  116. package/dist/types/ui/FloatingContextualMenu/ContextualMenu.d.ts +2 -1
  117. package/dist/types/ui/FloatingContextualMenu/index.d.ts +1 -1
  118. package/dist/types/ui/FloatingDragMenu/DragMenu.d.ts +2 -1
  119. package/dist/types/ui/FloatingDragMenu/index.d.ts +3 -2
  120. package/dist/types/ui/FloatingInsertButton/index.d.ts +2 -1
  121. package/dist/types/utils/drag-menu.d.ts +1 -1
  122. package/dist/types-ts4.5/commands/column-resize.d.ts +1 -1
  123. package/dist/types-ts4.5/commands/delete.d.ts +1 -1
  124. package/dist/types-ts4.5/commands/insert.d.ts +3 -3
  125. package/dist/types-ts4.5/commands-with-analytics.d.ts +2 -2
  126. package/dist/types-ts4.5/event-handlers.d.ts +1 -1
  127. package/dist/types-ts4.5/nodeviews/TableComponent.d.ts +3 -0
  128. package/dist/types-ts4.5/nodeviews/TableContainer.d.ts +4 -2
  129. package/dist/types-ts4.5/nodeviews/TableResizer.d.ts +2 -1
  130. package/dist/types-ts4.5/nodeviews/table.d.ts +1 -0
  131. package/dist/types-ts4.5/pm-plugins/drag-and-drop/plugin.d.ts +3 -2
  132. package/dist/types-ts4.5/pm-plugins/keymap.d.ts +2 -2
  133. package/dist/types-ts4.5/pm-plugins/table-resizing/utils/colgroup.d.ts +2 -2
  134. package/dist/types-ts4.5/pm-plugins/table-resizing/utils/consts.d.ts +2 -0
  135. package/dist/types-ts4.5/pm-plugins/table-resizing/utils/index.d.ts +2 -2
  136. package/dist/types-ts4.5/pm-plugins/table-resizing/utils/misc.d.ts +7 -0
  137. package/dist/types-ts4.5/pm-plugins/table-resizing/utils/resize-column.d.ts +1 -1
  138. package/dist/types-ts4.5/pm-plugins/table-resizing/utils/resize-state.d.ts +4 -3
  139. package/dist/types-ts4.5/pm-plugins/table-resizing/utils/scale-table.d.ts +4 -4
  140. package/dist/types-ts4.5/toolbar.d.ts +2 -2
  141. package/dist/types-ts4.5/transforms/column-width.d.ts +1 -1
  142. package/dist/types-ts4.5/transforms/delete-columns.d.ts +1 -1
  143. package/dist/types-ts4.5/ui/FloatingContextualMenu/ContextualMenu.d.ts +2 -1
  144. package/dist/types-ts4.5/ui/FloatingContextualMenu/index.d.ts +1 -1
  145. package/dist/types-ts4.5/ui/FloatingDragMenu/DragMenu.d.ts +2 -1
  146. package/dist/types-ts4.5/ui/FloatingDragMenu/index.d.ts +3 -2
  147. package/dist/types-ts4.5/ui/FloatingInsertButton/index.d.ts +2 -1
  148. package/dist/types-ts4.5/utils/drag-menu.d.ts +1 -1
  149. package/package.json +2 -2
  150. package/src/commands/column-resize.ts +3 -0
  151. package/src/commands/delete.ts +2 -1
  152. package/src/commands/insert.ts +15 -6
  153. package/src/commands-with-analytics.ts +9 -3
  154. package/src/event-handlers.ts +2 -0
  155. package/src/nodeviews/TableComponent.tsx +91 -5
  156. package/src/nodeviews/TableContainer.tsx +6 -0
  157. package/src/nodeviews/TableResizer.tsx +6 -0
  158. package/src/nodeviews/table.tsx +15 -10
  159. package/src/plugin.tsx +17 -5
  160. package/src/pm-plugins/drag-and-drop/plugin.ts +16 -8
  161. package/src/pm-plugins/keymap.ts +11 -3
  162. package/src/pm-plugins/main.ts +3 -0
  163. package/src/pm-plugins/table-resizing/event-handlers.ts +11 -1
  164. package/src/pm-plugins/table-resizing/utils/colgroup.ts +49 -17
  165. package/src/pm-plugins/table-resizing/utils/consts.ts +2 -0
  166. package/src/pm-plugins/table-resizing/utils/index.ts +8 -1
  167. package/src/pm-plugins/table-resizing/utils/misc.ts +25 -1
  168. package/src/pm-plugins/table-resizing/utils/resize-column.ts +2 -1
  169. package/src/pm-plugins/table-resizing/utils/resize-state.ts +56 -11
  170. package/src/pm-plugins/table-resizing/utils/scale-table.ts +24 -6
  171. package/src/toolbar.tsx +18 -5
  172. package/src/transforms/column-width.ts +33 -11
  173. package/src/transforms/delete-columns.ts +7 -2
  174. package/src/ui/FloatingContextualMenu/ContextualMenu.tsx +20 -5
  175. package/src/ui/FloatingContextualMenu/index.tsx +2 -0
  176. package/src/ui/FloatingDragMenu/DragMenu.tsx +3 -0
  177. package/src/ui/FloatingDragMenu/index.tsx +9 -1
  178. package/src/ui/FloatingInsertButton/index.tsx +17 -5
  179. package/src/utils/create.ts +1 -3
  180. package/src/utils/drag-menu.ts +4 -1
@@ -14,6 +14,7 @@ import { syncStickyRowToTable } from './dom';
14
14
  // Base function to trigger the actual scale on a table node.
15
15
  // Will only resize/scale if a table has been previously resized.
16
16
  export var scale = function scale(tableRef, options, domAtPos) {
17
+ var tablePreserveWidth = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
17
18
  /**
18
19
  * isBreakoutEnabled === true -> default center aligned
19
20
  * isBreakoutEnabled === false -> full width mode
@@ -58,18 +59,21 @@ export var scale = function scale(tableRef, options, domAtPos) {
58
59
  table: node,
59
60
  tableRef: tableRef,
60
61
  start: start,
61
- domAtPos: domAtPos
62
+ domAtPos: domAtPos,
63
+ tablePreserveWidth: tablePreserveWidth
62
64
  });
63
65
  return scaleTableTo(resizeState, newWidth);
64
66
  };
65
67
  export var scaleWithParent = function scaleWithParent(tableRef, parentWidth, table, start, domAtPos) {
68
+ var tablePreserveWidth = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
66
69
  var resizeState = getResizeState({
67
70
  minWidth: tableCellMinWidth,
68
71
  maxSize: parentWidth,
69
72
  table: table,
70
73
  tableRef: tableRef,
71
74
  start: start,
72
- domAtPos: domAtPos
75
+ domAtPos: domAtPos,
76
+ tablePreserveWidth: tablePreserveWidth
73
77
  });
74
78
  if (table.attrs.isNumberColumnEnabled) {
75
79
  parentWidth -= akEditorTableNumberColumnWidth;
@@ -101,6 +105,7 @@ export function scaleTableTo(state, maxSize) {
101
105
  return adjustColumnsWidths(newState, maxSize);
102
106
  }
103
107
  export var previewScaleTable = function previewScaleTable(tableRef, options, domAtPos) {
108
+ var tablePreserveWidth = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
104
109
  var node = options.node,
105
110
  start = options.start,
106
111
  parentWidth = options.parentWidth;
@@ -112,18 +117,22 @@ export var previewScaleTable = function previewScaleTable(tableRef, options, dom
112
117
  var width = isNumberColumnEnabled ? parentWidth - akEditorTableNumberColumnWidth : parentWidth;
113
118
  tableRef.style.width = "".concat(width, "px");
114
119
  }
115
- if (!hasTableBeenResized(node)) {
120
+
121
+ // If the table hasn't been resize, the colgroup 48px width values will gracefully scale down.
122
+ // If we are scaling the table down with tablePreserveWidth, the colgroup widths may be scaled to a value that is not 48px.
123
+ if (!hasTableBeenResized(node) && !tablePreserveWidth) {
116
124
  syncStickyRowToTable(tableRef);
117
125
  return;
118
126
  }
119
- var resizeState = parentWidth ? scaleWithParent(tableRef, parentWidth, node, start, domAtPos) : scale(tableRef, options, domAtPos);
127
+ var resizeState = parentWidth ? scaleWithParent(tableRef, parentWidth, node, start, domAtPos, tablePreserveWidth) : scale(tableRef, options, domAtPos, tablePreserveWidth);
120
128
  if (resizeState) {
121
- updateColgroup(resizeState, tableRef);
129
+ updateColgroup(resizeState, tableRef, tablePreserveWidth);
122
130
  }
123
131
  };
124
132
 
125
133
  // Scale the table to meet new requirements (col, layout change etc)
126
134
  export var scaleTable = function scaleTable(tableRef, options, domAtPos) {
135
+ var tablePreserveWidth = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
127
136
  return function (tr) {
128
137
  if (!tableRef) {
129
138
  return tr;
@@ -136,15 +145,17 @@ export var scaleTable = function scaleTable(tableRef, options, domAtPos) {
136
145
  if (hasTableBeenResized(node) === false) {
137
146
  // If its not a re-sized table, we still want to re-create cols
138
147
  // To force reflow of columns upon delete.
139
- insertColgroupFromNode(tableRef, node);
148
+ if (!tablePreserveWidth) {
149
+ insertColgroupFromNode(tableRef, node);
150
+ }
140
151
  tr.setMeta('scrollIntoView', false);
141
152
  return tr;
142
153
  }
143
154
  var resizeState;
144
155
  if (parentWidth) {
145
- resizeState = scaleWithParent(tableRef, parentWidth, node, start, domAtPos);
156
+ resizeState = scaleWithParent(tableRef, parentWidth, node, start, domAtPos, tablePreserveWidth);
146
157
  } else {
147
- resizeState = scale(tableRef, options, domAtPos);
158
+ resizeState = scale(tableRef, options, domAtPos, tablePreserveWidth);
148
159
  }
149
160
  if (resizeState) {
150
161
  tr = updateColumnWidths(resizeState, node, start)(tr);
@@ -85,6 +85,7 @@ export var getToolbarMenuConfig = function getToolbarMenuConfig(config, state, _
85
85
  export var getToolbarCellOptionsConfig = function getToolbarCellOptionsConfig(editorState, editorView, initialSelectionRect, _ref2, getEditorContainerWidth, editorAnalyticsAPI) {
86
86
  var _pluginState$pluginCo, _pluginState$pluginCo2;
87
87
  var formatMessage = _ref2.formatMessage;
88
+ var tablePreserveWidth = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
88
89
  var top = initialSelectionRect.top,
89
90
  bottom = initialSelectionRect.bottom,
90
91
  right = initialSelectionRect.right,
@@ -99,7 +100,7 @@ export var getToolbarCellOptionsConfig = function getToolbarCellOptionsConfig(ed
99
100
  var selectionRect = getClosestSelectionRect(state);
100
101
  var index = selectionRect === null || selectionRect === void 0 ? void 0 : selectionRect.right;
101
102
  if (index) {
102
- insertColumnWithAnalytics(getEditorContainerWidth, editorAnalyticsAPI)(INPUT_METHOD.FLOATING_TB, index)(state, dispatch, view);
103
+ insertColumnWithAnalytics(getEditorContainerWidth, editorAnalyticsAPI, tablePreserveWidth)(INPUT_METHOD.FLOATING_TB, index)(state, dispatch, view);
103
104
  }
104
105
  return true;
105
106
  },
@@ -178,7 +179,7 @@ export var getToolbarCellOptionsConfig = function getToolbarCellOptionsConfig(ed
178
179
  }];
179
180
  if (pluginState !== null && pluginState !== void 0 && (_pluginState$pluginCo = pluginState.pluginConfig) !== null && _pluginState$pluginCo !== void 0 && _pluginState$pluginCo.allowDistributeColumns) {
180
181
  var _newResizeStateWithAn;
181
- var newResizeStateWithAnalytics = editorView ? getNewResizeStateFromSelectedColumns(initialSelectionRect, editorState, editorView.domAtPos.bind(editorView), getEditorContainerWidth) : undefined;
182
+ var newResizeStateWithAnalytics = editorView ? getNewResizeStateFromSelectedColumns(initialSelectionRect, editorState, editorView.domAtPos.bind(editorView), getEditorContainerWidth, tablePreserveWidth) : undefined;
182
183
  var wouldChange = (_newResizeStateWithAn = newResizeStateWithAnalytics === null || newResizeStateWithAnalytics === void 0 ? void 0 : newResizeStateWithAnalytics.changed) !== null && _newResizeStateWithAn !== void 0 ? _newResizeStateWithAn : false;
183
184
  var distributeColumnWidths = function distributeColumnWidths(state, dispatch) {
184
185
  if (newResizeStateWithAnalytics) {
@@ -298,10 +299,13 @@ export var getToolbarConfig = function getToolbarConfig(getEditorContainerWidth,
298
299
  if (tableObject && pluginState.editorHasFocus && !isWidthResizing) {
299
300
  var nodeType = state.schema.nodes.table;
300
301
  var menu = getToolbarMenuConfig(config, pluginState, intl, editorAnalyticsAPI);
302
+ var _getEditorFeatureFlag = getEditorFeatureFlags(),
303
+ _getEditorFeatureFlag2 = _getEditorFeatureFlag.tablePreserveWidth,
304
+ tablePreserveWidth = _getEditorFeatureFlag2 === void 0 ? false : _getEditorFeatureFlag2;
301
305
  var cellItems;
302
- cellItems = pluginState.isDragAndDropEnabled ? [] : getCellItems(config, state, getEditorView(), intl, getEditorContainerWidth, editorAnalyticsAPI);
306
+ cellItems = pluginState.isDragAndDropEnabled ? [] : getCellItems(config, state, getEditorView(), intl, getEditorContainerWidth, editorAnalyticsAPI, tablePreserveWidth);
303
307
  var columnSettingsItems;
304
- columnSettingsItems = pluginState.isDragAndDropEnabled && getBooleanFF('platform.editor.table.new-cell-context-menu-styling') ? getColumnSettingItems(state, getEditorView(), intl, getEditorContainerWidth, editorAnalyticsAPI) : [];
308
+ columnSettingsItems = pluginState.isDragAndDropEnabled && getBooleanFF('platform.editor.table.new-cell-context-menu-styling') ? getColumnSettingItems(state, getEditorView(), intl, getEditorContainerWidth, editorAnalyticsAPI, tablePreserveWidth) : [];
305
309
  var colorPicker = getColorPicker(state, menu, intl, editorAnalyticsAPI);
306
310
 
307
311
  // Check if we need to show confirm dialog for delete button
@@ -340,8 +344,8 @@ export var getToolbarConfig = function getToolbarConfig(getEditorContainerWidth,
340
344
  }
341
345
  return element;
342
346
  };
343
- var _getEditorFeatureFlag = getEditorFeatureFlags(),
344
- stickyScrollbar = _getEditorFeatureFlag.stickyScrollbar;
347
+ var _getEditorFeatureFlag3 = getEditorFeatureFlags(),
348
+ stickyScrollbar = _getEditorFeatureFlag3.stickyScrollbar;
345
349
  return {
346
350
  title: 'Table floating controls',
347
351
  getDomRef: getDomRef,
@@ -400,22 +404,24 @@ var separator = function separator(hidden) {
400
404
  };
401
405
  var getCellItems = function getCellItems(pluginConfig, state, view, _ref3, getEditorContainerWidth, editorAnalyticsAPI) {
402
406
  var formatMessage = _ref3.formatMessage;
407
+ var tablePreserveWidth = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
403
408
  var initialSelectionRect = getClosestSelectionRect(state);
404
409
  if (initialSelectionRect) {
405
410
  var cellOptions = getToolbarCellOptionsConfig(state, view, initialSelectionRect, {
406
411
  formatMessage: formatMessage
407
- }, getEditorContainerWidth, editorAnalyticsAPI);
412
+ }, getEditorContainerWidth, editorAnalyticsAPI, tablePreserveWidth);
408
413
  return [cellOptions, separator(cellOptions.hidden)];
409
414
  }
410
415
  return [];
411
416
  };
412
417
  export var getDistributeConfig = function getDistributeConfig(getEditorContainerWidth, editorAnalyticsAPI) {
418
+ var tablePreserveWidth = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
413
419
  return function (state, dispatch, editorView) {
414
420
  var selectionOrTableRect = getClosestSelectionOrTableRect(state);
415
421
  if (!editorView || !selectionOrTableRect) {
416
422
  return false;
417
423
  }
418
- var newResizeStateWithAnalytics = getNewResizeStateFromSelectedColumns(selectionOrTableRect, state, editorView.domAtPos.bind(editorView), getEditorContainerWidth);
424
+ var newResizeStateWithAnalytics = getNewResizeStateFromSelectedColumns(selectionOrTableRect, state, editorView.domAtPos.bind(editorView), getEditorContainerWidth, tablePreserveWidth);
419
425
  if (newResizeStateWithAnalytics) {
420
426
  distributeColumnsWidthsWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.FLOATING_TB, newResizeStateWithAnalytics)(state, dispatch);
421
427
  return true;
@@ -429,12 +435,13 @@ export var getDistributeConfig = function getDistributeConfig(getEditorContainer
429
435
  var getColumnSettingItems = function getColumnSettingItems(editorState, editorView, _ref4, getEditorContainerWidth, editorAnalyticsAPI) {
430
436
  var _newResizeStateWithAn2, _pluginState$pluginCo3;
431
437
  var formatMessage = _ref4.formatMessage;
438
+ var tablePreserveWidth = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
432
439
  var pluginState = getPluginState(editorState);
433
440
  var selectionOrTableRect = getClosestSelectionOrTableRect(editorState);
434
441
  if (!selectionOrTableRect || !editorView) {
435
442
  return [];
436
443
  }
437
- var newResizeStateWithAnalytics = getNewResizeStateFromSelectedColumns(selectionOrTableRect, editorState, editorView.domAtPos.bind(editorView), getEditorContainerWidth);
444
+ var newResizeStateWithAnalytics = getNewResizeStateFromSelectedColumns(selectionOrTableRect, editorState, editorView.domAtPos.bind(editorView), getEditorContainerWidth, tablePreserveWidth);
438
445
  var wouldChange = (_newResizeStateWithAn2 = newResizeStateWithAnalytics === null || newResizeStateWithAnalytics === void 0 ? void 0 : newResizeStateWithAnalytics.changed) !== null && _newResizeStateWithAn2 !== void 0 ? _newResizeStateWithAn2 : false;
439
446
  if (pluginState !== null && pluginState !== void 0 && (_pluginState$pluginCo3 = pluginState.pluginConfig) !== null && _pluginState$pluginCo3 !== void 0 && _pluginState$pluginCo3.allowDistributeColumns && pluginState.isDragAndDropEnabled) {
440
447
  return [{
@@ -443,7 +450,7 @@ var getColumnSettingItems = function getColumnSettingItems(editorState, editorVi
443
450
  title: formatMessage(messages.distributeColumns),
444
451
  icon: DistributeColumnIcon,
445
452
  onClick: function onClick(state, dispatch, view) {
446
- return getDistributeConfig(getEditorContainerWidth, editorAnalyticsAPI)(state, dispatch, view);
453
+ return getDistributeConfig(getEditorContainerWidth, editorAnalyticsAPI, tablePreserveWidth)(state, dispatch, view);
447
454
  },
448
455
  disabled: !wouldChange
449
456
  }, {
@@ -5,7 +5,7 @@ import { tableCellMinWidth } from '@atlaskit/editor-common/styles';
5
5
  import { AttrStep } from '@atlaskit/editor-prosemirror/transform';
6
6
  import { TableMap } from '@atlaskit/editor-tables/table-map';
7
7
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
8
- import { hasTableBeenResized } from '../pm-plugins/table-resizing/utils';
8
+ import { getTableContainerElement, getTableElementWidth, hasTableBeenResized } from '../pm-plugins/table-resizing/utils';
9
9
  import { isMinCellWidthTable } from '../pm-plugins/table-resizing/utils/colgroup';
10
10
  import { getResizeState } from '../pm-plugins/table-resizing/utils/resize-state';
11
11
  import { scaleTableTo } from '../pm-plugins/table-resizing/utils/scale-table';
@@ -88,9 +88,9 @@ export var updateColumnWidths = function updateColumnWidths(resizeState, table,
88
88
  * @returns Updated transaction with rescaled columns for a given table
89
89
  */
90
90
  export var rescaleColumns = function rescaleColumns() {
91
+ var tablePreserveWidth = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
91
92
  return function (table, view) {
92
93
  return function (tr) {
93
- var _tableRef$parentEleme, _tableRef$parentEleme2;
94
94
  if (!view) {
95
95
  return tr;
96
96
  }
@@ -102,14 +102,28 @@ export var rescaleColumns = function rescaleColumns() {
102
102
  return tr;
103
103
  }
104
104
  var isResized = hasTableBeenResized(table.node);
105
- // get current table info
106
105
  var previousTableInfo = {
107
- // when table is resized the tableRef client width will be 1px larger than colGroup, which is used in calculations
108
- width: isResized ? tableRef.clientWidth - 1 : tableRef.clientWidth,
109
- /** the is the width the table can reach before overflowing */
110
- possibleMaxWidth: getBooleanFF('platform.editor.custom-table-width') ? (tableRef === null || tableRef === void 0 || (_tableRef$parentEleme = tableRef.parentElement) === null || _tableRef$parentEleme === void 0 ? void 0 : _tableRef$parentEleme.clientWidth) || 0 : ((tableRef === null || tableRef === void 0 || (_tableRef$parentEleme2 = tableRef.parentElement) === null || _tableRef$parentEleme2 === void 0 ? void 0 : _tableRef$parentEleme2.clientWidth) || 0) - insertColumnButtonOffset,
106
+ width: 0,
107
+ possibleMaxWidth: 0,
111
108
  isResized: isResized
112
109
  };
110
+ if (tablePreserveWidth) {
111
+ previousTableInfo = {
112
+ // TODO - ensure correct width is returned when table doesn't have a width value
113
+ width: getTableElementWidth(table.node),
114
+ possibleMaxWidth: getBooleanFF('platform.editor.custom-table-width') ? getTableContainerElement(table.node) : getTableContainerElement(table.node) - insertColumnButtonOffset,
115
+ isResized: isResized
116
+ };
117
+ } else {
118
+ var _tableRef$parentEleme, _tableRef$parentEleme2;
119
+ previousTableInfo = {
120
+ // when table is resized the tableRef client width will be 1px larger than colGroup, which is used in calculations
121
+ width: isResized ? tableRef.clientWidth - 1 : tableRef.clientWidth,
122
+ /** the is the width the table can reach before overflowing */
123
+ possibleMaxWidth: getBooleanFF('platform.editor.custom-table-width') ? (tableRef === null || tableRef === void 0 || (_tableRef$parentEleme = tableRef.parentElement) === null || _tableRef$parentEleme === void 0 ? void 0 : _tableRef$parentEleme.clientWidth) || 0 : ((tableRef === null || tableRef === void 0 || (_tableRef$parentEleme2 = tableRef.parentElement) === null || _tableRef$parentEleme2 === void 0 ? void 0 : _tableRef$parentEleme2.clientWidth) || 0) - insertColumnButtonOffset,
124
+ isResized: isResized
125
+ };
126
+ }
113
127
 
114
128
  // determine the new table, based on new width
115
129
  var newTableInfo = {
@@ -154,7 +168,8 @@ export var rescaleColumns = function rescaleColumns() {
154
168
  start: table.start,
155
169
  tableRef: tableRef,
156
170
  domAtPos: domAtPos,
157
- maxSize: previousTableInfo.possibleMaxWidth
171
+ maxSize: previousTableInfo.possibleMaxWidth,
172
+ tablePreserveWidth: tablePreserveWidth
158
173
  });
159
174
 
160
175
  // Two scenarios that require scaling:
@@ -205,6 +205,7 @@ function fixRowSpans(table) {
205
205
  return table.type.createChecked(table.attrs, rows, table.marks);
206
206
  }
207
207
  export var deleteColumns = function deleteColumns(rect, allowCustomStep, view) {
208
+ var tablePreserveWidth = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
208
209
  return function (tr) {
209
210
  var updatedTr = tr;
210
211
  updatedTr.setMeta(META_KEYS.OVERFLOW_TRIGGER, {
@@ -217,7 +218,7 @@ export var deleteColumns = function deleteColumns(rect, allowCustomStep, view) {
217
218
  }
218
219
  var table = findTable(updatedTr.selection);
219
220
  if (table) {
220
- updatedTr = rescaleColumns()(table, view)(updatedTr);
221
+ updatedTr = rescaleColumns(tablePreserveWidth)(table, view)(updatedTr);
221
222
  }
222
223
  return updatedTr;
223
224
  };
@@ -274,8 +274,11 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
274
274
  isDragAndDropEnabled = _getPluginState8.isDragAndDropEnabled,
275
275
  allowDistributeColumns = _getPluginState8.pluginConfig.allowDistributeColumns;
276
276
  if (allowDistributeColumns && (!isDragAndDropEnabled || !getBooleanFF('platform.editor.table.new-cell-context-menu-styling'))) {
277
- var _newResizeState$chang;
278
- var newResizeState = getNewResizeStateFromSelectedColumns(selectionRect, editorView.state, editorView.domAtPos.bind(editorView), getEditorContainerWidth);
277
+ var _this$props$getEditor, _this$props9, _newResizeState$chang;
278
+ var _ref = ((_this$props$getEditor = (_this$props9 = _this.props).getEditorFeatureFlags) === null || _this$props$getEditor === void 0 ? void 0 : _this$props$getEditor.call(_this$props9)) || {},
279
+ _ref$tablePreserveWid = _ref.tablePreserveWidth,
280
+ tablePreserveWidth = _ref$tablePreserveWid === void 0 ? false : _ref$tablePreserveWid;
281
+ var newResizeState = getNewResizeStateFromSelectedColumns(selectionRect, editorView.state, editorView.domAtPos.bind(editorView), getEditorContainerWidth, tablePreserveWidth);
279
282
  var wouldChange = (_newResizeState$chang = newResizeState === null || newResizeState === void 0 ? void 0 : newResizeState.changed) !== null && _newResizeState$chang !== void 0 ? _newResizeState$chang : false;
280
283
  return {
281
284
  content: formatMessage(messages.distributeColumns),
@@ -288,10 +291,10 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
288
291
  return null;
289
292
  });
290
293
  _defineProperty(_assertThisInitialized(_this), "createSortColumnItems", function () {
291
- var _this$props9 = _this.props,
292
- formatMessage = _this$props9.intl.formatMessage,
293
- editorView = _this$props9.editorView,
294
- allowColumnSorting = _this$props9.allowColumnSorting;
294
+ var _this$props10 = _this.props,
295
+ formatMessage = _this$props10.intl.formatMessage,
296
+ editorView = _this$props10.editorView,
297
+ allowColumnSorting = _this$props10.allowColumnSorting;
295
298
  var _getPluginState9 = getPluginState(editorView.state),
296
299
  isDragAndDropEnabled = _getPluginState9.isDragAndDropEnabled;
297
300
  if (allowColumnSorting && (!isDragAndDropEnabled || !getBooleanFF('platform.editor.table.new-cell-context-menu-styling'))) {
@@ -357,18 +360,22 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
357
360
  items[1].items.push(deleteRowItem);
358
361
  return items;
359
362
  });
360
- _defineProperty(_assertThisInitialized(_this), "onMenuItemActivated", function (_ref) {
361
- var item = _ref.item;
362
- var _this$props10 = _this.props,
363
- editorView = _this$props10.editorView,
364
- selectionRect = _this$props10.selectionRect,
365
- editorAnalyticsAPI = _this$props10.editorAnalyticsAPI,
366
- getEditorContainerWidth = _this$props10.getEditorContainerWidth;
363
+ _defineProperty(_assertThisInitialized(_this), "onMenuItemActivated", function (_ref2) {
364
+ var item = _ref2.item;
365
+ var _this$props11 = _this.props,
366
+ editorView = _this$props11.editorView,
367
+ selectionRect = _this$props11.selectionRect,
368
+ editorAnalyticsAPI = _this$props11.editorAnalyticsAPI,
369
+ getEditorContainerWidth = _this$props11.getEditorContainerWidth,
370
+ getEditorFeatureFlags = _this$props11.getEditorFeatureFlags;
367
371
  // TargetCellPosition could be outdated: https://product-fabric.atlassian.net/browse/ED-8129
368
372
  var state = editorView.state,
369
373
  dispatch = editorView.dispatch;
370
374
  var _getPluginState10 = getPluginState(state),
371
375
  targetCellPosition = _getPluginState10.targetCellPosition;
376
+ var _ref3 = (getEditorFeatureFlags === null || getEditorFeatureFlags === void 0 ? void 0 : getEditorFeatureFlags()) || {},
377
+ _ref3$tablePreserveWi = _ref3.tablePreserveWidth,
378
+ tablePreserveWidth = _ref3$tablePreserveWi === void 0 ? false : _ref3$tablePreserveWi;
372
379
  switch (item.value.name) {
373
380
  case 'sort_column_desc':
374
381
  sortColumnWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.CONTEXT_MENU, selectionRect.left, SortOrder.DESC)(state, dispatch);
@@ -387,7 +394,7 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
387
394
  _this.toggleOpen();
388
395
  break;
389
396
  case 'distribute_columns':
390
- var newResizeStateWithAnalytics = getNewResizeStateFromSelectedColumns(selectionRect, state, editorView.domAtPos.bind(editorView), getEditorContainerWidth);
397
+ var newResizeStateWithAnalytics = getNewResizeStateFromSelectedColumns(selectionRect, state, editorView.domAtPos.bind(editorView), getEditorContainerWidth, tablePreserveWidth);
391
398
  if (newResizeStateWithAnalytics) {
392
399
  distributeColumnsWidthsWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.CONTEXT_MENU, newResizeStateWithAnalytics)(state, dispatch);
393
400
  _this.toggleOpen();
@@ -398,7 +405,7 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
398
405
  _this.toggleOpen();
399
406
  break;
400
407
  case 'insert_column':
401
- insertColumnWithAnalytics(getEditorContainerWidth, editorAnalyticsAPI)(INPUT_METHOD.CONTEXT_MENU, selectionRect.right)(state, dispatch, editorView);
408
+ insertColumnWithAnalytics(getEditorContainerWidth, editorAnalyticsAPI, tablePreserveWidth)(INPUT_METHOD.CONTEXT_MENU, selectionRect.right)(state, dispatch, editorView);
402
409
  _this.toggleOpen();
403
410
  break;
404
411
  case 'insert_row':
@@ -421,11 +428,11 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
421
428
  }
422
429
  });
423
430
  _defineProperty(_assertThisInitialized(_this), "toggleOpen", function () {
424
- var _this$props11 = _this.props,
425
- isOpen = _this$props11.isOpen,
426
- _this$props11$editorV = _this$props11.editorView,
427
- state = _this$props11$editorV.state,
428
- dispatch = _this$props11$editorV.dispatch;
431
+ var _this$props12 = _this.props,
432
+ isOpen = _this$props12.isOpen,
433
+ _this$props12$editorV = _this$props12.editorView,
434
+ state = _this$props12$editorV.state,
435
+ dispatch = _this$props12$editorV.dispatch;
429
436
  toggleContextualMenu()(state, dispatch);
430
437
  if (!isOpen) {
431
438
  _this.setState({
@@ -442,13 +449,13 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
442
449
  isSubmenuOpen: false
443
450
  });
444
451
  });
445
- _defineProperty(_assertThisInitialized(_this), "handleItemMouseEnter", function (_ref2) {
446
- var item = _ref2.item;
447
- var _this$props12 = _this.props,
448
- _this$props12$editorV = _this$props12.editorView,
449
- state = _this$props12$editorV.state,
450
- dispatch = _this$props12$editorV.dispatch,
451
- selectionRect = _this$props12.selectionRect;
452
+ _defineProperty(_assertThisInitialized(_this), "handleItemMouseEnter", function (_ref4) {
453
+ var item = _ref4.item;
454
+ var _this$props13 = _this.props,
455
+ _this$props13$editorV = _this$props13.editorView,
456
+ state = _this$props13$editorV.state,
457
+ dispatch = _this$props13$editorV.dispatch,
458
+ selectionRect = _this$props13.selectionRect;
452
459
  if (item.value.name === 'background') {
453
460
  if (!_this.state.isSubmenuOpen) {
454
461
  _this.setState({
@@ -466,8 +473,8 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
466
473
  hoverMergedCells()(state, dispatch);
467
474
  }
468
475
  });
469
- _defineProperty(_assertThisInitialized(_this), "handleItemMouseLeave", function (_ref3) {
470
- var item = _ref3.item;
476
+ _defineProperty(_assertThisInitialized(_this), "handleItemMouseLeave", function (_ref5) {
477
+ var item = _ref5.item;
471
478
  var _this$props$editorVie2 = _this.props.editorView,
472
479
  state = _this$props$editorVie2.state,
473
480
  dispatch = _this$props$editorVie2.dispatch;
@@ -486,9 +493,9 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
486
493
  }
487
494
  });
488
495
  _defineProperty(_assertThisInitialized(_this), "setColor", function (color) {
489
- var _this$props13 = _this.props,
490
- editorView = _this$props13.editorView,
491
- editorAnalyticsAPI = _this$props13.editorAnalyticsAPI;
496
+ var _this$props14 = _this.props,
497
+ editorView = _this$props14.editorView,
498
+ editorAnalyticsAPI = _this$props14.editorAnalyticsAPI;
492
499
  // TargetCellPosition could be outdated: https://product-fabric.atlassian.net/browse/ED-8129
493
500
  var _getPluginState12 = getPluginState(editorView.state),
494
501
  targetCellPosition = _getPluginState12.targetCellPosition;
@@ -502,12 +509,12 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
502
509
  _createClass(ContextualMenu, [{
503
510
  key: "render",
504
511
  value: function render() {
505
- var _this$props14 = this.props,
506
- isOpen = _this$props14.isOpen,
507
- mountPoint = _this$props14.mountPoint,
508
- offset = _this$props14.offset,
509
- boundariesElement = _this$props14.boundariesElement,
510
- editorView = _this$props14.editorView;
512
+ var _this$props15 = this.props,
513
+ isOpen = _this$props15.isOpen,
514
+ mountPoint = _this$props15.mountPoint,
515
+ offset = _this$props15.offset,
516
+ boundariesElement = _this$props15.boundariesElement,
517
+ editorView = _this$props15.editorView;
511
518
  var _getPluginState13 = getPluginState(editorView.state),
512
519
  isDragAndDropEnabled = _getPluginState13.isDragAndDropEnabled;
513
520
  var items = isDragAndDropEnabled && getBooleanFF('platform.editor.table.new-cell-context-menu-styling') ? this.createNewContextMenuItems() : this.createOriginalContextMenuItems();
@@ -16,7 +16,8 @@ var FloatingContextualMenu = function FloatingContextualMenu(_ref) {
16
16
  isOpen = _ref.isOpen,
17
17
  pluginConfig = _ref.pluginConfig,
18
18
  editorAnalyticsAPI = _ref.editorAnalyticsAPI,
19
- getEditorContainerWidth = _ref.getEditorContainerWidth;
19
+ getEditorContainerWidth = _ref.getEditorContainerWidth,
20
+ getEditorFeatureFlags = _ref.getEditorFeatureFlags;
20
21
  // TargetCellPosition could be outdated: https://product-fabric.atlassian.net/browse/ED-8129
21
22
  var _getPluginState = getPluginState(editorView.state),
22
23
  targetCellPosition = _getPluginState.targetCellPosition,
@@ -64,7 +65,8 @@ var FloatingContextualMenu = function FloatingContextualMenu(_ref) {
64
65
  selectionRect: selectionRect,
65
66
  boundariesElement: boundariesElement,
66
67
  editorAnalyticsAPI: editorAnalyticsAPI,
67
- getEditorContainerWidth: getEditorContainerWidth
68
+ getEditorContainerWidth: getEditorContainerWidth,
69
+ getEditorFeatureFlags: getEditorFeatureFlags
68
70
  })));
69
71
  };
70
72
  FloatingContextualMenu.displayName = 'FloatingContextualMenu';
@@ -179,7 +179,8 @@ export var DragMenu = /*#__PURE__*/React.memo(function (_ref) {
179
179
  fitWidth = _ref.fitWidth,
180
180
  mountPoint = _ref.mountPoint,
181
181
  scrollableElement = _ref.scrollableElement,
182
- boundariesElement = _ref.boundariesElement;
182
+ boundariesElement = _ref.boundariesElement,
183
+ tablePreserveWidth = _ref.tablePreserveWidth;
183
184
  var state = editorView.state,
184
185
  dispatch = editorView.dispatch;
185
186
  var selection = state.selection;
@@ -195,7 +196,7 @@ export var DragMenu = /*#__PURE__*/React.memo(function (_ref) {
195
196
  var shouldMoveDisabled = index !== undefined && hasMergedCells(index)(selection);
196
197
  var hasMergedCellsInTable = getMergedCellsPositions(state.tr).length > 0;
197
198
  var allowBackgroundColor = (_pluginConfig$allowBa = pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.allowBackgroundColor) !== null && _pluginConfig$allowBa !== void 0 ? _pluginConfig$allowBa : false;
198
- var dragMenuConfig = getDragMenuConfig(direction, getEditorContainerWidth, !shouldMoveDisabled, hasMergedCellsInTable, editorView, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI, pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.isHeaderRowRequired);
199
+ var dragMenuConfig = getDragMenuConfig(direction, getEditorContainerWidth, !shouldMoveDisabled, hasMergedCellsInTable, editorView, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI, pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.isHeaderRowRequired, tablePreserveWidth);
199
200
  var _convertToDropdownIte = convertToDropdownItems(dragMenuConfig, formatMessage, selectionRect),
200
201
  menuItems = _convertToDropdownIte.menuItems,
201
202
  menuCallback = _convertToDropdownIte.menuCallback;
@@ -17,7 +17,8 @@ var FloatingDragMenu = function FloatingDragMenu(_ref) {
17
17
  getEditorContainerWidth = _ref.getEditorContainerWidth,
18
18
  editorAnalyticsAPI = _ref.editorAnalyticsAPI,
19
19
  stickyHeaders = _ref.stickyHeaders,
20
- pluginConfig = _ref.pluginConfig;
20
+ pluginConfig = _ref.pluginConfig,
21
+ getEditorFeatureFlags = _ref.getEditorFeatureFlags;
21
22
  if (!isOpen || !targetCellPosition || editorView.state.doc.nodeSize <= targetCellPosition) {
22
23
  return null;
23
24
  }
@@ -27,6 +28,9 @@ var FloatingDragMenu = function FloatingDragMenu(_ref) {
27
28
  if (!targetHandleRef || !(editorView.state.selection instanceof CellSelection)) {
28
29
  return null;
29
30
  }
31
+ var _getEditorFeatureFlag = getEditorFeatureFlags(),
32
+ _getEditorFeatureFlag2 = _getEditorFeatureFlag.tablePreserveWidth,
33
+ tablePreserveWidth = _getEditorFeatureFlag2 === void 0 ? false : _getEditorFeatureFlag2;
30
34
  return /*#__PURE__*/React.createElement(Popup, {
31
35
  alignX: direction === 'row' ? 'right' : undefined,
32
36
  alignY: direction === 'row' ? 'start' : undefined,
@@ -59,7 +63,8 @@ var FloatingDragMenu = function FloatingDragMenu(_ref) {
59
63
  fitHeight: tablePopupMenuFitHeight,
60
64
  mountPoint: mountPoint,
61
65
  boundariesElement: boundariesElement,
62
- scrollableElement: scrollableElement
66
+ scrollableElement: scrollableElement,
67
+ tablePreserveWidth: tablePreserveWidth
63
68
  }));
64
69
  };
65
70
  FloatingDragMenu.displayName = 'FloatingDragMenu';
@@ -188,10 +188,14 @@ export var FloatingInsertButton = /*#__PURE__*/function (_React$Component) {
188
188
  editorAnalyticsAPI = _this$props4.editorAnalyticsAPI,
189
189
  getEditorContainerWidth = _this$props4.getEditorContainerWidth;
190
190
  if (typeof insertColumnButtonIndex !== 'undefined') {
191
+ var _this$props$getEditor, _this$props5;
191
192
  event.preventDefault();
193
+ var _ref = ((_this$props$getEditor = (_this$props5 = this.props).getEditorFeatureFlags) === null || _this$props$getEditor === void 0 ? void 0 : _this$props$getEditor.call(_this$props5)) || {},
194
+ _ref$tablePreserveWid = _ref.tablePreserveWidth,
195
+ tablePreserveWidth = _ref$tablePreserveWid === void 0 ? false : _ref$tablePreserveWid;
192
196
  var state = editorView.state,
193
197
  dispatch = editorView.dispatch;
194
- insertColumnWithAnalytics(getEditorContainerWidth, editorAnalyticsAPI)(INPUT_METHOD.BUTTON, insertColumnButtonIndex)(state, dispatch, editorView);
198
+ insertColumnWithAnalytics(getEditorContainerWidth, editorAnalyticsAPI, tablePreserveWidth)(INPUT_METHOD.BUTTON, insertColumnButtonIndex)(state, dispatch, editorView);
195
199
  }
196
200
  }
197
201
  }]);
@@ -5,7 +5,7 @@ import { createTable } from '@atlaskit/editor-tables/utils';
5
5
  import { TABLE_MAX_WIDTH } from '../pm-plugins/table-resizing/utils';
6
6
  export var createTableWithWidth = function createTableWithWidth(isFullWidthModeEnabled, getEditorFeatureFlags, createTableProps) {
7
7
  return function (schema) {
8
- var _ref = getEditorFeatureFlags ? getEditorFeatureFlags() : {},
8
+ var _ref = (getEditorFeatureFlags === null || getEditorFeatureFlags === void 0 ? void 0 : getEditorFeatureFlags()) || {},
9
9
  _ref$tablePreserveWid = _ref.tablePreserveWidth,
10
10
  tablePreserveWidth = _ref$tablePreserveWid === void 0 ? false : _ref$tablePreserveWid;
11
11
  if (tablePreserveWidth && isFullWidthModeEnabled) {
@@ -63,6 +63,7 @@ var defaultSelectionRect = {
63
63
  };
64
64
  export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorContainerWidth, canDrag, hasMergedCellsInTable, editorView, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI, isHeaderRowRequired) {
65
65
  var _tableMap$height, _tableMap$height2, _tableMap$width, _tableMap$width2;
66
+ var tablePreserveWidth = arguments.length > 11 && arguments[11] !== undefined ? arguments[11] : false;
66
67
  var addOptions = direction === 'row' ? [{
67
68
  label: 'above',
68
69
  offset: 0,
@@ -147,7 +148,7 @@ export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorCo
147
148
  moveCursorToInsertedRow: true
148
149
  })(state, dispatch);
149
150
  } else {
150
- insertColumnWithAnalytics(getEditorContainerWidth, editorAnalyticsAPI)(INPUT_METHOD.TABLE_CONTEXT_MENU, (index !== null && index !== void 0 ? index : 0) + offset)(state, dispatch, editorView);
151
+ insertColumnWithAnalytics(getEditorContainerWidth, editorAnalyticsAPI, tablePreserveWidth)(INPUT_METHOD.TABLE_CONTEXT_MENU, (index !== null && index !== void 0 ? index : 0) + offset)(state, dispatch, editorView);
151
152
  }
152
153
  return true;
153
154
  },
@@ -160,7 +161,7 @@ export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorCo
160
161
  onClick: function onClick(state, dispatch) {
161
162
  var selectionRect = getClosestSelectionRect(state);
162
163
  if (selectionRect) {
163
- var newResizeState = getNewResizeStateFromSelectedColumns(selectionRect, state, editorView.domAtPos.bind(editorView), getEditorContainerWidth);
164
+ var newResizeState = getNewResizeStateFromSelectedColumns(selectionRect, state, editorView.domAtPos.bind(editorView), getEditorContainerWidth, tablePreserveWidth);
164
165
  if (newResizeState) {
165
166
  distributeColumnsWidthsWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.TABLE_CONTEXT_MENU, newResizeState)(state, dispatch);
166
167
  return true;
@@ -186,7 +187,7 @@ export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorCo
186
187
  if (direction === 'row') {
187
188
  deleteRowsWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.TABLE_CONTEXT_MENU, selectionRect !== null && selectionRect !== void 0 ? selectionRect : defaultSelectionRect, !!isHeaderRowRequired)(state, dispatch);
188
189
  } else {
189
- deleteColumnsWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.TABLE_CONTEXT_MENU, selectionRect !== null && selectionRect !== void 0 ? selectionRect : defaultSelectionRect)(state, dispatch, editorView);
190
+ deleteColumnsWithAnalytics(editorAnalyticsAPI, tablePreserveWidth)(INPUT_METHOD.TABLE_CONTEXT_MENU, selectionRect !== null && selectionRect !== void 0 ? selectionRect : defaultSelectionRect)(state, dispatch, editorView);
190
191
  }
191
192
  return true;
192
193
  },
@@ -3,5 +3,5 @@ import type { Transaction } from '@atlaskit/editor-prosemirror/state';
3
3
  import type { Direction } from '@atlaskit/editor-tables/types';
4
4
  export declare const initiateKeyboardColumnResizing: Command;
5
5
  export declare const activateNextResizeArea: (direction: Direction) => Command;
6
- export declare const changeColumnWidthByStep: (stepSize: number, getEditorContainerWidth: GetEditorContainerWidth) => Command;
6
+ export declare const changeColumnWidthByStep: (stepSize: number, getEditorContainerWidth: GetEditorContainerWidth, tablePreserveWidth?: boolean) => Command;
7
7
  export declare const stopKeyboardColumnResizing: (originalTr?: Transaction) => Command;
@@ -1,3 +1,3 @@
1
1
  import type { Command } from '@atlaskit/editor-common/types';
2
2
  import type { Rect } from '@atlaskit/editor-tables/table-map';
3
- export declare const deleteColumnsCommand: (rect: Rect) => Command;
3
+ export declare const deleteColumnsCommand: (rect: Rect, tablePreserveWidth?: boolean) => Command;
@@ -2,10 +2,10 @@ import type { EditorAnalyticsAPI, INPUT_METHOD } from '@atlaskit/editor-common/a
2
2
  import type { Command, EditorCommand, GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
3
3
  import type { Transaction } from '@atlaskit/editor-prosemirror/state';
4
4
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
5
- export declare function addColumnAt(getEditorContainerWidth: GetEditorContainerWidth): (column: number, allowAddColumnCustomStep: boolean | undefined, view: EditorView | undefined) => (tr: Transaction) => Transaction;
6
- export declare const addColumnBefore: (getEditorContainerWidth: GetEditorContainerWidth) => Command;
5
+ export declare function addColumnAt(getEditorContainerWidth: GetEditorContainerWidth, tablePreserveWidth?: boolean): (column: number, allowAddColumnCustomStep: boolean | undefined, view: EditorView | undefined) => (tr: Transaction) => Transaction;
6
+ export declare const addColumnBefore: (getEditorContainerWidth: GetEditorContainerWidth, tablePreserveWidth?: boolean) => Command;
7
7
  export declare const addColumnAfter: (getEditorContainerWidth: GetEditorContainerWidth) => Command;
8
- export declare const insertColumn: (getEditorContainerWidth: GetEditorContainerWidth) => (column: number) => Command;
8
+ export declare const insertColumn: (getEditorContainerWidth: GetEditorContainerWidth, tablePreserveWidth?: boolean) => (column: number) => Command;
9
9
  export declare const insertRow: (row: number, moveCursorToTheNewRow: boolean) => Command;
10
10
  export declare const createTable: (isFullWidthModeEnabled?: boolean, getEditorFeatureFlags?: GetEditorFeatureFlags) => Command;
11
11
  export declare const insertTableWithSize: (isFullWidthModeEnabled?: boolean, getEditorFeatureFlags?: GetEditorFeatureFlags, editorAnalyticsAPI?: EditorAnalyticsAPI) => (rowsCount: number, colsCount: number, inputMethod?: INPUT_METHOD.PICKER) => EditorCommand;
@@ -11,9 +11,9 @@ export declare const splitCellWithAnalytics: (editorAnalyticsAPI: EditorAnalytic
11
11
  export declare const setColorWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.FLOATING_TB | INPUT_METHOD.TABLE_CONTEXT_MENU, cellColor: string, targetCellPosition?: number) => Command;
12
12
  export declare const addRowAroundSelection: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (side: RowInsertPosition) => Command;
13
13
  export declare const insertRowWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: InsertRowMethods, options: InsertRowOptions) => Command;
14
- export declare const insertColumnWithAnalytics: (getEditorContainerWidth: GetEditorContainerWidth, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.BUTTON | INPUT_METHOD.SHORTCUT | INPUT_METHOD.FLOATING_TB | INPUT_METHOD.TABLE_CONTEXT_MENU, position: number) => Command;
14
+ export declare const insertColumnWithAnalytics: (getEditorContainerWidth: GetEditorContainerWidth, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, tablePreserveWidth?: boolean) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.BUTTON | INPUT_METHOD.SHORTCUT | INPUT_METHOD.FLOATING_TB | INPUT_METHOD.TABLE_CONTEXT_MENU, position: number) => Command;
15
15
  export declare const deleteRowsWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.BUTTON | INPUT_METHOD.FLOATING_TB | INPUT_METHOD.SHORTCUT | INPUT_METHOD.TABLE_CONTEXT_MENU, rect: Rect, isHeaderRowRequired: boolean) => Command;
16
- export declare const deleteColumnsWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.BUTTON | INPUT_METHOD.FLOATING_TB | INPUT_METHOD.SHORTCUT | INPUT_METHOD.TABLE_CONTEXT_MENU, rect: Rect) => Command;
16
+ export declare const deleteColumnsWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, tablePreserveWidth?: boolean) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.BUTTON | INPUT_METHOD.FLOATING_TB | INPUT_METHOD.SHORTCUT | INPUT_METHOD.TABLE_CONTEXT_MENU, rect: Rect) => Command;
17
17
  export declare const deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => Command;
18
18
  export declare const deleteTableWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => Command;
19
19
  export declare const deleteTableIfSelectedWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: INPUT_METHOD.FLOATING_TB | INPUT_METHOD.KEYBOARD) => Command;
@@ -13,7 +13,7 @@ export declare const handleMouseEnter: (view: EditorView, mouseEvent: Event) =>
13
13
  export declare const handleMouseLeave: (view: EditorView, event: Event) => boolean;
14
14
  export declare const handleMouseMove: (view: EditorView, event: Event, elementContentRects?: ElementContentRects) => boolean;
15
15
  export declare function handleTripleClick(view: EditorView, pos: number): boolean;
16
- export declare const handleCut: (oldTr: Transaction, oldState: EditorState, newState: EditorState, editorAnalyticsAPI?: EditorAnalyticsAPI, editorView?: EditorView) => Transaction;
16
+ export declare const handleCut: (oldTr: Transaction, oldState: EditorState, newState: EditorState, editorAnalyticsAPI?: EditorAnalyticsAPI, editorView?: EditorView, tablePreserveWidth?: boolean) => Transaction;
17
17
  export declare const isTableInFocus: (view: EditorView) => boolean;
18
18
  export declare const whenTableInFocus: (eventHandler: (view: EditorView, mouseEvent: Event, elementContentRects?: ElementContentRects) => boolean, elementContentRects?: ElementContentRects) => (view: EditorView, mouseEvent: Event) => boolean;
19
19
  export declare const withCellTracking: (eventHandler: (view: EditorView, mouseEvent: Event, elementContentRects?: ElementContentRects) => boolean, elementContentRects?: ElementContentRects) => (view: EditorView, mouseEvent: Event) => boolean;