@atlaskit/editor-plugin-table 7.6.3 → 7.6.4

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 (45) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/cjs/commands/misc.js +3 -2
  3. package/dist/cjs/nodeviews/TableContainer.js +32 -20
  4. package/dist/cjs/nodeviews/TableResizer.js +39 -27
  5. package/dist/cjs/plugin.js +2 -1
  6. package/dist/cjs/toolbar.js +5 -4
  7. package/dist/cjs/ui/FloatingContextualMenu/ContextualMenu.js +16 -16
  8. package/dist/cjs/ui/FloatingDragMenu/DragMenu.js +3 -3
  9. package/dist/cjs/ui/FloatingDragMenu/DropdownMenu.js +21 -28
  10. package/dist/cjs/utils/guidelines.js +1 -1
  11. package/dist/es2019/commands/misc.js +6 -2
  12. package/dist/es2019/nodeviews/TableContainer.js +17 -3
  13. package/dist/es2019/nodeviews/TableResizer.js +26 -16
  14. package/dist/es2019/plugin.js +2 -1
  15. package/dist/es2019/toolbar.js +5 -4
  16. package/dist/es2019/ui/FloatingContextualMenu/ContextualMenu.js +16 -16
  17. package/dist/es2019/ui/FloatingDragMenu/DragMenu.js +3 -3
  18. package/dist/es2019/ui/FloatingDragMenu/DropdownMenu.js +20 -27
  19. package/dist/es2019/utils/guidelines.js +1 -1
  20. package/dist/esm/commands/misc.js +3 -2
  21. package/dist/esm/nodeviews/TableContainer.js +32 -20
  22. package/dist/esm/nodeviews/TableResizer.js +40 -28
  23. package/dist/esm/plugin.js +2 -1
  24. package/dist/esm/toolbar.js +5 -4
  25. package/dist/esm/ui/FloatingContextualMenu/ContextualMenu.js +16 -16
  26. package/dist/esm/ui/FloatingDragMenu/DragMenu.js +3 -3
  27. package/dist/esm/ui/FloatingDragMenu/DropdownMenu.js +21 -28
  28. package/dist/esm/utils/guidelines.js +1 -1
  29. package/dist/types/commands/misc.d.ts +2 -1
  30. package/dist/types/nodeviews/TableResizer.d.ts +3 -1
  31. package/dist/types/types.d.ts +6 -3
  32. package/dist/types-ts4.5/commands/misc.d.ts +2 -1
  33. package/dist/types-ts4.5/nodeviews/TableResizer.d.ts +3 -1
  34. package/dist/types-ts4.5/types.d.ts +6 -3
  35. package/package.json +2 -5
  36. package/src/commands/misc.ts +6 -3
  37. package/src/nodeviews/TableContainer.tsx +18 -3
  38. package/src/nodeviews/TableResizer.tsx +34 -20
  39. package/src/plugin.tsx +1 -0
  40. package/src/toolbar.tsx +20 -19
  41. package/src/types.ts +6 -2
  42. package/src/ui/FloatingContextualMenu/ContextualMenu.tsx +66 -112
  43. package/src/ui/FloatingDragMenu/DragMenu.tsx +3 -12
  44. package/src/ui/FloatingDragMenu/DropdownMenu.tsx +19 -28
  45. package/src/utils/guidelines.ts +5 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @atlaskit/editor-plugin-table
2
2
 
3
+ ## 7.6.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [#84595](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/84595) [`412b82018310`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/412b82018310) - ED-22555: Added isFullWidth to GuidelineConfig and use it as a signal
8
+ - Updated dependencies
9
+
3
10
  ## 7.6.3
4
11
 
5
12
  ### Patch Changes
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.updateWidthToWidest = exports.updateResizeHandleDecorations = exports.triggerUnlessTableHeader = exports.transformSliceToRemoveColumnsWidths = exports.transformSliceToAddTableHeaders = exports.transformSliceRemoveCellBackgroundColor = exports.showInsertRowButton = exports.showInsertColumnButton = exports.setTableRef = exports.setMultipleCellAttrs = exports.setEditorFocus = exports.setCellAttr = exports.selectRows = exports.selectRow = exports.selectColumns = exports.selectColumn = exports.removeResizeHandleDecorations = exports.moveCursorBackward = exports.isInsideFirstCellOfRowOrColumn = exports.hideInsertColumnOrRowButton = exports.getTableSelectionType = exports.getTableElementMoveTypeBySlice = exports.deleteTableIfSelected = exports.deleteTable = exports.countCellsInSlice = exports.convertFirstRowToHeader = exports.autoSizeTable = exports.addResizeHandleDecorations = exports.addBoldInEmptyHeaderCells = void 0;
8
8
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
9
9
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
+ var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
10
11
  var _utils = require("@atlaskit/editor-common/utils");
11
12
  var _state = require("@atlaskit/editor-prosemirror/state");
12
13
  var _cellSelection = require("@atlaskit/editor-tables/cell-selection");
