@atlaskit/editor-plugin-table 1.1.2 → 1.1.3

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 (51) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/plugins/table/nodeviews/TableComponent.js +13 -3
  3. package/dist/cjs/plugins/table/pm-plugins/table-resizing/commands.js +7 -2
  4. package/dist/cjs/plugins/table/pm-plugins/table-resizing/event-handlers.js +5 -1
  5. package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/colgroup.js +17 -1
  6. package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/misc.js +38 -6
  7. package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/resize-logic.js +2 -2
  8. package/dist/cjs/plugins/table/transforms/column-width.js +47 -5
  9. package/dist/cjs/plugins/table/ui/common-styles.js +4 -3
  10. package/dist/cjs/version.json +1 -1
  11. package/dist/es2019/plugins/table/nodeviews/TableComponent.js +13 -3
  12. package/dist/es2019/plugins/table/pm-plugins/table-resizing/commands.js +7 -2
  13. package/dist/es2019/plugins/table/pm-plugins/table-resizing/event-handlers.js +5 -1
  14. package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/colgroup.js +15 -0
  15. package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/misc.js +37 -4
  16. package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/resize-logic.js +2 -2
  17. package/dist/es2019/plugins/table/transforms/column-width.js +45 -5
  18. package/dist/es2019/plugins/table/ui/common-styles.js +5 -2
  19. package/dist/es2019/version.json +1 -1
  20. package/dist/esm/plugins/table/nodeviews/TableComponent.js +13 -3
  21. package/dist/esm/plugins/table/pm-plugins/table-resizing/commands.js +7 -2
  22. package/dist/esm/plugins/table/pm-plugins/table-resizing/event-handlers.js +5 -1
  23. package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/colgroup.js +15 -0
  24. package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/misc.js +35 -4
  25. package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/resize-logic.js +2 -2
  26. package/dist/esm/plugins/table/transforms/column-width.js +47 -5
  27. package/dist/esm/plugins/table/ui/common-styles.js +3 -3
  28. package/dist/esm/version.json +1 -1
  29. package/dist/types/plugins/table/pm-plugins/table-resizing/utils/colgroup.d.ts +7 -0
  30. package/dist/types/plugins/table/pm-plugins/table-resizing/utils/misc.d.ts +2 -1
  31. package/dist/types/plugins/table/ui/common-styles.d.ts +1 -0
  32. package/package.json +8 -6
  33. package/src/__tests__/integration/__fixtures__/empty-layout.ts +35 -0
  34. package/src/__tests__/integration/__fixtures__/nested-in-expand.ts +129 -0
  35. package/src/__tests__/integration/horizontal-scroll.ts +489 -0
  36. package/src/__tests__/unit/commands/insert.ts +3 -3
  37. package/src/__tests__/unit/keymap.ts +3 -1
  38. package/src/__tests__/unit/pm-plugins/table-resizing/colgroup.ts +38 -0
  39. package/src/__tests__/unit/pm-plugins/table-resizing/event-handlers.ts +5 -2
  40. package/src/__tests__/visual-regression/__image_snapshots__/cell-options-menu-ts-table-cell-options-menu-delete-column-menu-item-visual-hints-should-be-added-to-the-table-column-on-hover-1-snap.png +2 -2
  41. package/src/__tests__/visual-regression/__image_snapshots__/cell-options-menu-ts-table-cell-options-menu-delete-row-menu-item-visual-hints-should-be-added-to-the-table-row-on-hover-1-snap.png +2 -2
  42. package/src/__tests__/visual-regression/__image_snapshots__/sticky-header-ts-snapshot-test-table-sticky-header-should-align-with-table-cell-when-active-2-snap.png +2 -2
  43. package/src/__tests__/visual-regression/sticky-header.ts +2 -1
  44. package/src/plugins/table/nodeviews/TableComponent.tsx +16 -3
  45. package/src/plugins/table/pm-plugins/table-resizing/commands.ts +6 -2
  46. package/src/plugins/table/pm-plugins/table-resizing/event-handlers.ts +9 -1
  47. package/src/plugins/table/pm-plugins/table-resizing/utils/colgroup.ts +19 -1
  48. package/src/plugins/table/pm-plugins/table-resizing/utils/misc.ts +57 -5
  49. package/src/plugins/table/pm-plugins/table-resizing/utils/resize-logic.ts +2 -2
  50. package/src/plugins/table/transforms/column-width.ts +60 -6
  51. package/src/plugins/table/ui/common-styles.ts +5 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/editor-plugin-table
2
2
 