@@ -566,13 +567,13 @@ var updateWidthToWidest = exports.updateWidthToWidest = function updateWidthToWi
566
567
  return (0, _pluginFactory.createCommand)(function (state) {
567
568
  var _getPluginState4 = (0, _pluginFactory.getPluginState)(state),
568
569
  prevWidthToWidest = _getPluginState4.widthToWidest;
569
- if (prevWidthToWidest === widthToWidest) {
570
+ if ((0, _isEqual.default)(widthToWidest, prevWidthToWidest)) {
570
571
  return false;
571
572
  }
572
573
  return {
573
574
  type: 'UPDATE_TABLE_WIDTH_TO_WIDEST',
574
575
  data: {
575
- widthToWidest: widthToWidest
576
+ widthToWidest: _objectSpread(_objectSpread({}, prevWidthToWidest), widthToWidest)
576
577
  }
577
578
  };
578
579
  });
@@ -10,6 +10,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
10
10
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
11
11
  var _react = _interopRequireWildcard(require("react"));
12
12
  var _classnames = _interopRequireDefault(require("classnames"));
13
+ var _hooks = require("@atlaskit/editor-common/hooks");
13
14
  var _nodeWidth = require("@atlaskit/editor-common/node-width");
14
15
  var _styles = require("@atlaskit/editor-common/styles");
15
16
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
@@ -42,10 +43,11 @@ var InnerContainer = exports.InnerContainer = /*#__PURE__*/(0, _react.forwardRef
42
43
  className: className,
43
44
  "data-number-column": node.attrs.isNumberColumnEnabled,
44
45
  "data-layout": node.attrs.layout,
45
- "data-test-id": "table-container"
46
+ "data-testid": "table-container"
46
47
  }, children);
47
48
  });
48
49
  var ResizableTableContainer = exports.ResizableTableContainer = /*#__PURE__*/_react.default.memo(function (_ref2) {
50
+ var _node$attrs$localId, _node$attrs;
49
51
  var children = _ref2.children,
50
52
  className = _ref2.className,
51
53
  node = _ref2.node,
@@ -117,9 +119,18 @@ var ResizableTableContainer = exports.ResizableTableContainer = /*#__PURE__*/_re
117
119
  return (_pluginInjectionApi$c = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c2 = pluginInjectionApi.core) === null || _pluginInjectionApi$c2 === void 0 ? void 0 : _pluginInjectionApi$c2.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$s = pluginInjectionApi.selection) === null || _pluginInjectionApi$s === void 0 ? void 0 : _pluginInjectionApi$s.commands.displayGapCursor(toggle))) !== null && _pluginInjectionApi$c !== void 0 ? _pluginInjectionApi$c : false;
118
120
  }, [pluginInjectionApi]);
119
121
  var tableWidth = (0, _nodeWidth.getTableContainerWidth)(node);
122
+ var _useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['table']),
123
+ tableState = _useSharedPluginState.tableState;
124
+ var _ref3 = tableState,
125
+ widthToWidest = _ref3.widthToWidest;
126
+ var currentTableNodeLocalId = (_node$attrs$localId = node === null || node === void 0 || (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.localId) !== null && _node$attrs$localId !== void 0 ? _node$attrs$localId : '';
127
+
120
128
  // 76 is currently an accepted padding value considering the spacing for resizer handle
121
129
  var responsiveContainerWidth = isTableScalingEnabled ? containerWidth - _editorSharedStyles.akEditorGutterPadding * 2 - _editorSharedStyles.akEditorMediaResizeHandlerPaddingWide / 2 : containerWidth - _editorSharedStyles.akEditorGutterPadding * 2 - _editorSharedStyles.akEditorMediaResizeHandlerPaddingWide;
122
130
  var width = Math.min(tableWidth, responsiveContainerWidth);
131
+ if (isTableScalingEnabled && currentTableNodeLocalId && widthToWidest && widthToWidest[currentTableNodeLocalId]) {
132
+ width = _utils.TABLE_MAX_WIDTH;
133
+ }
123
134
  if (!isResizing) {
124
135
  tableWidthRef.current = width;
125
136
  }
@@ -137,7 +148,8 @@ var ResizableTableContainer = exports.ResizableTableContainer = /*#__PURE__*/_re
137
148
  attachAnalyticsEvent: attachAnalyticsEvent,
138
149
  displayGapCursor: displayGapCursor,
139
150
  isTableScalingEnabled: isTableScalingEnabled,
140
- isWholeTableInDanger: isWholeTableInDanger
151
+ isWholeTableInDanger: isWholeTableInDanger,
152
+ pluginInjectionApi: pluginInjectionApi
141
153
  };
142
154
  if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.resizing-table-height-improvement')) {
143
155
  tableResizerProps = _objectSpread(_objectSpread({}, tableResizerProps), {}, {
@@ -162,24 +174,24 @@ var ResizableTableContainer = exports.ResizableTableContainer = /*#__PURE__*/_re
162
174
  node: node
163
175
  }, children))));
164
176
  });