3
+ ## 1.1.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [`2fe7d1a47ab`](https://bitbucket.org/atlassian/atlassian-frontend/commits/2fe7d1a47ab) - [ux] ED-16512: Table should not scroll on large screens after column resizing
8
+ - [`20f8e0400ae`](https://bitbucket.org/atlassian/atlassian-frontend/commits/20f8e0400ae) - [ux] ED-16251: Added logic to respect minimum column width when adding columns to table.
9
+ - [`3820895a26d`](https://bitbucket.org/atlassian/atlassian-frontend/commits/3820895a26d) - [ux] Fix column resizing when single column is selected
10
+ - [`a2d2aedc1c6`](https://bitbucket.org/atlassian/atlassian-frontend/commits/a2d2aedc1c6) - [ux] ED-16212: Fix 1px table overflow issue
11
+ - [`06f78e978d3`](https://bitbucket.org/atlassian/atlassian-frontend/commits/06f78e978d3) - [ux] ED-15640: Added layoutChanged check before setting scaleTable meta data to true in scaleTable function.
12
+ - [`3c3e9524f33`](https://bitbucket.org/atlassian/atlassian-frontend/commits/3c3e9524f33) - [ux] ED-16213: Prevented scroll bar when column is resized and new column is inserted in tables
13
+ - [`ad2df7a6b46`](https://bitbucket.org/atlassian/atlassian-frontend/commits/ad2df7a6b46) - [ux] ED-16214: fix issue where last table column cannot be resized to remove scroll when inside and expand
14
+
3
15
  ## 1.1.2
4
16
 
5
17
  ### Patch Changes
@@ -32,6 +32,7 @@ var _utils4 = require("../utils");
32
32
  var _updateOverflowShadows = require("./update-overflow-shadows");
33
33
  var _memoizeOne = _interopRequireDefault(require("memoize-one"));
34
34
  var _OverflowShadowsObserver = require("./OverflowShadowsObserver");
35
+ var _misc = require("../pm-plugins/table-resizing/utils/misc");
35
36
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
36
37
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty3.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
37
38
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
@@ -197,15 +198,23 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
197
198
  }
198
199
  });
199
200
  (0, _defineProperty3.default)((0, _assertThisInitialized2.default)(_this), "handleWindowResize", function () {
201
+ var _node$attrs, _node$attrs2;
200
202
  var _this$props4 = _this.props,
201
203
  getNode = _this$props4.getNode,
202
204
  containerWidth = _this$props4.containerWidth;
203
- var layoutSize = _this.tableNodeLayoutSize(getNode());
205
+ var node = getNode();
206
+ var prevNode = _this.node;
207
+ var layoutSize = _this.tableNodeLayoutSize(node);
208
+ var prevAttrs = prevNode === null || prevNode === void 0 ? void 0 : prevNode.attrs;
209
+ var layoutChanged = (prevAttrs === null || prevAttrs === void 0 ? void 0 : prevAttrs.layout) !== (node === null || node === void 0 ? void 0 : (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.layout) && (prevAttrs === null || prevAttrs === void 0 ? void 0 : prevAttrs.__autoSize) === (node === null || node === void 0 ? void 0 : (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.__autoSize);
204
210
  if (containerWidth.width > layoutSize) {
205
211
  return;
206
212
  }
207
213
  var parentWidth = _this.getParentNodeWidth();
208
- _this.scaleTableDebounced(parentWidth);
214
+ _this.scaleTableDebounced({
215
+ layoutChanged: layoutChanged,
216
+ parentWidth: parentWidth
217
+ });
209
218
  });
210
219
  (0, _defineProperty3.default)((0, _assertThisInitialized2.default)(_this), "updateTableContainerWidth", function () {
211
220
  var _this$props5 = _this.props,
@@ -241,7 +250,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
241
250
  if (!(0, _utils2.isValidPosition)(pos, state)) {
242
251
  return;
243
252
  }
244
- return (0, _nodeWidth.getParentNodeWidth)(pos, state, containerWidth, options && options.isFullWidthModeEnabled);
253
+ var parentNodeWith = (0, _nodeWidth.getParentNodeWidth)(pos, state, containerWidth, options && options.isFullWidthModeEnabled);
254
+ return (0, _misc.getParentWidthWithoutPadding)(parentNodeWith, pos, state);
245
255
  });
246
256
  (0, _defineProperty3.default)((0, _assertThisInitialized2.default)(_this), "updateParentWidth", function (width) {
247
257
  _this.setState({
@@ -16,7 +16,8 @@ var scaleTable = function scaleTable(tableRef, options, domAtPos) {
16
16
  }
17
17
  var node = options.node,
18
18
  start = options.start,
19
- parentWidth = options.parentWidth;
19
+ parentWidth = options.parentWidth,
20
+ layoutChanged = options.layoutChanged;
20
21
 
21
22
  // If a table has not been resized yet, columns should be auto.
22
23
  if ((0, _utils2.hasTableBeenResized)(node) === false) {
@@ -39,7 +40,11 @@ var scaleTable = function scaleTable(tableRef, options, domAtPos) {
39
40
  // TODO: ED-8995
40
41
  // We need to do this check to reduce the number of race conditions when working with tables.
41
42
  // This metadata is been used in the sendTransaction function in the Collab plugin
42
- _tr.setMeta('scaleTable', true);
43
+ /* Added !layoutChanged check here to solve unnecessary scroll bar after publish when click on breakout button multiple times and publish
44
+ scaleTable is only called once every time a breakout button is clicked, so it is safe not to add the meta 'scaleTable' to the tr.
45
+ Leaving the tr.setMeta('scaleTable', true) here for race conditions that we aren't aware of.
46
+ */
47
+ !layoutChanged && _tr.setMeta('scaleTable', true);
43
48
  dispatch(_tr);
44
49
  return true;
45
50
  }
@@ -15,6 +15,7 @@ var _commands = require("./commands");
15
15
  var _pluginFactory = require("./plugin-factory");
16
16
  var _utils3 = require("./utils");
17
17
  var _analytics = require("@atlaskit/editor-common/analytics");
18
+ var _misc = require("./utils/misc");
18
19
  var handleMouseDown = function handleMouseDown(view, event, localResizeHandlePos, getEditorContainerWidth, getEditorFeatureFlags, editorAnalyticsAPI) {
19
20
  var state = view.state,
20
21
  dispatch = view.dispatch;
@@ -35,7 +36,10 @@ var handleMouseDown = function handleMouseDown(view, event, localResizeHandlePos
35
36
  }
36
37
  var containerWidth = getEditorContainerWidth();
37
38
  var parentWidth = (0, _nodeWidth.getParentNodeWidth)(start, state, containerWidth);
38
- var maxSize = parentWidth || (0, _utils3.getLayoutSize)(dom.getAttribute('data-layout'), containerWidth.width, {});
39
+
40
+ // TODO - refactor this logic into getParentNodeWidth() in editor-common [ED-16718]
41
+ var parentActualWidth = (0, _misc.getParentWidthWithoutPadding)(parentWidth, start, state);
42
+ var maxSize = parentActualWidth || (0, _utils3.getLayoutSize)(dom.getAttribute('data-layout'), containerWidth.width, {});
39
43
  if (originalTable.attrs.isNumberColumnEnabled) {
40
44
  maxSize -= _editorSharedStyles.akEditorTableNumberColumnWidth;
41
45
  }
@@ -4,10 +4,11 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.insertColgroupFromNode = exports.hasTableBeenResized = exports.generateColgroup = void 0;
7
+ exports.isMinCellWidthTable = exports.insertColgroupFromNode = exports.hasTableBeenResized = exports.generateColgroup = void 0;
8
8
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
9
9
  var _prosemirrorModel = require("prosemirror-model");
10
10
  var _utils = require("@atlaskit/editor-common/utils");
11
+ var _styles = require("@atlaskit/editor-common/styles");
11
12
  var generateColgroup = function generateColgroup(table) {
12
13
  var cols = [];
13
14
  table.content.firstChild.content.forEach(function (cell) {
@@ -49,7 +50,22 @@ var hasTableBeenResized = function hasTableBeenResized(table) {
49
50
  return cell.attrs.colwidth;
50
51
  });
51
52
  };
53
+
54
+ /**
55
+ * Check if a table has all the column width set to tableCellMinWidth(48px) or null
56
+ *
57
+ * @param table
58
+ * @returns true if all column width is equal to tableCellMinWidth or null, false otherwise
59
+ */
52
60
  exports.hasTableBeenResized = hasTableBeenResized;
61
+ var isMinCellWidthTable = function isMinCellWidthTable(table) {
62
+ var cellArray = (0, _utils.getFragmentBackingArray)(table.content.firstChild.content);
63
+ var isTableMinCellWidth = cellArray.every(function (cell) {
64
+ return cell.attrs.colwidth && cell.attrs.colwidth[0] === _styles.tableCellMinWidth || cell.attrs.colwidth === null;
65
+ });
66
+ return isTableMinCellWidth;
67
+ };
68
+ exports.isMinCellWidthTable = isMinCellWidthTable;
53
69
  function renderColgroupFromNode(table) {
54
70
  var rendered = _prosemirrorModel.DOMSerializer.renderSpec(document, ['colgroup', {}].concat((0, _toConsumableArray2.default)(generateColgroup(table))));
55
71
  return rendered.dom;
@@ -7,7 +7,7 @@ exports.currentColWidth = currentColWidth;
7
7
  exports.domCellAround = domCellAround;
8
8
  exports.getDefaultLayoutMaxWidth = getDefaultLayoutMaxWidth;
9
9
  exports.getLayoutSize = getLayoutSize;
10
- exports.getTableMaxWidth = void 0;
10
+ exports.getTableMaxWidth = exports.getParentWidthWithoutPadding = void 0;
11
11
  exports.pointsAtCell = pointsAtCell;
12
12
  exports.tableLayoutToSize = void 0;
13
13
  var _styles = require("@atlaskit/editor-common/styles");
@@ -15,6 +15,8 @@ var _ui = require("@atlaskit/editor-common/ui");
15
15
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
16
16
  var _utils = require("@atlaskit/editor-common/utils");
17
17
  var _nodeWidth = require("@atlaskit/editor-common/node-width");
18
+ var _constants = require("@atlaskit/theme/constants");
19
+ var _prosemirrorUtils = require("prosemirror-utils");
18
20
  var tableLayoutToSize = {
19
21
  default: _editorSharedStyles.akEditorDefaultLayoutWidth,
20
22
  wide: _editorSharedStyles.akEditorWideLayoutWidth,
@@ -34,9 +36,6 @@ function getLayoutSize(tableLayout) {
34
36
  if (calculatedTableWidth.endsWith('px')) {
35
37
  return parseInt(calculatedTableWidth, 10);
36
38
  }
37
- if (tableLayout === 'default') {
38
- return getDefaultLayoutMaxWidth(containerWidth);
39
- }
40
39
  return tableLayoutToSize[tableLayout] || containerWidth;
41
40
  }
42
41
  function getDefaultLayoutMaxWidth(containerWidth) {
@@ -85,10 +84,43 @@ var getTableMaxWidth = function getTableMaxWidth(_ref2) {
85
84
  getEditorContainerWidth = _ref2.getEditorContainerWidth;
86
85
  var containerWidth = getEditorContainerWidth();
87
86
  var parentWidth = (0, _nodeWidth.getParentNodeWidth)(tableStart, state, containerWidth);
88
- var maxWidth = parentWidth || getLayoutSize(layout, containerWidth.width, {});
87
+
88
+ // TODO - refactor this logic into getParentNodeWidth() in editor-common [ED-16718]
89
+ var parentActualWidth = getParentWidthWithoutPadding(parentWidth, tableStart, state);
90
+ var maxWidth = parentActualWidth || getLayoutSize(layout, containerWidth.width, {});
89
91
  if (table.attrs.isNumberColumnEnabled) {
90
92
  maxWidth -= _editorSharedStyles.akEditorTableNumberColumnWidth;
91
93
  }
92
94
  return maxWidth;
93
95
  };
94
- exports.getTableMaxWidth = getTableMaxWidth;
96
+ exports.getTableMaxWidth = getTableMaxWidth;
97
+ var getParentWidthWithoutPadding = function getParentWidthWithoutPadding(parentWidth, tableStartPos, state) {
98
+ var node = getNestedParentNode(tableStartPos, state);
99
+ if (!node) {
100
+ return;
101
+ }
102
+ var schema = state.schema;
103
+ if (node.type === schema.nodes.expand) {
104
+ // padding
105
+ parentWidth -= (0, _constants.gridSize)() * 2;
106
+ // gutter offset
107
+ parentWidth += (0, _constants.gridSize)() * 1.5 * 2;
108
+ // padding right
109
+ parentWidth -= (0, _constants.gridSize)();
110
+ // padding left
111
+ parentWidth -= (0, _constants.gridSize)() * 4 - (0, _constants.gridSize)() / 2;
112
+ }
113
+ return parentWidth;
114
+ };
115
+
116
+ // copy of getNestedParentNode() from packages/editor/editor-common/src/node-width/index.ts
117
+ // to be removed later when we will move getParentWidthWithoutPadding() logic to editor-common
118
+ exports.getParentWidthWithoutPadding = getParentWidthWithoutPadding;
119
+ var getNestedParentNode = function getNestedParentNode(tablePos, state) {
120
+ if (tablePos === undefined) {
121
+ return null;
122
+ }
123
+ var $pos = state.doc.resolve(tablePos);
124
+ var parent = (0, _prosemirrorUtils.findParentNodeOfTypeClosestToPos)($pos, [state.schema.nodes.bodiedExtension, state.schema.nodes.layoutSection, state.schema.nodes.expand]);
125
+ return parent ? parent.node : null;
126
+ };
@@ -25,7 +25,7 @@ var growColumn = function growColumn(state, colIndex, amount, selectedColumns) {
25
25
  if (remaining > 0) {
26
26
  newState = stackSpace(newState, colIndex, remaining).state;
27
27
  }
28
- if (selectedColumns) {
28
+ if (selectedColumns && selectedColumns.length > 1) {
29
29
  return (0, _resizeState.bulkColumnsResize)(newState, selectedColumns, colIndex);
30
30
  }
31
31
  return newState;
@@ -49,7 +49,7 @@ var shrinkColumn = function shrinkColumn(state, colIndex, amount, selectedColumn
49
49
  if (remaining < 0) {
50
50
  newState = stackSpace(newState, colIndex + 1, remaining).state;
51
51
  }
52
- if (selectedColumns) {
52
+ if (selectedColumns && selectedColumns.length > 1) {
53
53
  return (0, _resizeState.bulkColumnsResize)(newState, selectedColumns, colIndex);
54
54
  }
55
55
  return newState;
@@ -8,11 +8,14 @@ exports.updateColumnWidths = exports.rescaleColumns = void 0;
8
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
9
  var _tableMap = require("@atlaskit/editor-tables/table-map");
10
10
  var _styles = require("@atlaskit/editor-common/styles");
11
+ var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
11
12
  var _utils = require("../pm-plugins/table-resizing/utils");
12
13
  var _metadata = require("./metadata");
13
14
  var _resizeState = require("../pm-plugins/table-resizing/utils/resize-state");
14
15
  var _misc = require("../pm-plugins/table-resizing/utils/misc");
15
16
  var _scaleTable = require("../pm-plugins/table-resizing/utils/scale-table");
17
+ var _colgroup = require("../pm-plugins/table-resizing/utils/colgroup");
18
+ var _commonStyles = require("../ui/common-styles");
16
19
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
17
20
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
18
21
  var updateColumnWidths = function updateColumnWidths(resizeState, table, start) {
@@ -119,16 +122,17 @@ exports.updateColumnWidths = updateColumnWidths;
119
122
  var rescaleColumns = function rescaleColumns(getEditorContainerWidth) {
120
123
  return function (table, view) {
121
124
  return function (tr) {
122
- // If the table has been not been resized we skip updating the size
123
- // of columns here.
124
- if (!view || !(0, _utils.hasTableBeenResized)(table.node)) {
125
+ var _tableRef$parentEleme;
126
+ if (!view) {
125
127
  return tr;
126
128
  }
129
+ var pos = table.pos;
130
+ var newTable = tr.doc.nodeAt(pos);
127
131
  var state = view.state;
128
132
  var domAtPos = view.domAtPos.bind(view);
129
133
  var maybeTable = domAtPos(table.start).node;
130
134
  var tableRef = maybeTable.closest('table');
131
- if (!tableRef) {
135
+ if (!tableRef || !newTable) {
132
136
  return tr;
133
137
  }
134
138
  var layout = (0, _resizeState.normaliseTableLayout)(tableRef === null || tableRef === void 0 ? void 0 : tableRef.dataset.layout);
@@ -140,6 +144,44 @@ var rescaleColumns = function rescaleColumns(getEditorContainerWidth) {
140
144
  layout: layout,
141
145
  getEditorContainerWidth: getEditorContainerWidth
142
146
  });
147
+ var tableWidth = tableRef.clientWidth || _editorSharedStyles.akEditorDefaultLayoutWidth;
148
+ var tableMaxWidth = (tableRef === null || tableRef === void 0 ? void 0 : (_tableRef$parentEleme = tableRef.parentElement) === null || _tableRef$parentEleme === void 0 ? void 0 : _tableRef$parentEleme.clientWidth) || 0;
149
+ tableMaxWidth -= _commonStyles.insertColumnButtonOffset;
150
+ var newTableMap = _tableMap.TableMap.get(newTable);
151
+ var noOfColumns = newTableMap.width;
152
+ if (!noOfColumns || noOfColumns <= 0) {
153
+ return tr;
154
+ }
155
+ var columnWidthUnresized = tableWidth / noOfColumns;
156
+
157
+ // If the table has not been resized, and the column width is bigger than the minimum column width
158
+ // we skip updating the size of columns here.
159
+ if (!(0, _utils.hasTableBeenResized)(table.node) && columnWidthUnresized > _styles.tableCellMinWidth) {
160
+ return tr;
161
+ }
162
+
163
+ // If the table has not been resized, and the column width is smaller than the minimum column width
164
+ // Or if the table has been resized, but each column width is either 48px or null
165
+ // we update the table to have 48px for each column
166
+ if (!(0, _utils.hasTableBeenResized)(table.node) && columnWidthUnresized <= _styles.tableCellMinWidth || (0, _utils.hasTableBeenResized)(table.node) && (0, _colgroup.isMinCellWidthTable)(table.node)) {
167
+ var widths = new Array(noOfColumns).fill(_styles.tableCellMinWidth);
168
+ var cols = widths.map(function (width, index) {
169
+ return {
170
+ width: _styles.tableCellMinWidth,
171
+ minWidth: _styles.tableCellMinWidth,
172
+ index: index
173
+ };
174
+ });
175
+ var overflow = tableWidth > maxSize;
176
+ var minWidthResizeState = {
177
+ cols: cols,
178
+ widths: widths,
179
+ maxSize: maxSize,
180
+ tableWidth: tableWidth,
181
+ overflow: overflow
182
+ };
183
+ return updateColumnWidths(minWidthResizeState, table.node, table.start)(tr);
184
+ }
143
185
  var resizeState = (0, _resizeState.getResizeState)({
144
186
  minWidth: _styles.tableCellMinWidth,
145
187
  table: table.node,
@@ -149,7 +191,7 @@ var rescaleColumns = function rescaleColumns(getEditorContainerWidth) {
149
191
  maxSize: maxSize
150
192
  });
151
193
  var previousTableWidth = resizeState.tableWidth - _styles.tableNewColumnMinWidth;
152
- var tableDidntPreviouslyOverflow = previousTableWidth <= maxSize;
194
+ var tableDidntPreviouslyOverflow = previousTableWidth <= Math.max(maxSize, tableMaxWidth);
153
195
 
154
196
  // If the new table width will result in the table going into an overflow state
155
197
  // we resize the cells to avoid the overflow occuring
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.tableStyles = exports.tableFullPageEditorStyles = exports.tableCommentEditorStyles = void 0;
7
+ exports.tableStyles = exports.tableFullPageEditorStyles = exports.tableCommentEditorStyles = exports.insertColumnButtonOffset = void 0;
8
8
  var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
9
9
  var _react = require("@emotion/react");
10
10
  var _styles = require("@atlaskit/editor-common/styles");
@@ -24,6 +24,7 @@ var cornerControlHeight = _consts.tableToolbarSize + 1;
24
24
  its center should be aligned with the edge
25
25
  */
26
26
  var insertColumnButtonOffset = _consts.tableInsertColumnButtonSize / 2;
27
+ exports.insertColumnButtonOffset = insertColumnButtonOffset;
27
28
  var rangeSelectionStyles = "\n.".concat(_types.TableCssClassName.NODEVIEW_WRAPPER, ".").concat(_editorSharedStyles.akEditorSelectedNodeClassName, " table tbody tr {\n th,td {\n ").concat((0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.Blanket, _editorSharedStyles.SelectionStyle.Border]), "\n }\n}\n");
28
29
  var sentinelStyles = ".".concat(_types.TableCssClassName.TABLE_CONTAINER, " {\n > .").concat(_types.TableCssClassName.TABLE_STICKY_SENTINEL_TOP, ", > .").concat(_types.TableCssClassName.TABLE_STICKY_SENTINEL_BOTTOM, " {\n position: absolute;\n width: 100%;\n height: 1px;\n margin-top: -1px;\n // need this to avoid sentinel being focused via keyboard\n // this still allows it to be detected by intersection observer\n visibility: hidden;\n }\n > .").concat(_types.TableCssClassName.TABLE_STICKY_SENTINEL_TOP, " {\n top: ").concat(_consts.columnControlsDecorationHeight, "px;\n }\n > .").concat(_types.TableCssClassName.TABLE_STICKY_SENTINEL_BOTTOM, " {\n bottom: ").concat(_consts.tableScrollbarOffset + _consts.stickyRowOffsetTop + _consts.tablePadding * 2 + 23, "px;\n }\n &.").concat(_types.TableCssClassName.WITH_CONTROLS, " {\n > .").concat(_types.TableCssClassName.TABLE_STICKY_SENTINEL_TOP, " {\n top: 0px;\n }\n > .").concat(_types.TableCssClassName.TABLE_STICKY_SENTINEL_BOTTOM, " {\n margin-bottom: ").concat(_consts.columnControlsDecorationHeight, "px;\n }\n }\n}");
29
30
 
@@ -34,10 +35,10 @@ var listLargeNumericMarkersOldStyles = "\n .ProseMirror .pm-table-cell-content-
34
35
  // TODO: https://product-fabric.atlassian.net/browse/DSP-4139
35
36
  var tableStyles = function tableStyles(props) {
36
37
  var _props$featureFlags, _props$featureFlags2;
37
- return (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .", " button {\n background: ", ";\n color: ", ";\n cursor: none;\n }\n\n .", ":not(.", ") button:hover {\n background: ", ";\n color: ", " !important;\n cursor: pointer;\n }\n\n .ProseMirror {\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n\n .", " {\n margin-bottom: 0;\n }\n\n .", " {\n td.", ", th.", " {\n position: relative;\n overflow: visible;\n }\n\n td.", " {\n background-color: ", ";\n\n // ED-15246: Trello card is visible through a border of a table border\n // This fixes a border issue caused by relative positioned table cells\n &::after {\n height: 100%;\n content: '';\n border-left: 1px solid ", ";\n border-bottom: 1px solid ", ";\n position: absolute;\n right: 0px;\n top: 0px;\n bottom: 0;\n width: 100%;\n display: inline-block;\n pointer-events: none;\n }\n }\n }\n\n .", " {\n ", "\n }\n\n .", " {\n ", "\n }\n\n /* Delete button */\n ", "\n /* Ends Delete button */\n\n /* sticky styles */\n .", " .", " .", ":first-of-type {\n margin-top: ", "px;\n width: ", "px;\n\n position: fixed !important;\n z-index: ", " !important;\n box-shadow: 0px -", "px ", ";\n border-right: 0 none;\n /* top set by NumberColumn component */\n }\n\n .", " .", ".sticky {\n position: fixed !important;\n /* needs to be above row controls */\n z-index: ", " !important;\n background: ", ";\n\n width: ", "px;\n height: ", "px;\n }\n\n .", ".sticky .", " {\n border-bottom: 0px none;\n border-right: 0px none;\n\n height: ", "px;\n width: ", "px;\n }\n\n .", " .", " {\n z-index: 0;\n }\n\n .", "\n .", "\n .", ".sticky {\n position: fixed !important;\n z-index: ", " !important;\n display: flex;\n border-left: ", "px solid\n ", ";\n margin-left: -", "px;\n }\n\n .", " col:first-of-type {\n /* moving rows out of a table layout does weird things in Chrome */\n border-right: 1px solid ", ";\n }\n\n tr.sticky {\n padding-top: ", "px;\n position: fixed;\n display: grid;\n\n /* to keep it above cell selection */\n z-index: ", ";\n\n overflow-y: visible;\n overflow-x: hidden;\n\n grid-auto-flow: column;\n\n /* background for where controls apply */\n background: ", ";\n box-sizing: content-box;\n\n margin-top: 2px;\n\n box-shadow: ", ";\n margin-left: -1px;\n\n &.no-pointer-events {\n pointer-events: none;\n }\n }\n\n .", " .", " {\n left: unset;\n position: fixed;\n z-index: ", ";\n }\n\n .", ".", "\n .", " {\n padding-bottom: ", "px;\n }\n\n tr.sticky th {\n border-bottom: ", "px solid\n ", ";\n margin-right: -1px;\n }\n\n .", " tr.sticky > th:last-child {\n border-right-width: 1px;\n }\n\n /* add left edge for first cell */\n .", " tr.sticky > th:first-of-type {\n margin-left: 0px;\n }\n\n /* add a little bit so the scroll lines up with the table */\n .", " tr.sticky::after {\n content: ' ';\n width: ", "px;\n }\n\n /* To fix jumpiness caused in Chrome Browsers for sticky headers */\n .", " .sticky + tr {\n min-height: 0px;\n }\n\n /* move resize line a little in sticky bar */\n .", ".", " {\n tr.sticky\n td.", ",\n tr.sticky\n th.", " {\n .", "::after {\n right: ", "px;\n }\n }\n\n /* when selected put it back to normal -- :not selector would be nicer */\n tr.sticky\n td.", ".", ",\n tr.sticky\n th.", ".", " {\n .", "::after {\n right: ", "px;\n }\n }\n }\n\n tr.sticky\n .", ",\n tr.sticky\n .", " {\n z-index: 1;\n }\n\n .", " tr.sticky {\n padding-top: ", "px;\n }\n\n .", ".", "\n .", "\n .", ":first-of-type {\n margin-top: ", "px;\n }\n\n .", ".sticky {\n border-top: ", "px solid\n ", ";\n }\n\n ", "\n ", "\n\n .", " .", " {\n height: 0; // stop overflow flash & set correct height in update-overflow-shadows.ts\n }\n\n .less-padding {\n padding: 0 ", "px;\n\n .", " {\n padding: 0 ", "px;\n }\n\n &.", "[data-number-column='true'] {\n padding-left: ", "px;\n }\n\n .", " {\n left: 6px;\n }\n\n .", " {\n left: calc(100% - 6px);\n }\n }\n\n > .", " {\n /**\n * Prevent margins collapsing, aids with placing the gap-cursor correctly\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Box_Model/Mastering_margin_collapsing\n *\n * TODO: Enable this, many tests will fail!\n * border-top: 1px solid transparent;\n */\n }\n\n /* Breakout only works on top level */\n > * .", " .", " {\n margin-left: unset !important;\n width: 100% !important;\n }\n\n ", ";\n\n /* Corner controls */\n .", " {\n width: ", "px;\n height: ", "px;\n display: none;\n\n .", " {\n position: relative;\n\n ", ";\n }\n }\n\n .", ".sticky {\n .", " {\n /* sticky row insert dot overlaps other row insert and messes things up */\n display: none !important;\n }\n }\n\n .", " {\n position: absolute;\n top: 0;\n width: ", "px;\n height: ", "px;\n border: 1px solid ", ";\n border-radius: 0;\n border-top-left-radius: ", "px;\n background: ", ";\n box-sizing: border-box;\n padding: 0;\n :focus {\n outline: none;\n }\n }\n .active .", " {\n border-color: ", ";\n background: ", ";\n }\n\n .", "[data-number-column='true'] {\n .", ", .", " {\n width: ", "px;\n }\n .", " .", " {\n border-right-width: 0;\n }\n }\n\n :not(.", ") .", ":hover {\n border-color: ", ";\n background: ", ";\n cursor: pointer;\n }\n\n :not(.", ")\n .", ".", " {\n border-color: ", ";\n background: ", ";\n }\n\n /* Row controls */\n .", " {\n width: ", "px;\n box-sizing: border-box;\n display: none;\n position: relative;\n\n ", ";\n\n .", " {\n display: flex;\n flex-direction: column;\n }\n .", ":last-child > button {\n border-bottom-left-radius: ", "px;\n }\n .", " {\n position: relative;\n margin-top: -1px;\n }\n .", ":hover,\n .", ".active,\n .", ":hover {\n z-index: ", ";\n }\n\n ", "\n }\n\n :not(.", ") .", " {\n ", "\n ", "\n }\n\n /* Numbered column */\n .", " {\n position: relative;\n float: right;\n margin-left: ", "px;\n top: ", "px;\n width: ", "px;\n box-sizing: border-box;\n }\n\n .", " {\n border: 1px solid ", ";\n box-sizing: border-box;\n margin-top: -1px;\n padding-bottom: 2px;\n padding: 10px 2px;\n text-align: center;\n font-size: ", ";\n background-color: ", ";\n color: ", ";\n border-color: ", ";\n\n :first-child:not(style),\n style:first-child + * {\n margin-top: 0;\n }\n :last-child {\n border-bottom: 1px solid ", ";\n }\n }\n\n .", " {\n .", ", .", " {\n display: block;\n }\n .", " {\n padding-left: 1px;\n .", " {\n border-left: 0 none;\n }\n\n .", ".active {\n border-bottom: 1px solid ", ";\n border-color: ", ";\n background-color: ", ";\n position: relative;\n z-index: ", ";\n color: ", ";\n }\n }\n }\n :not(.", ") .", " {\n .", " {\n cursor: pointer;\n }\n .", ":hover {\n border-bottom: 1px solid ", ";\n border-color: ", ";\n background-color: ", ";\n position: relative;\n z-index: ", ";\n color: ", ";\n }\n .", ".", " {\n background-color: ", ";\n border: 1px solid ", ";\n border-left: 0;\n color: ", ";\n position: relative;\n z-index: ", ";\n }\n }\n\n /* Table */\n .", " > table {\n table-layout: fixed;\n white-space: normal;\n border-top: none;\n\n > tbody > tr {\n white-space: pre-wrap;\n }\n\n .", " + * {\n margin-top: 0;\n }\n\n /*\n * Headings have a top margin by default, but we don't want this on the\n * first heading within table header cells.\n *\n * This specifically sets margin-top for the first heading within a header\n * cell when center/right aligned.\n */\n th.", " > .fabric-editor-block-mark {\n > h1:first-of-type,\n > h2:first-of-type,\n > h3:first-of-type,\n > h4:first-of-type,\n > h5:first-of-type,\n > h6:first-of-type {\n margin-top: 0;\n }\n }\n\n .", ", .", " {\n position: relative;\n }\n /* Give selected cells a blue overlay */\n .", "::after,\n .", "::after {\n z-index: ", ";\n position: absolute;\n content: '';\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n width: 100%;\n pointer-events: none;\n }\n .", " {\n border: 1px solid ", ";\n }\n .", "::after {\n background: ", ";\n z-index: ", ";\n }\n th.", "::after,\n td.", "::after {\n background: ", ";\n z-index: ", ";\n }\n // ED-15246: Trello card is visible through a border of a table border\n td.", ", td.", " {\n &::after {\n height: 100%;\n width: 100%;\n border: 1px solid ", ";\n content: '';\n position: absolute;\n left: -1px;\n top: -1px;\n bottom: 0;\n z-index: ", ";\n display: inline-block;\n pointer-events: none;\n }\n &.", "::after {\n border: 1px solid ", ";\n z-index: ", ";\n }\n }\n }\n .", " {\n position: absolute;\n /* top of corner control is table margin top - corner control height + 1 pixel of table border. */\n top: ", "px;\n }\n .", ".", " {\n z-index: ", ";\n }\n .", " {\n left: -", "px;\n }\n .", " {\n padding-right: ", "px;\n margin-right: -", "px;\n padding-bottom: ", "px;\n margin-bottom: -", "px;\n /* fixes gap cursor height */\n overflow: auto;\n position: relative;\n }\n }\n\n .ProseMirror.", " {\n .", " {\n overflow-x: auto;\n ", ";\n }\n }\n\n .ProseMirror.", " {\n cursor: col-resize;\n }\n\n /* \n ED-15882: When custom start numbers is enabled for lists, we have\n styles that handle this generally (in editor-common) so we can\n throw away the older table-specific styles here.\n */\n ", "\n"])), _types.TableCssClassName.LAYOUT_BUTTON, "var(--ds-background-neutral, ".concat(_colors.N20A, ")"), "var(--ds-icon, ".concat(_colors.N300, ")"), _types.TableCssClassName.LAYOUT_BUTTON, _types.TableCssClassName.IS_RESIZING, "var(--ds-background-neutral-hovered, ".concat(_colors.B300, ")"), "var(--ds-icon, white)", (0, _styles.tableSharedStyle)(props), (0, _uiStyles.columnControlsLineMarker)(props), _uiStyles.hoveredDeleteButton, _uiStyles.hoveredCell, _uiStyles.hoveredWarningCell, _uiStyles.resizeHandle, rangeSelectionStyles, _types.TableCssClassName.LAST_ITEM_IN_CELL, _types.TableCssClassName.TABLE_NODE_WRAPPER, _types.TableCssClassName.TABLE_CELL, _types.TableCssClassName.TABLE_HEADER_CELL, _types.TableCssClassName.TABLE_CELL, (0, _consts.tableCellBackgroundColor)(props), (0, _consts.tableBorderColor)(props), (0, _consts.tableBorderColor)(props), _types.TableCssClassName.CONTROLS_FLOATING_BUTTON_COLUMN, _uiStyles.insertColumnButtonWrapper, _types.TableCssClassName.CONTROLS_FLOATING_BUTTON_ROW, _uiStyles.insertRowButtonWrapper, _uiStyles.DeleteButton, _types.TableCssClassName.TABLE_STICKY, _types.TableCssClassName.NUMBERED_COLUMN, _types.TableCssClassName.NUMBERED_COLUMN_BUTTON, _consts.stickyRowOffsetTop + 2, _editorSharedStyles.akEditorTableNumberColumnWidth, _editorSharedStyles.akEditorStickyHeaderZIndex, _consts.stickyRowOffsetTop, "var(--ds-surface, white)", _types.TableCssClassName.TABLE_STICKY, _types.TableCssClassName.CORNER_CONTROLS, _editorSharedStyles.akEditorSmallZIndex, "var(--ds-surface, white)", _consts.tableToolbarSize, _consts.tableToolbarSize, _types.TableCssClassName.CORNER_CONTROLS, _types.TableCssClassName.CONTROLS_CORNER_BUTTON, _consts.tableToolbarSize, _consts.tableToolbarSize, _types.TableCssClassName.TABLE_STICKY, _types.TableCssClassName.COLUMN_CONTROLS_DECORATIONS, _types.TableCssClassName.TABLE_STICKY, _types.TableCssClassName.ROW_CONTROLS, _types.TableCssClassName.ROW_CONTROLS_BUTTON_WRAP, _editorSharedStyles.akEditorStickyHeaderZIndex, _consts.tableToolbarSize, "var(--ds-surface, white)", _consts.tableToolbarSize, _types.TableCssClassName.TABLE_STICKY, "var(--ds-surface, green)", _consts.stickyRowOffsetTop, _consts.stickyRowZIndex, "var(--ds-surface, white)", "var(--ds-shadow-overflow, ".concat("0 6px 4px -4px ".concat(_colors.N40A), ")"), _types.TableCssClassName.TABLE_STICKY, _types.TableCssClassName.TABLE_STICKY_SHADOW, _consts.stickyRowZIndex + 1, _types.TableCssClassName.WITH_CONTROLS, _types.TableCssClassName.TABLE_STICKY, _types.TableCssClassName.TABLE_STICKY_SHADOW, _consts.tableToolbarSize, _consts.stickyHeaderBorderBottomWidth, (0, _consts.tableBorderColor)(props), _types.TableCssClassName.TABLE_STICKY, _types.TableCssClassName.TABLE_STICKY, _types.TableCssClassName.TABLE_STICKY, insertColumnButtonOffset + 1, _types.TableCssClassName.TABLE_STICKY, _types.TableCssClassName.TABLE_CONTAINER, _types.TableCssClassName.TABLE_STICKY, _types.TableCssClassName.WITH_RESIZE_LINE, _types.TableCssClassName.WITH_RESIZE_LINE, _types.TableCssClassName.RESIZE_HANDLE_DECORATION, (_consts.resizeHandlerAreaWidth - _consts.resizeLineWidth) / 2 + 1, _types.TableCssClassName.WITH_RESIZE_LINE, _types.TableCssClassName.SELECTED_CELL, _types.TableCssClassName.WITH_RESIZE_LINE, _types.TableCssClassName.SELECTED_CELL, _types.TableCssClassName.RESIZE_HANDLE_DECORATION, (_consts.resizeHandlerAreaWidth - _consts.resizeLineWidth) / 2, _types.TableCssClassName.HOVERED_CELL, _types.TableCssClassName.SELECTED_CELL, _types.TableCssClassName.WITH_CONTROLS, _consts.tableControlsSpacing, _types.TableCssClassName.WITH_CONTROLS, _types.TableCssClassName.TABLE_STICKY, _types.TableCssClassName.NUMBERED_COLUMN, _types.TableCssClassName.NUMBERED_COLUMN_BUTTON, _consts.tableControlsSpacing + 2, _types.TableCssClassName.CORNER_CONTROLS, _consts.tableControlsSpacing - _consts.tableToolbarSize + 2, "var(--ds-surface, white)", (_props$featureFlags = props.featureFlags) !== null && _props$featureFlags !== void 0 && _props$featureFlags.stickyHeadersOptimization ? sentinelStyles : '', (0, _uiStyles.OverflowShadow)(props), _types.TableCssClassName.TABLE_STICKY, _types.TableCssClassName.TABLE_STICKY_SHADOW, _consts.tablePadding, _types.TableCssClassName.ROW_CONTROLS_WRAPPER, _consts.tablePadding, _types.TableCssClassName.TABLE_CONTAINER, _editorSharedStyles.akEditorTableNumberColumnWidth + _consts.tablePadding - 1, _types.TableCssClassName.TABLE_LEFT_SHADOW, _types.TableCssClassName.TABLE_RIGHT_SHADOW, _types.TableCssClassName.NODEVIEW_WRAPPER, _types.TableCssClassName.NODEVIEW_WRAPPER, _types.TableCssClassName.TABLE_CONTAINER, (0, _uiStyles.columnControlsDecoration)(props), _types.TableCssClassName.CORNER_CONTROLS, _consts.tableToolbarSize + 1, cornerControlHeight, _types.TableCssClassName.CORNER_CONTROLS_INSERT_ROW_MARKER, (0, _uiStyles.InsertMarker)(props, "\n left: -11px;\n top: 9px;\n "), _types.TableCssClassName.CORNER_CONTROLS, _types.TableCssClassName.CORNER_CONTROLS_INSERT_ROW_MARKER, _types.TableCssClassName.CONTROLS_CORNER_BUTTON, _consts.tableToolbarSize + 1, _consts.tableToolbarSize + 1, (0, _consts.tableBorderColor)(props), _consts.tableBorderRadiusSize, (0, _consts.tableToolbarColor)(props), _types.TableCssClassName.CONTROLS_CORNER_BUTTON, _consts.tableBorderSelectedColor, "var(--ds-background-selected, ".concat(_consts.tableToolbarSelectedColor, ")"), _types.TableCssClassName.TABLE_CONTAINER, _types.TableCssClassName.CORNER_CONTROLS, _types.TableCssClassName.CONTROLS_CORNER_BUTTON, _editorSharedStyles.akEditorTableToolbarSize + _editorSharedStyles.akEditorTableNumberColumnWidth, _types.TableCssClassName.ROW_CONTROLS, _types.TableCssClassName.CONTROLS_BUTTON, _types.TableCssClassName.IS_RESIZING, _types.TableCssClassName.CONTROLS_CORNER_BUTTON, _consts.tableBorderSelectedColor, "var(--ds-background-selected, ".concat(_consts.tableToolbarSelectedColor, ")"), _types.TableCssClassName.IS_RESIZING, _types.TableCssClassName.CONTROLS_CORNER_BUTTON, _types.TableCssClassName.HOVERED_CELL_IN_DANGER, _consts.tableBorderDeleteColor, "var(--ds-background-danger, ".concat(_consts.tableToolbarDeleteColor, ")"), _types.TableCssClassName.ROW_CONTROLS, _consts.tableToolbarSize, (0, _uiStyles.InsertMarker)(props, "\n bottom: -1px;\n left: -11px;\n "), _types.TableCssClassName.ROW_CONTROLS_INNER, _types.TableCssClassName.ROW_CONTROLS_BUTTON_WRAP, _consts.tableBorderRadiusSize, _types.TableCssClassName.ROW_CONTROLS_BUTTON_WRAP, _types.TableCssClassName.ROW_CONTROLS_BUTTON_WRAP, _types.TableCssClassName.ROW_CONTROLS_BUTTON_WRAP, _types.TableCssClassName.CONTROLS_BUTTON, _editorSharedStyles.akEditorUnitZIndex, (0, _uiStyles.HeaderButton)(props, "\n border-bottom: 1px solid ".concat((0, _consts.tableBorderColor)(props), ";\n border-right: 0px;\n border-radius: 0;\n height: 100%;\n width: ").concat(_consts.tableToolbarSize, "px;\n\n .").concat(_types.TableCssClassName.CONTROLS_BUTTON_OVERLAY, " {\n position: absolute;\n width: 30px;\n height: 50%;\n right: 0;\n bottom: 0;\n }\n .").concat(_types.TableCssClassName.CONTROLS_BUTTON_OVERLAY, ":first-of-type {\n top: 0;\n }\n ")), _types.TableCssClassName.IS_RESIZING, _types.TableCssClassName.ROW_CONTROLS, (0, _uiStyles.HeaderButtonHover)(), (0, _uiStyles.HeaderButtonDanger)(), _types.TableCssClassName.NUMBERED_COLUMN, _editorSharedStyles.akEditorTableToolbarSize - 1, _editorSharedStyles.akEditorTableToolbarSize, _editorSharedStyles.akEditorTableNumberColumnWidth + 1, _types.TableCssClassName.NUMBERED_COLUMN_BUTTON, (0, _consts.tableBorderColor)(props), (0, _editorSharedStyles.relativeFontSizeToBase16)((0, _constants.fontSize)()), (0, _consts.tableToolbarColor)(props), (0, _consts.tableTextColor)(props), (0, _consts.tableBorderColor)(props), (0, _consts.tableBorderColor)(props), _types.TableCssClassName.WITH_CONTROLS, _types.TableCssClassName.CORNER_CONTROLS, _types.TableCssClassName.ROW_CONTROLS, _types.TableCssClassName.NUMBERED_COLUMN, _types.TableCssClassName.NUMBERED_COLUMN_BUTTON, _types.TableCssClassName.NUMBERED_COLUMN_BUTTON, _consts.tableBorderSelectedColor, _consts.tableBorderSelectedColor, "var(--ds-background-selected, ".concat(_consts.tableToolbarSelectedColor, ")"), _editorSharedStyles.akEditorUnitZIndex, "var(--ds-text-selected, ".concat(_colors.N0, ")"), _types.TableCssClassName.IS_RESIZING, _types.TableCssClassName.WITH_CONTROLS, _types.TableCssClassName.NUMBERED_COLUMN_BUTTON, _types.TableCssClassName.NUMBERED_COLUMN_BUTTON, _consts.tableBorderSelectedColor, _consts.tableBorderSelectedColor, "var(--ds-background-selected, ".concat(_consts.tableToolbarSelectedColor, ")"), _editorSharedStyles.akEditorUnitZIndex, "var(--ds-text-selected, ".concat(_colors.N0, ")"), _types.TableCssClassName.NUMBERED_COLUMN_BUTTON, _types.TableCssClassName.HOVERED_CELL_IN_DANGER, "var(--ds-background-danger, ".concat(_consts.tableToolbarDeleteColor, ")"), _consts.tableBorderDeleteColor, "var(--ds-text-danger, ".concat(_colors.R500, ")"), _editorSharedStyles.akEditorUnitZIndex, _types.TableCssClassName.TABLE_NODE_WRAPPER, _types.TableCssClassName.COLUMN_CONTROLS_DECORATIONS, _types.TableCssClassName.TABLE_HEADER_CELL, _types.TableCssClassName.SELECTED_CELL, _types.TableCssClassName.HOVERED_CELL_IN_DANGER, _types.TableCssClassName.SELECTED_CELL, _types.TableCssClassName.HOVERED_CELL_IN_DANGER, _editorSharedStyles.akEditorSmallZIndex, _types.TableCssClassName.SELECTED_CELL, _consts.tableBorderSelectedColor, _types.TableCssClassName.SELECTED_CELL, _consts.tableCellSelectedColor, _editorSharedStyles.akEditorSmallZIndex, _types.TableCssClassName.HOVERED_CELL_IN_DANGER, _types.TableCssClassName.HOVERED_CELL_IN_DANGER, _consts.tableCellDeleteColor, _editorSharedStyles.akEditorUnitZIndex * 100, _types.TableCssClassName.HOVERED_CELL, _types.TableCssClassName.SELECTED_CELL, _consts.tableBorderSelectedColor, _editorSharedStyles.akEditorSmallZIndex, _types.TableCssClassName.HOVERED_CELL_IN_DANGER, _consts.tableBorderDeleteColor, _editorSharedStyles.akEditorUnitZIndex * 100, _types.TableCssClassName.ROW_CONTROLS_WRAPPER, _styles.tableMarginTop - cornerControlHeight + 1, _types.TableCssClassName.ROW_CONTROLS_WRAPPER, _types.TableCssClassName.TABLE_LEFT_SHADOW, _editorSharedStyles.akEditorUnitZIndex, _types.TableCssClassName.ROW_CONTROLS_WRAPPER, _consts.tableToolbarSize, _types.TableCssClassName.TABLE_NODE_WRAPPER, insertColumnButtonOffset, insertColumnButtonOffset, _consts.tableScrollbarOffset, _consts.tableScrollbarOffset, _types.TableCssClassName.IS_RESIZING, _types.TableCssClassName.TABLE_NODE_WRAPPER, _scrollbar.scrollbarStyles, _types.TableCssClassName.RESIZE_CURSOR, props !== null && props !== void 0 && (_props$featureFlags2 = props.featureFlags) !== null && _props$featureFlags2 !== void 0 && _props$featureFlags2.restartNumberedLists ? "" : listLargeNumericMarkersOldStyles);
38
+ return (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .", " button {\n background: ", ";\n color: ", ";\n cursor: none;\n }\n\n .", ":not(.", ") button:hover {\n background: ", ";\n color: ", " !important;\n cursor: pointer;\n }\n\n .ProseMirror {\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n\n .", " {\n margin-bottom: 0;\n }\n\n .", " {\n td.", ", th.", " {\n position: relative;\n overflow: visible;\n }\n\n td.", " {\n background-color: ", ";\n\n // ED-15246: Trello card is visible through a border of a table border\n // This fixes a border issue caused by relative positioned table cells\n &::after {\n height: 100%;\n content: '';\n border-left: 1px solid ", ";\n border-bottom: 1px solid ", ";\n position: absolute;\n right: 0px;\n top: 0px;\n bottom: 0;\n width: 100%;\n display: inline-block;\n pointer-events: none;\n }\n }\n }\n\n .", " {\n ", "\n }\n\n .", " {\n ", "\n }\n\n /* Delete button */\n ", "\n /* Ends Delete button */\n\n /* sticky styles */\n .", " .", " .", ":first-of-type {\n margin-top: ", "px;\n width: ", "px;\n\n position: fixed !important;\n z-index: ", " !important;\n box-shadow: 0px -", "px ", ";\n border-right: 0 none;\n /* top set by NumberColumn component */\n }\n\n .", " .", ".sticky {\n position: fixed !important;\n /* needs to be above row controls */\n z-index: ", " !important;\n background: ", ";\n\n width: ", "px;\n height: ", "px;\n }\n\n .", ".sticky .", " {\n border-bottom: 0px none;\n border-right: 0px none;\n\n height: ", "px;\n width: ", "px;\n }\n\n .", " .", " {\n z-index: 0;\n }\n\n .", "\n .", "\n .", ".sticky {\n position: fixed !important;\n z-index: ", " !important;\n display: flex;\n border-left: ", "px solid\n ", ";\n margin-left: -", "px;\n }\n\n .", " col:first-of-type {\n /* moving rows out of a table layout does weird things in Chrome */\n border-right: 1px solid ", ";\n }\n\n tr.sticky {\n padding-top: ", "px;\n position: fixed;\n display: grid;\n\n /* to keep it above cell selection */\n z-index: ", ";\n\n overflow-y: visible;\n overflow-x: hidden;\n\n grid-auto-flow: column;\n\n /* background for where controls apply */\n background: ", ";\n box-sizing: content-box;\n\n margin-top: 2px;\n\n box-shadow: ", ";\n margin-left: -1px;\n\n &.no-pointer-events {\n pointer-events: none;\n }\n }\n\n .", " .", " {\n left: unset;\n position: fixed;\n z-index: ", ";\n }\n\n .", ".", "\n .", " {\n padding-bottom: ", "px;\n }\n\n tr.sticky th {\n border-bottom: ", "px solid\n ", ";\n margin-right: -1px;\n }\n\n .", " tr.sticky > th:last-child {\n border-right-width: 1px;\n }\n\n /* add left edge for first cell */\n .", " tr.sticky > th:first-of-type {\n margin-left: 0px;\n }\n\n /* add a little bit so the scroll lines up with the table */\n .", " tr.sticky::after {\n content: ' ';\n width: ", "px;\n }\n\n /* To fix jumpiness caused in Chrome Browsers for sticky headers */\n .", " .sticky + tr {\n min-height: 0px;\n }\n\n /* move resize line a little in sticky bar */\n .", ".", " {\n tr.sticky\n td.", ",\n tr.sticky\n th.", " {\n .", "::after {\n right: ", "px;\n }\n }\n\n /* when selected put it back to normal -- :not selector would be nicer */\n tr.sticky\n td.", ".", ",\n tr.sticky\n th.", ".", " {\n .", "::after {\n right: ", "px;\n }\n }\n }\n\n tr.sticky\n .", ",\n tr.sticky\n .", " {\n z-index: 1;\n }\n\n .", " tr.sticky {\n padding-top: ", "px;\n }\n\n .", ".", "\n .", "\n .", ":first-of-type {\n margin-top: ", "px;\n }\n\n .", ".sticky {\n border-top: ", "px solid\n ", ";\n }\n\n ", "\n ", "\n\n .", " .", " {\n height: 0; // stop overflow flash & set correct height in update-overflow-shadows.ts\n }\n\n .less-padding {\n padding: 0 ", "px;\n\n .", " {\n padding: 0 ", "px;\n }\n\n &.", "[data-number-column='true'] {\n padding-left: ", "px;\n }\n\n .", " {\n left: 6px;\n }\n\n .", " {\n left: calc(100% - 6px);\n }\n }\n\n > .", " {\n /**\n * Prevent margins collapsing, aids with placing the gap-cursor correctly\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Box_Model/Mastering_margin_collapsing\n *\n * TODO: Enable this, many tests will fail!\n * border-top: 1px solid transparent;\n */\n }\n\n /* Breakout only works on top level */\n > * .", " .", " {\n margin-left: unset !important;\n width: 100% !important;\n }\n\n ", ";\n\n /* Corner controls */\n .", " {\n width: ", "px;\n height: ", "px;\n display: none;\n\n .", " {\n position: relative;\n\n ", ";\n }\n }\n\n .", ".sticky {\n .", " {\n /* sticky row insert dot overlaps other row insert and messes things up */\n display: none !important;\n }\n }\n\n .", " {\n position: absolute;\n top: 0;\n width: ", "px;\n height: ", "px;\n border: 1px solid ", ";\n border-radius: 0;\n border-top-left-radius: ", "px;\n background: ", ";\n box-sizing: border-box;\n padding: 0;\n :focus {\n outline: none;\n }\n }\n .active .", " {\n border-color: ", ";\n background: ", ";\n }\n\n .", "[data-number-column='true'] {\n .", ", .", " {\n width: ", "px;\n }\n .", " .", " {\n border-right-width: 0;\n }\n }\n\n :not(.", ") .", ":hover {\n border-color: ", ";\n background: ", ";\n cursor: pointer;\n }\n\n :not(.", ")\n .", ".", " {\n border-color: ", ";\n background: ", ";\n }\n\n /* Row controls */\n .", " {\n width: ", "px;\n box-sizing: border-box;\n display: none;\n position: relative;\n\n ", ";\n\n .", " {\n display: flex;\n flex-direction: column;\n }\n .", ":last-child > button {\n border-bottom-left-radius: ", "px;\n }\n .", " {\n position: relative;\n margin-top: -1px;\n }\n .", ":hover,\n .", ".active,\n .", ":hover {\n z-index: ", ";\n }\n\n ", "\n }\n\n :not(.", ") .", " {\n ", "\n ", "\n }\n\n /* Numbered column */\n .", " {\n position: relative;\n float: right;\n margin-left: ", "px;\n top: ", "px;\n width: ", "px;\n box-sizing: border-box;\n }\n\n .", " {\n border: 1px solid ", ";\n box-sizing: border-box;\n margin-top: -1px;\n padding-bottom: 2px;\n padding: 10px 2px;\n text-align: center;\n font-size: ", ";\n background-color: ", ";\n color: ", ";\n border-color: ", ";\n\n :first-child:not(style),\n style:first-child + * {\n margin-top: 0;\n }\n :last-child {\n border-bottom: 1px solid ", ";\n }\n }\n\n .", " {\n .", ", .", " {\n display: block;\n }\n .", " {\n padding-left: 1px;\n .", " {\n border-left: 0 none;\n }\n\n .", ".active {\n border-bottom: 1px solid ", ";\n border-color: ", ";\n background-color: ", ";\n position: relative;\n z-index: ", ";\n color: ", ";\n }\n }\n }\n :not(.", ") .", " {\n .", " {\n cursor: pointer;\n }\n .", ":hover {\n border-bottom: 1px solid ", ";\n border-color: ", ";\n background-color: ", ";\n position: relative;\n z-index: ", ";\n color: ", ";\n }\n .", ".", " {\n background-color: ", ";\n border: 1px solid ", ";\n border-left: 0;\n color: ", ";\n position: relative;\n z-index: ", ";\n }\n }\n\n /* Table */\n .", " > table {\n table-layout: fixed;\n white-space: normal;\n border-top: none;\n // 1px border width offset added here to prevent unwanted overflow and scolling - ED-16212\n margin-right: -1px;\n\n > tbody > tr {\n white-space: pre-wrap;\n }\n\n .", " + * {\n margin-top: 0;\n }\n\n /*\n * Headings have a top margin by default, but we don't want this on the\n * first heading within table header cells.\n *\n * This specifically sets margin-top for the first heading within a header\n * cell when center/right aligned.\n */\n th.", " > .fabric-editor-block-mark {\n > h1:first-of-type,\n > h2:first-of-type,\n > h3:first-of-type,\n > h4:first-of-type,\n > h5:first-of-type,\n > h6:first-of-type {\n margin-top: 0;\n }\n }\n\n .", ", .", " {\n position: relative;\n }\n /* Give selected cells a blue overlay */\n .", "::after,\n .", "::after {\n z-index: ", ";\n position: absolute;\n content: '';\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n width: 100%;\n pointer-events: none;\n }\n .", " {\n border: 1px solid ", ";\n }\n .", "::after {\n background: ", ";\n z-index: ", ";\n }\n th.", "::after,\n td.", "::after {\n background: ", ";\n z-index: ", ";\n }\n // ED-15246: Trello card is visible through a border of a table border\n td.", ", td.", " {\n &::after {\n height: 100%;\n width: 100%;\n border: 1px solid ", ";\n content: '';\n position: absolute;\n left: -1px;\n top: -1px;\n bottom: 0;\n z-index: ", ";\n display: inline-block;\n pointer-events: none;\n }\n &.", "::after {\n border: 1px solid ", ";\n z-index: ", ";\n }\n }\n }\n .", " {\n position: absolute;\n /* top of corner control is table margin top - corner control height + 1 pixel of table border. */\n top: ", "px;\n }\n .", ".", " {\n z-index: ", ";\n }\n .", " {\n left: -", "px;\n }\n .", " {\n padding-right: ", "px;\n margin-right: -", "px;\n padding-bottom: ", "px;\n margin-bottom: -", "px;\n /* fixes gap cursor height */\n overflow: auto;\n position: relative;\n }\n }\n\n .ProseMirror.", " {\n .", " {\n overflow-x: auto;\n ", ";\n }\n }\n\n .ProseMirror.", " {\n cursor: col-resize;\n }\n\n /* \n ED-15882: When custom start numbers is enabled for lists, we have\n styles that handle this generally (in editor-common) so we can\n throw away the older table-specific styles here.\n */\n ", "\n"])), _types.TableCssClassName.LAYOUT_BUTTON, "var(--ds-background-neutral, ".concat(_colors.N20A, ")"), "var(--ds-icon, ".concat(_colors.N300, ")"), _types.TableCssClassName.LAYOUT_BUTTON, _types.TableCssClassName.IS_RESIZING, "var(--ds-background-neutral-hovered, ".concat(_colors.B300, ")"), "var(--ds-icon, white)", (0, _styles.tableSharedStyle)(props), (0, _uiStyles.columnControlsLineMarker)(props), _uiStyles.hoveredDeleteButton, _uiStyles.hoveredCell, _uiStyles.hoveredWarningCell, _uiStyles.resizeHandle, rangeSelectionStyles, _types.TableCssClassName.LAST_ITEM_IN_CELL, _types.TableCssClassName.TABLE_NODE_WRAPPER, _types.TableCssClassName.TABLE_CELL, _types.TableCssClassName.TABLE_HEADER_CELL, _types.TableCssClassName.TABLE_CELL, (0, _consts.tableCellBackgroundColor)(props), (0, _consts.tableBorderColor)(props), (0, _consts.tableBorderColor)(props), _types.TableCssClassName.CONTROLS_FLOATING_BUTTON_COLUMN, _uiStyles.insertColumnButtonWrapper, _types.TableCssClassName.CONTROLS_FLOATING_BUTTON_ROW, _uiStyles.insertRowButtonWrapper, _uiStyles.DeleteButton, _types.TableCssClassName.TABLE_STICKY, _types.TableCssClassName.NUMBERED_COLUMN, _types.TableCssClassName.NUMBERED_COLUMN_BUTTON, _consts.stickyRowOffsetTop + 2, _editorSharedStyles.akEditorTableNumberColumnWidth, _editorSharedStyles.akEditorStickyHeaderZIndex, _consts.stickyRowOffsetTop, "var(--ds-surface, white)", _types.TableCssClassName.TABLE_STICKY, _types.TableCssClassName.CORNER_CONTROLS, _editorSharedStyles.akEditorSmallZIndex, "var(--ds-surface, white)", _consts.tableToolbarSize, _consts.tableToolbarSize, _types.TableCssClassName.CORNER_CONTROLS, _types.TableCssClassName.CONTROLS_CORNER_BUTTON, _consts.tableToolbarSize, _consts.tableToolbarSize, _types.TableCssClassName.TABLE_STICKY, _types.TableCssClassName.COLUMN_CONTROLS_DECORATIONS, _types.TableCssClassName.TABLE_STICKY, _types.TableCssClassName.ROW_CONTROLS, _types.TableCssClassName.ROW_CONTROLS_BUTTON_WRAP, _editorSharedStyles.akEditorStickyHeaderZIndex, _consts.tableToolbarSize, "var(--ds-surface, white)", _consts.tableToolbarSize, _types.TableCssClassName.TABLE_STICKY, "var(--ds-surface, green)", _consts.stickyRowOffsetTop, _consts.stickyRowZIndex, "var(--ds-surface, white)", "var(--ds-shadow-overflow, ".concat("0 6px 4px -4px ".concat(_colors.N40A), ")"), _types.TableCssClassName.TABLE_STICKY, _types.TableCssClassName.TABLE_STICKY_SHADOW, _consts.stickyRowZIndex + 1, _types.TableCssClassName.WITH_CONTROLS, _types.TableCssClassName.TABLE_STICKY, _types.TableCssClassName.TABLE_STICKY_SHADOW, _consts.tableToolbarSize, _consts.stickyHeaderBorderBottomWidth, (0, _consts.tableBorderColor)(props), _types.TableCssClassName.TABLE_STICKY, _types.TableCssClassName.TABLE_STICKY, _types.TableCssClassName.TABLE_STICKY, insertColumnButtonOffset + 1, _types.TableCssClassName.TABLE_STICKY, _types.TableCssClassName.TABLE_CONTAINER, _types.TableCssClassName.TABLE_STICKY, _types.TableCssClassName.WITH_RESIZE_LINE, _types.TableCssClassName.WITH_RESIZE_LINE, _types.TableCssClassName.RESIZE_HANDLE_DECORATION, (_consts.resizeHandlerAreaWidth - _consts.resizeLineWidth) / 2 + 1, _types.TableCssClassName.WITH_RESIZE_LINE, _types.TableCssClassName.SELECTED_CELL, _types.TableCssClassName.WITH_RESIZE_LINE, _types.TableCssClassName.SELECTED_CELL, _types.TableCssClassName.RESIZE_HANDLE_DECORATION, (_consts.resizeHandlerAreaWidth - _consts.resizeLineWidth) / 2, _types.TableCssClassName.HOVERED_CELL, _types.TableCssClassName.SELECTED_CELL, _types.TableCssClassName.WITH_CONTROLS, _consts.tableControlsSpacing, _types.TableCssClassName.WITH_CONTROLS, _types.TableCssClassName.TABLE_STICKY, _types.TableCssClassName.NUMBERED_COLUMN, _types.TableCssClassName.NUMBERED_COLUMN_BUTTON, _consts.tableControlsSpacing + 2, _types.TableCssClassName.CORNER_CONTROLS, _consts.tableControlsSpacing - _consts.tableToolbarSize + 2, "var(--ds-surface, white)", (_props$featureFlags = props.featureFlags) !== null && _props$featureFlags !== void 0 && _props$featureFlags.stickyHeadersOptimization ? sentinelStyles : '', (0, _uiStyles.OverflowShadow)(props), _types.TableCssClassName.TABLE_STICKY, _types.TableCssClassName.TABLE_STICKY_SHADOW, _consts.tablePadding, _types.TableCssClassName.ROW_CONTROLS_WRAPPER, _consts.tablePadding, _types.TableCssClassName.TABLE_CONTAINER, _editorSharedStyles.akEditorTableNumberColumnWidth + _consts.tablePadding - 1, _types.TableCssClassName.TABLE_LEFT_SHADOW, _types.TableCssClassName.TABLE_RIGHT_SHADOW, _types.TableCssClassName.NODEVIEW_WRAPPER, _types.TableCssClassName.NODEVIEW_WRAPPER, _types.TableCssClassName.TABLE_CONTAINER, (0, _uiStyles.columnControlsDecoration)(props), _types.TableCssClassName.CORNER_CONTROLS, _consts.tableToolbarSize + 1, cornerControlHeight, _types.TableCssClassName.CORNER_CONTROLS_INSERT_ROW_MARKER, (0, _uiStyles.InsertMarker)(props, "\n left: -11px;\n top: 9px;\n "), _types.TableCssClassName.CORNER_CONTROLS, _types.TableCssClassName.CORNER_CONTROLS_INSERT_ROW_MARKER, _types.TableCssClassName.CONTROLS_CORNER_BUTTON, _consts.tableToolbarSize + 1, _consts.tableToolbarSize + 1, (0, _consts.tableBorderColor)(props), _consts.tableBorderRadiusSize, (0, _consts.tableToolbarColor)(props), _types.TableCssClassName.CONTROLS_CORNER_BUTTON, _consts.tableBorderSelectedColor, "var(--ds-background-selected, ".concat(_consts.tableToolbarSelectedColor, ")"), _types.TableCssClassName.TABLE_CONTAINER, _types.TableCssClassName.CORNER_CONTROLS, _types.TableCssClassName.CONTROLS_CORNER_BUTTON, _editorSharedStyles.akEditorTableToolbarSize + _editorSharedStyles.akEditorTableNumberColumnWidth, _types.TableCssClassName.ROW_CONTROLS, _types.TableCssClassName.CONTROLS_BUTTON, _types.TableCssClassName.IS_RESIZING, _types.TableCssClassName.CONTROLS_CORNER_BUTTON, _consts.tableBorderSelectedColor, "var(--ds-background-selected, ".concat(_consts.tableToolbarSelectedColor, ")"), _types.TableCssClassName.IS_RESIZING, _types.TableCssClassName.CONTROLS_CORNER_BUTTON, _types.TableCssClassName.HOVERED_CELL_IN_DANGER, _consts.tableBorderDeleteColor, "var(--ds-background-danger, ".concat(_consts.tableToolbarDeleteColor, ")"), _types.TableCssClassName.ROW_CONTROLS, _consts.tableToolbarSize, (0, _uiStyles.InsertMarker)(props, "\n bottom: -1px;\n left: -11px;\n "), _types.TableCssClassName.ROW_CONTROLS_INNER, _types.TableCssClassName.ROW_CONTROLS_BUTTON_WRAP, _consts.tableBorderRadiusSize, _types.TableCssClassName.ROW_CONTROLS_BUTTON_WRAP, _types.TableCssClassName.ROW_CONTROLS_BUTTON_WRAP, _types.TableCssClassName.ROW_CONTROLS_BUTTON_WRAP, _types.TableCssClassName.CONTROLS_BUTTON, _editorSharedStyles.akEditorUnitZIndex, (0, _uiStyles.HeaderButton)(props, "\n border-bottom: 1px solid ".concat((0, _consts.tableBorderColor)(props), ";\n border-right: 0px;\n border-radius: 0;\n height: 100%;\n width: ").concat(_consts.tableToolbarSize, "px;\n\n .").concat(_types.TableCssClassName.CONTROLS_BUTTON_OVERLAY, " {\n position: absolute;\n width: 30px;\n height: 50%;\n right: 0;\n bottom: 0;\n }\n .").concat(_types.TableCssClassName.CONTROLS_BUTTON_OVERLAY, ":first-of-type {\n top: 0;\n }\n ")), _types.TableCssClassName.IS_RESIZING, _types.TableCssClassName.ROW_CONTROLS, (0, _uiStyles.HeaderButtonHover)(), (0, _uiStyles.HeaderButtonDanger)(), _types.TableCssClassName.NUMBERED_COLUMN, _editorSharedStyles.akEditorTableToolbarSize - 1, _editorSharedStyles.akEditorTableToolbarSize, _editorSharedStyles.akEditorTableNumberColumnWidth + 1, _types.TableCssClassName.NUMBERED_COLUMN_BUTTON, (0, _consts.tableBorderColor)(props), (0, _editorSharedStyles.relativeFontSizeToBase16)((0, _constants.fontSize)()), (0, _consts.tableToolbarColor)(props), (0, _consts.tableTextColor)(props), (0, _consts.tableBorderColor)(props), (0, _consts.tableBorderColor)(props), _types.TableCssClassName.WITH_CONTROLS, _types.TableCssClassName.CORNER_CONTROLS, _types.TableCssClassName.ROW_CONTROLS, _types.TableCssClassName.NUMBERED_COLUMN, _types.TableCssClassName.NUMBERED_COLUMN_BUTTON, _types.TableCssClassName.NUMBERED_COLUMN_BUTTON, _consts.tableBorderSelectedColor, _consts.tableBorderSelectedColor, "var(--ds-background-selected, ".concat(_consts.tableToolbarSelectedColor, ")"), _editorSharedStyles.akEditorUnitZIndex, "var(--ds-text-selected, ".concat(_colors.N0, ")"), _types.TableCssClassName.IS_RESIZING, _types.TableCssClassName.WITH_CONTROLS, _types.TableCssClassName.NUMBERED_COLUMN_BUTTON, _types.TableCssClassName.NUMBERED_COLUMN_BUTTON, _consts.tableBorderSelectedColor, _consts.tableBorderSelectedColor, "var(--ds-background-selected, ".concat(_consts.tableToolbarSelectedColor, ")"), _editorSharedStyles.akEditorUnitZIndex, "var(--ds-text-selected, ".concat(_colors.N0, ")"), _types.TableCssClassName.NUMBERED_COLUMN_BUTTON, _types.TableCssClassName.HOVERED_CELL_IN_DANGER, "var(--ds-background-danger, ".concat(_consts.tableToolbarDeleteColor, ")"), _consts.tableBorderDeleteColor, "var(--ds-text-danger, ".concat(_colors.R500, ")"), _editorSharedStyles.akEditorUnitZIndex, _types.TableCssClassName.TABLE_NODE_WRAPPER, _types.TableCssClassName.COLUMN_CONTROLS_DECORATIONS, _types.TableCssClassName.TABLE_HEADER_CELL, _types.TableCssClassName.SELECTED_CELL, _types.TableCssClassName.HOVERED_CELL_IN_DANGER, _types.TableCssClassName.SELECTED_CELL, _types.TableCssClassName.HOVERED_CELL_IN_DANGER, _editorSharedStyles.akEditorSmallZIndex, _types.TableCssClassName.SELECTED_CELL, _consts.tableBorderSelectedColor, _types.TableCssClassName.SELECTED_CELL, _consts.tableCellSelectedColor, _editorSharedStyles.akEditorSmallZIndex, _types.TableCssClassName.HOVERED_CELL_IN_DANGER, _types.TableCssClassName.HOVERED_CELL_IN_DANGER, _consts.tableCellDeleteColor, _editorSharedStyles.akEditorUnitZIndex * 100, _types.TableCssClassName.HOVERED_CELL, _types.TableCssClassName.SELECTED_CELL, _consts.tableBorderSelectedColor, _editorSharedStyles.akEditorSmallZIndex, _types.TableCssClassName.HOVERED_CELL_IN_DANGER, _consts.tableBorderDeleteColor, _editorSharedStyles.akEditorUnitZIndex * 100, _types.TableCssClassName.ROW_CONTROLS_WRAPPER, _styles.tableMarginTop - cornerControlHeight + 1, _types.TableCssClassName.ROW_CONTROLS_WRAPPER, _types.TableCssClassName.TABLE_LEFT_SHADOW, _editorSharedStyles.akEditorUnitZIndex, _types.TableCssClassName.ROW_CONTROLS_WRAPPER, _consts.tableToolbarSize, _types.TableCssClassName.TABLE_NODE_WRAPPER, insertColumnButtonOffset, insertColumnButtonOffset, _consts.tableScrollbarOffset, _consts.tableScrollbarOffset, _types.TableCssClassName.IS_RESIZING, _types.TableCssClassName.TABLE_NODE_WRAPPER, _scrollbar.scrollbarStyles, _types.TableCssClassName.RESIZE_CURSOR, props !== null && props !== void 0 && (_props$featureFlags2 = props.featureFlags) !== null && _props$featureFlags2 !== void 0 && _props$featureFlags2.restartNumberedLists ? "" : listLargeNumericMarkersOldStyles);
38
39
  };
39
40
  exports.tableStyles = tableStyles;
40
- var tableFullPageEditorStyles = (0, _react.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n .ProseMirror .", " > table {\n margin-left: 0;\n margin-right: 0;\n width: 100%;\n }\n"])), _types.TableCssClassName.TABLE_NODE_WRAPPER);
41
+ var tableFullPageEditorStyles = (0, _react.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n .ProseMirror .", " > table {\n margin-left: 0;\n // 1px border width offset added here to prevent unwanted overflow and scolling - ED-16212\n margin-right: -1px;\n width: 100%;\n }\n"])), _types.TableCssClassName.TABLE_NODE_WRAPPER);
41
42
  exports.tableFullPageEditorStyles = tableFullPageEditorStyles;
42
43
  var tableCommentEditorStyles = (0, _react.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n .ProseMirror .", " > table {\n margin-left: 0;\n margin-right: 0;\n ", ";\n }\n"])), _types.TableCssClassName.TABLE_NODE_WRAPPER, _scrollbar.scrollbarStyles);
43
44
  exports.tableCommentEditorStyles = tableCommentEditorStyles;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "sideEffects": false
5
5
  }
@@ -21,6 +21,7 @@ import { containsHeaderRow, tablesHaveDifferentColumnWidths, tablesHaveDifferent
21
21
  import { updateOverflowShadows } from './update-overflow-shadows';
22
22
  import memoizeOne from 'memoize-one';
23
23
  import { OverflowShadowsObserver } from './OverflowShadowsObserver';
24
+ import { getParentWidthWithoutPadding } from '../pm-plugins/table-resizing/utils/misc';
24
25
  const isIE11 = browser.ie_version === 11;
25
26
  const NOOP = () => undefined;
26
27
  class TableComponent extends React.Component {
@@ -196,16 +197,24 @@ class TableComponent extends React.Component {
196
197
  }
197
198
  });
198
199
  _defineProperty(this, "handleWindowResize", () => {
200
+ var _node$attrs, _node$attrs2;
199
201
  const {
200
202
  getNode,
201
203
  containerWidth
202
204
  } = this.props;
203
- const layoutSize = this.tableNodeLayoutSize(getNode());
205
+ const node = getNode();
206
+ const prevNode = this.node;
207
+ const layoutSize = this.tableNodeLayoutSize(node);
208
+ const prevAttrs = prevNode === null || prevNode === void 0 ? void 0 : prevNode.attrs;
209
+ const layoutChanged = (prevAttrs === null || prevAttrs === void 0 ? void 0 : prevAttrs.layout) !== (node === null || node === void 0 ? void 0 : (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.layout) && (prevAttrs === null || prevAttrs === void 0 ? void 0 : prevAttrs.__autoSize) === (node === null || node === void 0 ? void 0 : (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.__autoSize);
204
210
  if (containerWidth.width > layoutSize) {
205
211
  return;
206
212
  }
207
213
  const parentWidth = this.getParentNodeWidth();
208
- this.scaleTableDebounced(parentWidth);
214
+ this.scaleTableDebounced({
215
+ layoutChanged: layoutChanged,
216
+ parentWidth: parentWidth
217
+ });
209
218
  });
210
219
  _defineProperty(this, "updateTableContainerWidth", () => {
211
220
  const {
@@ -245,7 +254,8 @@ class TableComponent extends React.Component {
245
254
  if (!isValidPosition(pos, state)) {
246
255
  return;
247
256
  }
248
- return getParentNodeWidth(pos, state, containerWidth, options && options.isFullWidthModeEnabled);
257
+ const parentNodeWith = getParentNodeWidth(pos, state, containerWidth, options && options.isFullWidthModeEnabled);
258
+ return getParentWidthWithoutPadding(parentNodeWith, pos, state);
249
259
  });
250
260
  _defineProperty(this, "updateParentWidth", width => {
251
261
  this.setState({
@@ -10,7 +10,8 @@ export const scaleTable = (tableRef, options, domAtPos) => (state, dispatch) =>
10
10
  const {
11
11
  node,
12
12
  start,
13
- parentWidth
13
+ parentWidth,
14
+ layoutChanged
14
15
  } = options;
15
16
 
16
17
  // If a table has not been resized yet, columns should be auto.
@@ -36,7 +37,11 @@ export const scaleTable = (tableRef, options, domAtPos) => (state, dispatch) =>
36
37
  // TODO: ED-8995
37
38
  // We need to do this check to reduce the number of race conditions when working with tables.
38
39
  // This metadata is been used in the sendTransaction function in the Collab plugin
39
- tr.setMeta('scaleTable', true);
40
+ /* Added !layoutChanged check here to solve unnecessary scroll bar after publish when click on breakout button multiple times and publish
41
+ scaleTable is only called once every time a breakout button is clicked, so it is safe not to add the meta 'scaleTable' to the tr.
42
+ Leaving the tr.setMeta('scaleTable', true) here for race conditions that we aren't aware of.
43
+ */
44
+ !layoutChanged && tr.setMeta('scaleTable', true);
40
45
  dispatch(tr);
41
46
  return true;
42
47
  }
@@ -9,6 +9,7 @@ import { evenColumns, setDragging, stopResizing } from './commands';
9
9
  import { getPluginState } from './plugin-factory';
10
10
  import { currentColWidth, getLayoutSize, getResizeState, pointsAtCell, resizeColumn, updateControls } from './utils';
11
11
  import { ACTION_SUBJECT, EVENT_TYPE, TABLE_ACTION } from '@atlaskit/editor-common/analytics';
12
+ import { getParentWidthWithoutPadding } from './utils/misc';
12
13
  export const handleMouseDown = (view, event, localResizeHandlePos, getEditorContainerWidth, getEditorFeatureFlags, editorAnalyticsAPI) => {
13
14
  const {
14
15
  state,
@@ -31,7 +32,10 @@ export const handleMouseDown = (view, event, localResizeHandlePos, getEditorCont
31
32
  }
32
33
  const containerWidth = getEditorContainerWidth();
33
34
  const parentWidth = getParentNodeWidth(start, state, containerWidth);
34
- let maxSize = parentWidth || getLayoutSize(dom.getAttribute('data-layout'), containerWidth.width, {});
35
+
36
+ // TODO - refactor this logic into getParentNodeWidth() in editor-common [ED-16718]
37
+ const parentActualWidth = getParentWidthWithoutPadding(parentWidth, start, state);
38
+ let maxSize = parentActualWidth || getLayoutSize(dom.getAttribute('data-layout'), containerWidth.width, {});
35
39
  if (originalTable.attrs.isNumberColumnEnabled) {
36
40
  maxSize -= akEditorTableNumberColumnWidth;
37
41
  }
@@ -1,5 +1,6 @@
1
1
  import { DOMSerializer } from 'prosemirror-model';
2
2
  import { getFragmentBackingArray } from '@atlaskit/editor-common/utils';
3
+ import { tableCellMinWidth } from '@atlaskit/editor-common/styles';
3
4
  export const generateColgroup = table => {
4
5
  const cols = [];
5
6
  table.content.firstChild.content.forEach(cell => {
@@ -35,6 +36,20 @@ export const insertColgroupFromNode = (tableRef, table) => {
35
36
  export const hasTableBeenResized = table => {
36
37
  return !!getFragmentBackingArray(table.content.firstChild.content).find(cell => cell.attrs.colwidth);
37
38
  };
39
+
40
+ /**
41
+ * Check if a table has all the column width set to tableCellMinWidth(48px) or null
42
+ *
43
+ * @param table
44
+ * @returns true if all column width is equal to tableCellMinWidth or null, false otherwise
45
+ */
46
+ export const isMinCellWidthTable = table => {
47
+ const cellArray = getFragmentBackingArray(table.content.firstChild.content);
48
+ const isTableMinCellWidth = cellArray.every(cell => {
49
+ return cell.attrs.colwidth && cell.attrs.colwidth[0] === tableCellMinWidth || cell.attrs.colwidth === null;
50
+ });
51
+ return isTableMinCellWidth;
52
+ };
38
53
  function renderColgroupFromNode(table) {
39
54
  const rendered = DOMSerializer.renderSpec(document, ['colgroup', {}, ...generateColgroup(table)]);
40
55
  return rendered.dom;