165
- var TableContainer = exports.TableContainer = function TableContainer(_ref3) {
166
- var children = _ref3.children,
167
- node = _ref3.node,
168
- className = _ref3.className,
169
- _ref3$containerWidth = _ref3.containerWidth,
170
- lineLength = _ref3$containerWidth.lineLength,
171
- editorWidth = _ref3$containerWidth.width,
172
- isTableResizingEnabled = _ref3.isTableResizingEnabled,
173
- isBreakoutEnabled = _ref3.isBreakoutEnabled,
174
- editorView = _ref3.editorView,
175
- getPos = _ref3.getPos,
176
- tableRef = _ref3.tableRef,
177
- isNested = _ref3.isNested,
178
- tableWrapperHeight = _ref3.tableWrapperHeight,
179
- isResizing = _ref3.isResizing,
180
- pluginInjectionApi = _ref3.pluginInjectionApi,
181
- isTableScalingEnabled = _ref3.isTableScalingEnabled,
182
- isWholeTableInDanger = _ref3.isWholeTableInDanger;
177
+ var TableContainer = exports.TableContainer = function TableContainer(_ref4) {
178
+ var children = _ref4.children,
179
+ node = _ref4.node,
180
+ className = _ref4.className,
181
+ _ref4$containerWidth = _ref4.containerWidth,
182
+ lineLength = _ref4$containerWidth.lineLength,
183
+ editorWidth = _ref4$containerWidth.width,
184
+ isTableResizingEnabled = _ref4.isTableResizingEnabled,
185
+ isBreakoutEnabled = _ref4.isBreakoutEnabled,
186
+ editorView = _ref4.editorView,
187
+ getPos = _ref4.getPos,
188
+ tableRef = _ref4.tableRef,
189
+ isNested = _ref4.isNested,
190
+ tableWrapperHeight = _ref4.tableWrapperHeight,
191
+ isResizing = _ref4.isResizing,
192
+ pluginInjectionApi = _ref4.pluginInjectionApi,
193
+ isTableScalingEnabled = _ref4.isTableScalingEnabled,
194
+ isWholeTableInDanger = _ref4.isWholeTableInDanger;
183
195
  if (isTableResizingEnabled && !isNested) {
184
196
  return /*#__PURE__*/_react.default.createElement(ResizableTableContainer, {
185
197
  className: className,
@@ -14,15 +14,14 @@ var _rafSchd = _interopRequireDefault(require("raf-schd"));
14
14
  var _reactIntlNext = require("react-intl-next");
15
15
  var _analytics = require("@atlaskit/editor-common/analytics");
16
16
  var _guideline = require("@atlaskit/editor-common/guideline");
17
+ var _hooks = require("@atlaskit/editor-common/hooks");
17
18
  var _keymaps = require("@atlaskit/editor-common/keymaps");
18
19
  var _messages = require("@atlaskit/editor-common/messages");
19
20
  var _resizer = require("@atlaskit/editor-common/resizer");
20
21
  var _utils = require("@atlaskit/editor-common/utils");
21
- var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
22
22
  var _utils2 = require("@atlaskit/editor-tables/utils");
23
23
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
24
24
  var _misc = require("../commands/misc");
25
- var _pluginFactory = require("../pm-plugins/plugin-factory");
26
25
  var _tableAnalytics = require("../pm-plugins/table-analytics");
27
26
  var _utils3 = require("../pm-plugins/table-resizing/utils");
28
27
  var _tableWidth = require("../pm-plugins/table-width");
@@ -101,28 +100,37 @@ var TableResizer = exports.TableResizer = function TableResizer(_ref) {
101
100
  attachAnalyticsEvent = _ref.attachAnalyticsEvent,
102
101
  displayGapCursor = _ref.displayGapCursor,
103
102
  isTableScalingEnabled = _ref.isTableScalingEnabled,
104
- isWholeTableInDanger = _ref.isWholeTableInDanger;
103
+ isWholeTableInDanger = _ref.isWholeTableInDanger,
104
+ pluginInjectionApi = _ref.pluginInjectionApi;
105
105
  var currentGap = (0, _react.useRef)(0);
106
106
  // track resizing state - use ref over state to avoid re-render
107
107
  var isResizing = (0, _react.useRef)(false);
108
108
  var areResizeMetaKeysPressed = (0, _react.useRef)(false);
109
+ var _useState = (0, _react.useState)(width),
110
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
111
+ localTableWidth = _useState2[0],
112
+ setLocalTableWidth = _useState2[1];
109
113
  var resizerRef = (0, _react.useRef)(null);
114
+ var _useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['table']),
115
+ tableState = _useSharedPluginState.tableState;
116
+ var _ref2 = tableState,
117
+ widthToWidest = _ref2.widthToWidest;
110
118
 
111
119
  // used to reposition tooltip when table is resizing via keyboard
112
120
  var updateTooltip = _react.default.useRef();
113
- var _useState = (0, _react.useState)(false),
114
- _useState2 = (0, _slicedToArray2.default)(_useState, 2),
115
- snappingEnabled = _useState2[0],
116
- setSnappingEnabled = _useState2[1];
121
+ var _useState3 = (0, _react.useState)(false),
122
+ _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
123
+ snappingEnabled = _useState4[0],
124
+ setSnappingEnabled = _useState4[1];
117
125
 
118
126
  // we don't want to update aria-live region on each width change, it might provide bad experience for screen reader users
119
- var _useState3 = (0, _react.useState)({
127
+ var _useState5 = (0, _react.useState)({
120
128
  type: 'none',
121
129
  width: width
122
130
  }),
123
- _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
124
- screenReaderResizeInformation = _useState4[0],
125
- setScreenReaderResizeInformation = _useState4[1];
131
+ _useState6 = (0, _slicedToArray2.default)(_useState5, 2),
132
+ screenReaderResizeInformation = _useState6[0],
133
+ setScreenReaderResizeInformation = _useState6[1];
126
134
  var _useIntl = (0, _reactIntlNext.useIntl)(),
127
135
  formatMessage = _useIntl.formatMessage;
128
136
  var screenReaderResizeAnnouncerMessages = {
@@ -141,9 +149,9 @@ var TableResizer = exports.TableResizer = function TableResizer(_ref) {
141
149
  startMeasure = _useMeasureFramerate.startMeasure,
142
150
  endMeasure = _useMeasureFramerate.endMeasure,
143
151
  countFrames = _useMeasureFramerate.countFrames;
144
- var updateActiveGuidelines = (0, _react.useCallback)(function (_ref2) {
145
- var gap = _ref2.gap,
146
- keys = _ref2.keys;
152
+ var updateActiveGuidelines = (0, _react.useCallback)(function (_ref3) {
153
+ var gap = _ref3.gap,
154
+ keys = _ref3.keys;
147
155
  if (gap !== currentGap.current) {
148
156
  currentGap.current = gap;
149
157
  var visibleGuidelines = getVisibleGuidelines(isTableScalingEnabled ? (0, _guidelines.defaultGuidelinesForPreserveTable)(containerWidth) : _guidelines.defaultGuidelines, containerWidth);
@@ -191,7 +199,7 @@ var TableResizer = exports.TableResizer = function TableResizer(_ref) {
191
199
  }
192
200
  }, [startMeasure, editorView, displayGapCursor, isTableScalingEnabled, containerWidth, displayGuideline, onResizeStart]);
193
201
  var handleResize = (0, _react.useCallback)(function (originalState, delta) {
194
- var _defaultGuidelinesFor;
202
+ var _node$attrs$localId, _node$attrs, _widestGuideline$posi;
195
203
  countFrames();
196
204
  var newWidth = originalState.width + delta.width;
197
205
  var pos;
@@ -216,25 +224,29 @@ var TableResizer = exports.TableResizer = function TableResizer(_ref) {
216
224
  // set the width of the table to 1800 pixels.
217
225
  var state = editorView.state,
218
226
  dispatch = editorView.dispatch;
219
- var widestGuideLineWidthString = (_defaultGuidelinesFor = (0, _guidelines.defaultGuidelinesForPreserveTable)(containerWidth)[16].key) === null || _defaultGuidelinesFor === void 0 || (_defaultGuidelinesFor = _defaultGuidelinesFor.match(/[\d]*[.]{0,1}[\d]+/g)) === null || _defaultGuidelinesFor === void 0 ? void 0 : _defaultGuidelinesFor.join('');
220
- var widestGuideLineWidth = parseInt(widestGuideLineWidthString || '', 10);
221
- var shouldUpdateWidthToWidest = !!(isTableScalingEnabled && (0, _guidelines.defaultGuidelinesForPreserveTable)(containerWidth).length === 17 && widestGuideLineWidth - newWidth <= 1);
222
- (0, _misc.updateWidthToWidest)(shouldUpdateWidthToWidest)(state, dispatch);
223
- updateWidth(shouldUpdateWidthToWidest ? _editorSharedStyles.akEditorFullWidthLayoutWidth : newWidth);
227
+ var currentTableNodeLocalId = (_node$attrs$localId = node === null || node === void 0 || (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.localId) !== null && _node$attrs$localId !== void 0 ? _node$attrs$localId : '';
228
+ var widestGuideline = (0, _guidelines.defaultGuidelinesForPreserveTable)(containerWidth).filter(function (guideline) {
229
+ return guideline.isFullWidth;
230
+ })[0];
231
+ var widestGuideLineWidth = widestGuideline ? (((_widestGuideline$posi = widestGuideline.position) === null || _widestGuideline$posi === void 0 ? void 0 : _widestGuideline$posi.x) || 0) * 2 : null;
232
+ var shouldUpdateWidthToWidest = !!(isTableScalingEnabled && widestGuideLineWidth && Math.abs(widestGuideLineWidth - newWidth) <= 1);
233
+ shouldUpdateWidthToWidest ? setLocalTableWidth(_utils3.TABLE_MAX_WIDTH) : setLocalTableWidth(newWidth);
234
+ (0, _misc.updateWidthToWidest)((0, _defineProperty2.default)({}, currentTableNodeLocalId, shouldUpdateWidthToWidest))(state, dispatch);
235
+ updateWidth(shouldUpdateWidthToWidest ? _utils3.TABLE_MAX_WIDTH : newWidth);
224
236
  return newWidth;
225
237
  }, [countFrames, isTableScalingEnabled, tableRef, node, editorView, updateActiveGuidelines, containerWidth, updateWidth, getPos]);
226
238
  var scheduleResize = (0, _react.useMemo)(function () {
227
239
  return (0, _rafSchd.default)(handleResize);
228
240
  }, [handleResize]);
229
241
  var handleResizeStop = (0, _react.useCallback)(function (originalState, delta) {
242
+ var _node$attrs$localId2, _node$attrs2;
230
243
  isResizing.current = false;
231
244
  var newWidth = originalState.width + delta.width;
232
245
  var state = editorView.state,
233
246
  dispatch = editorView.dispatch;
234
247
  var pos = getPos();
235
- var _getPluginState = (0, _pluginFactory.getPluginState)(editorView.state),
236
- widthToWidest = _getPluginState.widthToWidest;
237
- newWidth = widthToWidest ? _editorSharedStyles.akEditorFullWidthLayoutWidth : newWidth;
248
+ var currentTableNodeLocalId = (_node$attrs$localId2 = node === null || node === void 0 || (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.localId) !== null && _node$attrs$localId2 !== void 0 ? _node$attrs$localId2 : '';
249
+ newWidth = widthToWidest && currentTableNodeLocalId && widthToWidest[currentTableNodeLocalId] ? _utils3.TABLE_MAX_WIDTH : newWidth;
238
250
  var tr = state.tr.setMeta(_tableWidth.pluginKey, {
239
251
  resizing: false
240
252
  });
@@ -279,7 +291,7 @@ var TableResizer = exports.TableResizer = function TableResizer(_ref) {
279
291
  onResizeStop();
280
292
  }
281
293
  return newWidth;
282
- }, [displayGapCursor, updateWidth, editorView, getPos, node, tableRef, scheduleResize, displayGuideline, attachAnalyticsEvent, endMeasure, onResizeStop, isTableScalingEnabled]);
294
+ }, [displayGapCursor, updateWidth, editorView, getPos, node, tableRef, scheduleResize, displayGuideline, attachAnalyticsEvent, endMeasure, onResizeStop, isTableScalingEnabled, widthToWidest]);
283
295
  var handleTableSizeChangeOnKeypress = (0, _react.useCallback)(function (step) {
284
296
  var newWidth = width + step;
285
297
  if (newWidth > maxWidth || newWidth < resizerMinWidth) {
@@ -384,7 +396,7 @@ var TableResizer = exports.TableResizer = function TableResizer(_ref) {
384
396
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_resizer.ResizerNext, {
385
397
  ref: resizerRef,
386
398
  enable: handles,
387
- width: width,
399
+ width: localTableWidth,
388
400
  handleAlignmentMethod: "sticky",
389
401
  handleSize: handleSize,
390
402
  handleStyles: handleStyles,
@@ -401,8 +413,8 @@ var TableResizer = exports.TableResizer = function TableResizer(_ref) {
401
413
  needExtendedResizeZone: !isTableSelected,
402
414
  appearance: isTableSelected && isWholeTableInDanger ? 'danger' : undefined,
403
415
  handleHighlight: "shadow",
404
- handleTooltipContent: (0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-table-resizing_uapcv') ? function (_ref3) {
405
- var update = _ref3.update;
416
+ handleTooltipContent: (0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-table-resizing_uapcv') ? function (_ref4) {
417
+ var update = _ref4.update;
406
418
  updateTooltip.current = update;
407
419
  return /*#__PURE__*/_react.default.createElement(_keymaps.ToolTipContent, {
408
420
  description: formatMessage(_messages.tableMessages.resizeTable),
@@ -92,7 +92,8 @@ var tablesPlugin = function tablesPlugin(_ref) {
92
92
  isWholeTableInDanger: tablePluginState.isWholeTableInDanger,
93
93
  // IMPORTANT: Need to continue to pass tableNode to control re-renders
94
94
  // TableComponent listens for node attribute changes to update colgroups
95
- tableNode: tablePluginState.tableNode
95
+ tableNode: tablePluginState.tableNode,
96
+ widthToWidest: tablePluginState.widthToWidest
96
97
  };
97
98
  },
98
99
  actions: {
@@ -22,7 +22,6 @@ var _utils3 = require("@atlaskit/editor-tables/utils");
22
22
  var _layoutThreeEqual = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/layout-three-equal"));
23
23
  var _remove = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/remove"));
24
24
  var _preferences = _interopRequireDefault(require("@atlaskit/icon/glyph/preferences"));
25
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
26
25
  var _commands = require("./commands");
27
26
  var _commandsWithAnalytics = require("./commands-with-analytics");
28
27
  var _pluginFactory = require("./pm-plugins/plugin-factory");
@@ -65,7 +64,7 @@ var getToolbarMenuConfig = exports.getToolbarMenuConfig = function getToolbarMen
65
64
  disabled: !state.canCollapseTable,
66
65
  hidden: !config.allowCollapse
67
66
  }];
68
- if (state.isDragAndDropEnabled && (0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.new-cell-context-menu-styling')) {
67
+ if (state.isDragAndDropEnabled) {
69
68
  return {
70
69
  id: 'editor.table.tableOptions',
71
70
  type: 'dropdown',
@@ -301,6 +300,7 @@ var getClosestSelectionOrTableRect = exports.getClosestSelectionOrTableRect = fu
301
300
  var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(getEditorContainerWidth, editorAnalyticsAPI, getEditorFeatureFlags, getEditorView) {
302
301
  return function (config) {
303
302
  return function (state, intl) {
303
+ var _tableObject$node$att, _tableObject$node;
304
304
  var tableObject = (0, _utils3.findTable)(state.selection);
305
305
  var pluginState = (0, _pluginFactory.getPluginState)(state);
306
306
  var resizeState = _tableResizing.pluginKey.getState(state);
@@ -310,7 +310,8 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(getE
310
310
  var isWidthResizing = tableWidthState === null || tableWidthState === void 0 ? void 0 : tableWidthState.resizing;
311
311
  var isTableScalingEnabled = pluginState.isTableScalingEnabled,
312
312
  widthToWidest = pluginState.widthToWidest;
313
- if (isTableScalingEnabled && isWidthResizing && widthToWidest) {
313
+ var currentTableNodeLocalId = (_tableObject$node$att = tableObject === null || tableObject === void 0 || (_tableObject$node = tableObject.node) === null || _tableObject$node === void 0 || (_tableObject$node = _tableObject$node.attrs) === null || _tableObject$node === void 0 ? void 0 : _tableObject$node.localId) !== null && _tableObject$node$att !== void 0 ? _tableObject$node$att : '';
314
+ if (isTableScalingEnabled && isWidthResizing && widthToWidest && currentTableNodeLocalId && widthToWidest[currentTableNodeLocalId]) {
314
315
  var _getEditorFeatureFlag = getEditorFeatureFlags(),
315
316
  stickyScrollbar = _getEditorFeatureFlag.stickyScrollbar;
316
317
  var nodeType = state.schema.nodes.table;
@@ -362,7 +363,7 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(getE
362
363
  var cellItems;
363
364
  cellItems = pluginState.isDragAndDropEnabled ? [] : getCellItems(state, getEditorView(), intl, getEditorContainerWidth, editorAnalyticsAPI, _isTableScalingEnabled);
364
365
  var columnSettingsItems;
365
- columnSettingsItems = pluginState.isDragAndDropEnabled && (0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.new-cell-context-menu-styling') ? getColumnSettingItems(state, getEditorView(), intl, getEditorContainerWidth, editorAnalyticsAPI, _isTableScalingEnabled) : [];
366
+ columnSettingsItems = pluginState.isDragAndDropEnabled ? getColumnSettingItems(state, getEditorView(), intl, getEditorContainerWidth, editorAnalyticsAPI, _isTableScalingEnabled) : [];
366
367
  var colorPicker = getColorPicker(state, menu, intl, editorAnalyticsAPI);
367
368
 
368
369
  // Check if we need to show confirm dialog for delete button
@@ -85,11 +85,11 @@ var ContextualMenu = exports.ContextualMenu = /*#__PURE__*/function (_Component)
85
85
  var node = isOpen && targetCellPosition ? state.doc.nodeAt(targetCellPosition) : null;
86
86
  var background = (0, _editorPalette.hexToEditorBackgroundPaletteColor)((node === null || node === void 0 || (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.background) || '#ffffff');
87
87
  return {
88
- content: isDragAndDropEnabled && (0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.new-cell-context-menu-styling') ? formatMessage(_messages.tableMessages.backgroundColor) : formatMessage(_messages.tableMessages.cellBackground),
88
+ content: isDragAndDropEnabled ? formatMessage(_messages.tableMessages.backgroundColor) : formatMessage(_messages.tableMessages.cellBackground),
89
89
  value: {
90
90
  name: 'background'
91
91
  },
92
- elemBefore: isDragAndDropEnabled && (0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.new-cell-context-menu-styling') ? (0, _react2.jsx)("span", {
92
+ elemBefore: isDragAndDropEnabled ? (0, _react2.jsx)("span", {
93
93
  css: _styles2.elementBeforeIconStyles
94
94
  }, (0, _react2.jsx)(_backgroundColor.default, {
95
95
  label: formatMessage(_messages.tableMessages.backgroundColor),
@@ -99,7 +99,7 @@ var ContextualMenu = exports.ContextualMenu = /*#__PURE__*/function (_Component)
99
99
  className: _styles.DropdownMenuSharedCssClassName.SUBMENU
100
100
  }, (0, _react2.jsx)("div", {
101
101
  css: (0, _styles2.cellColourPreviewStyles)(background),
102
- className: isDragAndDropEnabled && (0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.new-cell-context-menu-styling') ? _types.TableCssClassName.CONTEXTUAL_MENU_ICON_SMALL : _types.TableCssClassName.CONTEXTUAL_MENU_ICON
102
+ className: isDragAndDropEnabled ? _types.TableCssClassName.CONTEXTUAL_MENU_ICON_SMALL : _types.TableCssClassName.CONTEXTUAL_MENU_ICON
103
103
  }), isSubmenuOpen && (0, _react2.jsx)("div", {
104
104
  className: _types.TableCssClassName.CONTEXTUAL_SUBMENU,
105
105
  ref: _this.handleSubMenuRef
@@ -131,7 +131,7 @@ var ContextualMenu = exports.ContextualMenu = /*#__PURE__*/function (_Component)
131
131
  name: 'merge'
132
132
  },
133
133
  isDisabled: !(0, _transforms.canMergeCells)(state.tr),
134
- elemBefore: isDragAndDropEnabled && (0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.new-cell-context-menu-styling') ? (0, _react2.jsx)("span", {
134
+ elemBefore: isDragAndDropEnabled ? (0, _react2.jsx)("span", {
135
135
  css: _styles2.elementBeforeIconStyles
136
136
  }, (0, _react2.jsx)(_icons.MergeCellsIcon, null)) : undefined
137
137
  }, {
@@ -140,7 +140,7 @@ var ContextualMenu = exports.ContextualMenu = /*#__PURE__*/function (_Component)
140
140
  name: 'split'
141
141
  },
142
142
  isDisabled: !(0, _utils2.splitCell)(state),
143
- elemBefore: isDragAndDropEnabled && (0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.new-cell-context-menu-styling') ? (0, _react2.jsx)("span", {
143
+ elemBefore: isDragAndDropEnabled ? (0, _react2.jsx)("span", {
144
144
  css: _styles2.elementBeforeIconStyles
145
145
  }, (0, _react2.jsx)(_icons.SplitCellIcon, null)) : undefined
146
146
  }];
@@ -154,14 +154,14 @@ var ContextualMenu = exports.ContextualMenu = /*#__PURE__*/function (_Component)
154
154
  var _getPluginState3 = (0, _pluginFactory.getPluginState)(editorView.state),
155
155
  isDragAndDropEnabled = _getPluginState3.isDragAndDropEnabled;
156
156
  return {
157
- content: formatMessage(isDragAndDropEnabled && (0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.new-cell-context-menu-styling') ? _messages.tableMessages.addColumnRight : _messages.tableMessages.insertColumn),
157
+ content: formatMessage(isDragAndDropEnabled ? _messages.tableMessages.addColumnRight : _messages.tableMessages.insertColumn),
158
158
  value: {
159
159
  name: 'insert_column'
160
160
  },
161
161
  elemAfter: (0, _react2.jsx)("div", {
162
162
  css: _shortcut.shortcutStyle
163
163
  }, (0, _keymaps.tooltip)(_keymaps.addColumnAfter)),
164
- elemBefore: isDragAndDropEnabled && (0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.new-cell-context-menu-styling') ? (0, _react2.jsx)("span", {
164
+ elemBefore: isDragAndDropEnabled ? (0, _react2.jsx)("span", {
165
165
  css: _styles2.elementBeforeIconStyles
166
166
  }, (0, _react2.jsx)(_icons.AddColRightIcon, null)) : undefined
167
167
  };
@@ -173,14 +173,14 @@ var ContextualMenu = exports.ContextualMenu = /*#__PURE__*/function (_Component)
173
173
  var _getPluginState4 = (0, _pluginFactory.getPluginState)(editorView.state),
174
174
  isDragAndDropEnabled = _getPluginState4.isDragAndDropEnabled;
175
175
  return {
176
- content: formatMessage(isDragAndDropEnabled && (0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.new-cell-context-menu-styling') ? _messages.tableMessages.addRowBelow : _messages.tableMessages.insertRow),
176
+ content: formatMessage(isDragAndDropEnabled ? _messages.tableMessages.addRowBelow : _messages.tableMessages.insertRow),
177
177
  value: {
178
178
  name: 'insert_row'
179
179
  },
180
180
  elemAfter: (0, _react2.jsx)("div", {
181
181
  css: _shortcut.shortcutStyle
182
182
  }, (0, _keymaps.tooltip)(_keymaps.addRowAfter)),
183
- elemBefore: isDragAndDropEnabled && (0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.new-cell-context-menu-styling') ? (0, _react2.jsx)("span", {
183
+ elemBefore: isDragAndDropEnabled ? (0, _react2.jsx)("span", {
184
184
  css: _styles2.elementBeforeIconStyles
185
185
  }, (0, _react2.jsx)(_icons.AddRowBelowIcon, null)) : undefined
186
186
  };
@@ -208,7 +208,7 @@ var ContextualMenu = exports.ContextualMenu = /*#__PURE__*/function (_Component)
208
208
  elemAfter: (0, _react2.jsx)("div", {
209
209
  css: _shortcut.shortcutStyle
210
210
  }, (0, _keymaps.tooltip)(_keymaps.backspace)),
211
- elemBefore: isDragAndDropEnabled && (0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.new-cell-context-menu-styling') ? (0, _react2.jsx)("span", {
211
+ elemBefore: isDragAndDropEnabled ? (0, _react2.jsx)("span", {
212
212
  css: _styles2.elementBeforeIconStyles
213
213
  }, (0, _react2.jsx)(_crossCircle.default, {
214
214
  label: formatMessage(_messages.tableMessages.clearCells, {
@@ -234,7 +234,7 @@ var ContextualMenu = exports.ContextualMenu = /*#__PURE__*/function (_Component)
234
234
  value: {
235
235
  name: 'delete_column'
236
236
  },
237
- elemBefore: isDragAndDropEnabled && (0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.new-cell-context-menu-styling') ? (0, _react2.jsx)("span", {
237
+ elemBefore: isDragAndDropEnabled ? (0, _react2.jsx)("span", {
238
238
  css: _styles2.elementBeforeIconStyles
239
239
  }, (0, _react2.jsx)(_remove.default, {
240
240
  label: formatMessage(_messages.tableMessages.removeColumns, {
@@ -260,7 +260,7 @@ var ContextualMenu = exports.ContextualMenu = /*#__PURE__*/function (_Component)
260
260
  value: {
261
261
  name: 'delete_row'
262
262
  },
263
- elemBefore: isDragAndDropEnabled && (0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.new-cell-context-menu-styling') ? (0, _react2.jsx)("span", {
263
+ elemBefore: isDragAndDropEnabled ? (0, _react2.jsx)("span", {
264
264
  css: _styles2.elementBeforeIconStyles
265
265
  }, (0, _react2.jsx)(_remove.default, {
266
266
  label: formatMessage(_messages.tableMessages.removeRows, {
@@ -278,7 +278,7 @@ var ContextualMenu = exports.ContextualMenu = /*#__PURE__*/function (_Component)
278
278
  var _getPluginState8 = (0, _pluginFactory.getPluginState)(editorView.state),
279
279
  isDragAndDropEnabled = _getPluginState8.isDragAndDropEnabled,
280
280
  allowDistributeColumns = _getPluginState8.pluginConfig.allowDistributeColumns;
281
- if (allowDistributeColumns && (!isDragAndDropEnabled || !(0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.new-cell-context-menu-styling'))) {
281
+ if (allowDistributeColumns && !isDragAndDropEnabled) {
282
282
  var _newResizeState$chang;
283
283
  var _getPluginState9 = (0, _pluginFactory.getPluginState)(editorView.state),
284
284
  _getPluginState9$isTa = _getPluginState9.isTableScalingEnabled,
@@ -302,7 +302,7 @@ var ContextualMenu = exports.ContextualMenu = /*#__PURE__*/function (_Component)
302
302
  allowColumnSorting = _this$props9.allowColumnSorting;
303
303
  var _getPluginState10 = (0, _pluginFactory.getPluginState)(editorView.state),
304
304
  isDragAndDropEnabled = _getPluginState10.isDragAndDropEnabled;
305
- if (allowColumnSorting && (!isDragAndDropEnabled || !(0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.new-cell-context-menu-styling'))) {
305
+ if (allowColumnSorting && !isDragAndDropEnabled) {
306
306
  var hasMergedCellsInTable = (0, _utils3.getMergedCellsPositions)(editorView.state.tr).length > 0;
307
307
  var warning = hasMergedCellsInTable ? {
308
308
  tooltipDescription: formatMessage(_messages.tableMessages.canNotSortTable),
@@ -520,7 +520,7 @@ var ContextualMenu = exports.ContextualMenu = /*#__PURE__*/function (_Component)
520
520
  editorView = _this$props14.editorView;
521
521
  var _getPluginState14 = (0, _pluginFactory.getPluginState)(editorView.state),
522
522
  isDragAndDropEnabled = _getPluginState14.isDragAndDropEnabled;
523
- var items = isDragAndDropEnabled && (0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.new-cell-context-menu-styling') ? this.createNewContextMenuItems() : this.createOriginalContextMenuItems();
523
+ var items = isDragAndDropEnabled ? this.createNewContextMenuItems() : this.createOriginalContextMenuItems();
524
524
  return (0, _react2.jsx)("div", {
525
525
  "data-testid": "table-cell-contextual-menu",
526
526
  onMouseLeave: this.closeSubmenu
@@ -543,7 +543,7 @@ var ContextualMenu = exports.ContextualMenu = /*#__PURE__*/function (_Component)
543
543
  fitWidth: isDragAndDropEnabled ? _consts.contextualMenuDropdownWidthDnD : _consts.contextualMenuDropdownWidth,
544
544
  boundariesElement: boundariesElement,
545
545
  offset: offset,
546
- section: isDragAndDropEnabled && (0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.new-cell-context-menu-styling') && (0, _platformFeatureFlags.getBooleanFF)('platform.editor.menu.group-items') ? {
546
+ section: isDragAndDropEnabled && (0, _platformFeatureFlags.getBooleanFF)('platform.editor.menu.group-items') ? {
547
547
  hasSeparator: true
548
548
  } : undefined
549
549
  }));
@@ -448,20 +448,20 @@ var DragMenu = exports.DragMenu = /*#__PURE__*/_react.default.memo(function (_re
448
448
  if (!menuItems) {
449
449
  return null;
450
450
  }
451
- if (allowBackgroundColor && (0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.new-cell-context-menu-styling')) {
451
+ if (allowBackgroundColor) {
452
452
  menuItems[0].items.unshift(createBackgroundColorMenuItem());
453
453
  }
454
454
 
455
455
  // If first row, add toggle for Header row, default is true
456
456
  // If first column, add toggle for Header column, default is false
457
- if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.new-cell-context-menu-styling') && index === 0) {
457
+ if (index === 0) {
458
458
  menuItems.push({
459
459
  items: [createHeaderRowColumnMenuItem(direction)]
460
460
  });
461
461
  }
462
462
 
463
463
  // All rows, add toggle for numbered rows, default is false
464
- if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.new-cell-context-menu-styling') && direction === 'row') {
464
+ if (direction === 'row') {
465
465
  index === 0 ? menuItems[menuItems.length - 1].items.push(createRowNumbersMenuItem()) : menuItems.push({
466
466
  items: [createRowNumbersMenuItem()]
467
467
  });
@@ -13,7 +13,6 @@ var _uiMenu = require("@atlaskit/editor-common/ui-menu");
13
13
  var _uiReact = require("@atlaskit/editor-common/ui-react");
14
14
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
15
15
  var _menu = require("@atlaskit/menu");
16
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
17
16
  var _consts = require("../consts");
18
17
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
19
18
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
@@ -129,39 +128,33 @@ var DropdownMenu = exports.DropdownMenu = function DropdownMenu(_ref) {
129
128
  // The logic below normalises the index value based on the number
130
129
  // of menu items with 2 focusable elements, and adjusts the index to ensure
131
130
  // the correct menu item is sent in onItemActivated callback
132
- if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.new-cell-context-menu-styling')) {
133
- var keys = ['row_numbers', 'header_row', 'header_column'];
134
- var doubleItemCount = 0;
135
- var firstIndex = results.findIndex(function (value) {
136
- return keys.includes(value.key);
131
+ var keys = ['row_numbers', 'header_row', 'header_column'];
132
+ var doubleItemCount = 0;
133
+ var firstIndex = results.findIndex(function (value) {
134
+ return keys.includes(value.key);
135
+ });
136
+ if (firstIndex === -1 || index <= firstIndex) {
137
+ onItemActivated && onItemActivated({
138
+ item: results[index]
137
139
  });
138
- if (firstIndex === -1 || index <= firstIndex) {
140
+ return;
141
+ }
142
+ for (var i = firstIndex; i < results.length; i += 1) {
143
+ if (keys.includes(results[i].key)) {
144
+ doubleItemCount += 1;
145
+ }
146
+ if (firstIndex % 2 === 0 && index - doubleItemCount === i) {
139
147
  onItemActivated && onItemActivated({
140
- item: results[index]
148
+ item: results[i]
141
149
  });
142
150
  return;
143
151
  }
144
- for (var i = firstIndex; i < results.length; i += 1) {
145
- if (keys.includes(results[i].key)) {
146
- doubleItemCount += 1;
147
- }
148
- if (firstIndex % 2 === 0 && index - doubleItemCount === i) {
149
- onItemActivated && onItemActivated({
150
- item: results[i]
151
- });
152
- return;
153
- }
154
- if (firstIndex % 2 === 1 && index - doubleItemCount === i) {
155
- onItemActivated && onItemActivated({
156
- item: results[i]
157
- });
158
- return;
159
- }
152
+ if (firstIndex % 2 === 1 && index - doubleItemCount === i) {
153
+ onItemActivated && onItemActivated({
154
+ item: results[i]
155
+ });
156
+ return;
160
157
  }
161
- } else {
162
- onItemActivated && onItemActivated({
163
- item: results[index]
164
- });
165
158
  }
166
159
  }
167
160
  }, innerMenu())));
@@ -12,5 +12,5 @@ var _snapping = require("./snapping");
12
12
  // If we don't do this then the guidelines will not align correctly to the edge of the table
13
13
  var defaultGuidelines = exports.defaultGuidelines = (0, _guideline.createFixedGuidelinesFromLengths)([0].concat((0, _toConsumableArray2.default)((0, _snapping.calculateDefaultSnappings)(-1))));
14
14
  var defaultGuidelinesForPreserveTable = exports.defaultGuidelinesForPreserveTable = function defaultGuidelinesForPreserveTable(editorContainerWidth) {
15
- return (0, _guideline.createFixedGuidelinesFromLengths)([0].concat((0, _toConsumableArray2.default)((0, _snapping.calculateDefaultTablePreserveSnappings)(-1, editorContainerWidth))));
15
+ return (0, _guideline.createFixedGuidelinesFromLengths)([0].concat((0, _toConsumableArray2.default)((0, _snapping.calculateDefaultTablePreserveSnappings)(-1, editorContainerWidth))), undefined, true);
16
16
  };
@@ -1,3 +1,4 @@
1
+ import isEqual from 'lodash/isEqual';
1
2
  import { closestElement, isParagraph, isTextSelection, mapSlice } from '@atlaskit/editor-common/utils';
2
3
  import { TextSelection } from '@atlaskit/editor-prosemirror/state';
3
4
  import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
@@ -527,13 +528,16 @@ export const updateWidthToWidest = widthToWidest => createCommand(state => {
527
528
  let {
528
529
  widthToWidest: prevWidthToWidest
529
530
  } = getPluginState(state);
530
- if (prevWidthToWidest === widthToWidest) {
531
+ if (isEqual(widthToWidest, prevWidthToWidest)) {
531
532
  return false;
532
533
  }
533
534
  return {
534
535
  type: 'UPDATE_TABLE_WIDTH_TO_WIDEST',
535
536
  data: {
536
- widthToWidest
537
+ widthToWidest: {
538
+ ...prevWidthToWidest,
539
+ ...widthToWidest
540
+ }
537
541
  }
538
542
  };
539
543
  });