@atlaskit/editor-plugin-table 9.3.1 → 9.3.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 (48) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/cjs/nodeviews/TableComponent.js +1 -3
  3. package/dist/cjs/nodeviews/TableRow.js +1 -6
  4. package/dist/cjs/nodeviews/toDOM.js +4 -16
  5. package/dist/cjs/pm-plugins/table-resizing/event-handlers.js +9 -4
  6. package/dist/cjs/pm-plugins/table-resizing/utils/scale-table.js +6 -0
  7. package/dist/cjs/pm-plugins/utils/paste.js +3 -3
  8. package/dist/cjs/ui/FloatingContextualButton/FixedButton.js +1 -5
  9. package/dist/cjs/ui/TableFloatingColumnControls/ColumnControls/index.js +1 -1
  10. package/dist/cjs/ui/TableFloatingColumnControls/index.js +2 -6
  11. package/dist/cjs/ui/TableFloatingControls/CornerControls/ClassicCornerControls.js +1 -2
  12. package/dist/cjs/ui/TableFloatingControls/NumberColumn/index.js +1 -2
  13. package/dist/cjs/ui/TableFloatingControls/RowControls/ClassicControls.js +1 -4
  14. package/dist/es2019/nodeviews/TableComponent.js +2 -2
  15. package/dist/es2019/nodeviews/TableRow.js +1 -6
  16. package/dist/es2019/nodeviews/toDOM.js +3 -16
  17. package/dist/es2019/pm-plugins/table-resizing/event-handlers.js +9 -4
  18. package/dist/es2019/pm-plugins/table-resizing/utils/scale-table.js +6 -0
  19. package/dist/es2019/ui/FloatingContextualButton/FixedButton.js +1 -5
  20. package/dist/es2019/ui/TableFloatingColumnControls/ColumnControls/index.js +1 -1
  21. package/dist/es2019/ui/TableFloatingColumnControls/index.js +2 -7
  22. package/dist/es2019/ui/TableFloatingControls/CornerControls/ClassicCornerControls.js +1 -2
  23. package/dist/es2019/ui/TableFloatingControls/NumberColumn/index.js +1 -2
  24. package/dist/es2019/ui/TableFloatingControls/RowControls/ClassicControls.js +1 -5
  25. package/dist/esm/nodeviews/TableComponent.js +1 -3
  26. package/dist/esm/nodeviews/TableRow.js +1 -6
  27. package/dist/esm/nodeviews/toDOM.js +4 -16
  28. package/dist/esm/pm-plugins/table-resizing/event-handlers.js +9 -4
  29. package/dist/esm/pm-plugins/table-resizing/utils/scale-table.js +6 -0
  30. package/dist/esm/pm-plugins/utils/paste.js +3 -3
  31. package/dist/esm/ui/FloatingContextualButton/FixedButton.js +1 -5
  32. package/dist/esm/ui/TableFloatingColumnControls/ColumnControls/index.js +1 -1
  33. package/dist/esm/ui/TableFloatingColumnControls/index.js +2 -6
  34. package/dist/esm/ui/TableFloatingControls/CornerControls/ClassicCornerControls.js +1 -2
  35. package/dist/esm/ui/TableFloatingControls/NumberColumn/index.js +1 -2
  36. package/dist/esm/ui/TableFloatingControls/RowControls/ClassicControls.js +1 -4
  37. package/package.json +7 -7
  38. package/src/nodeviews/TableComponent.tsx +1 -3
  39. package/src/nodeviews/TableRow.ts +1 -7
  40. package/src/nodeviews/toDOM.ts +12 -31
  41. package/src/pm-plugins/table-resizing/event-handlers.ts +13 -4
  42. package/src/pm-plugins/table-resizing/utils/scale-table.ts +6 -0
  43. package/src/ui/FloatingContextualButton/FixedButton.tsx +1 -6
  44. package/src/ui/TableFloatingColumnControls/ColumnControls/index.tsx +1 -1
  45. package/src/ui/TableFloatingColumnControls/index.tsx +1 -9
  46. package/src/ui/TableFloatingControls/CornerControls/ClassicCornerControls.tsx +1 -8
  47. package/src/ui/TableFloatingControls/NumberColumn/index.tsx +1 -2
  48. package/src/ui/TableFloatingControls/RowControls/ClassicControls.tsx +1 -10
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @atlaskit/editor-plugin-table
2
2
 
3
+ ## 9.3.3
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 9.3.2
10
+
11
+ ### Patch Changes
12
+
13
+ - [#108797](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/108797)
14
+ [`9a3f165bc940b`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/9a3f165bc940b) -
15
+ tidy up feature flag confluence_frontend_editor_custom_presets
16
+ - Updated dependencies
17
+
3
18
  ## 9.3.1
4
19
 
5
20
  ### Patch Changes
@@ -813,8 +813,6 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
813
813
  key: "render",
814
814
  value: function render() {
815
815
  var _this5 = this,
816
- _this$state$stickyHea2,
817
- _this$state$stickyHea3,
818
816
  _this$props$options10;
819
817
  var _this$props12 = this.props,
820
818
  view = _this$props12.view,
@@ -931,7 +929,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
931
929
  }
932
930
  var isNested = (0, _nodes.isTableNested)(view.state, tablePos);
933
931
  var topShadowPadding = isDragAndDropEnabled ? 0 : shadowPadding;
934
- var topOffset = (0, _platformFeatureFlags.fg)('platform_editor_breakout_use_css') ? 0 : (_this$state$stickyHea2 = (_this$state$stickyHea3 = this.state.stickyHeader) === null || _this$state$stickyHea3 === void 0 ? void 0 : _this$state$stickyHea3.top) !== null && _this$state$stickyHea2 !== void 0 ? _this$state$stickyHea2 : 0;
932
+ var topOffset = 0;
935
933
  var topStickyShadowPosition = this.state.stickyHeader && topOffset + this.state.stickyHeader.padding + topShadowPadding + 2;
936
934
  var _getEditorFeatureFlag7 = getEditorFeatureFlags(),
937
935
  _getEditorFeatureFlag8 = _getEditorFeatureFlag7.tableWithFixedColumnWidthsOption,
@@ -14,7 +14,6 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
14
14
  var _debounce = _interopRequireDefault(require("lodash/debounce"));
15
15
  var _throttle = _interopRequireDefault(require("lodash/throttle"));
16
16
  var _ui = require("@atlaskit/editor-common/ui");
17
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
18
17
  var _pluginFactory = require("../pm-plugins/plugin-factory");
19
18
  var _pluginKey = require("../pm-plugins/plugin-key");
20
19
  var _commands = require("../pm-plugins/sticky-headers/commands");
@@ -543,11 +542,7 @@ var TableRow = exports.default = /*#__PURE__*/function (_TableNodeView) {
543
542
  _this6.refireIntersectionObservers();
544
543
  }, fastScrollThresholdMs);
545
544
  }
546
- if ((0, _platformFeatureFlags.fg)('platform_editor_breakout_use_css')) {
547
- this.dom.style.top = "0px";
548
- } else {
549
- this.dom.style.top = "".concat(domTop, "px");
550
- }
545
+ this.dom.style.top = "0px";
551
546
  (0, _dom.updateStickyMargins)(table);
552
547
  this.dom.scrollLeft = wrapper.scrollLeft;
553
548
  this.emitOn(domTop, this.colControlsOffset);
@@ -12,7 +12,6 @@ var _kebabCase = _interopRequireDefault(require("lodash/kebabCase"));
12
12
  var _adfSchema = require("@atlaskit/adf-schema");
13
13
  var _lazyNodeView = require("@atlaskit/editor-common/lazy-node-view");
14
14
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
15
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
16
15
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
17
16
  var _colgroup = require("../pm-plugins/table-resizing/utils/colgroup");
18
17
  var _consts = require("../pm-plugins/table-resizing/utils/consts");
@@ -27,7 +26,6 @@ var tableNodeSpecWithFixedToDOM = exports.tableNodeSpecWithFixedToDOM = function
27
26
  return _objectSpread(_objectSpread({}, tableNode), {}, {
28
27
  toDOM: function toDOM(node) {
29
28
  var gutterPadding = (0, _editorSharedStyles.akEditorGutterPaddingDynamic)() * 2;
30
- var editorWidthFromGetter = (0, _platformFeatureFlags.fg)('platform_editor_breakout_use_css') ? undefined : Math.min(config.getEditorContainerWidth().width - gutterPadding, node.attrs.width);
31
29
  var alignmentStyle = Object.entries((0, _tableContainerStyles.getAlignmentStyle)(node.attrs.layout)).map(function (_ref) {
32
30
  var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
33
31
  k = _ref2[0],
@@ -35,15 +33,13 @@ var tableNodeSpecWithFixedToDOM = exports.tableNodeSpecWithFixedToDOM = function
35
33
  return "".concat((0, _kebabCase.default)(k), ": ").concat((0, _kebabCase.default)(v));
36
34
  }).join(';');
37
35
  var tableMinWidth = (0, _colgroup.getResizerMinWidth)(node);
38
- var attrs = _objectSpread({
36
+ var attrs = {
39
37
  'data-number-column': node.attrs.isNumberColumnEnabled,
40
38
  'data-layout': node.attrs.layout,
41
39
  'data-autosize': node.attrs.__autoSize,
42
40
  'data-table-local-id': node.attrs.localId,
43
41
  'data-table-width': node.attrs.width
44
- }, (0, _platformFeatureFlags.fg)('platform_editor_breakout_use_css') ? {} : {
45
- style: "width: ".concat(node.attrs.width, "px;")
46
- });
42
+ };
47
43
  var colgroup = '';
48
44
  if (config.allowColumnResizing) {
49
45
  colgroup = ['colgroup', {}].concat((0, _toConsumableArray2.default)((0, _colgroup.generateColgroup)(node)));
@@ -84,10 +80,10 @@ var tableNodeSpecWithFixedToDOM = exports.tableNodeSpecWithFixedToDOM = function
84
80
  style: alignmentStyle
85
81
  }, ['div', {
86
82
  class: 'pm-table-resizer-container',
87
- style: (0, _platformFeatureFlags.fg)('platform_editor_breakout_use_css') ? "width: min(calc(100cqw - ".concat(gutterPadding, "px), ").concat(node.attrs.width, "px);") : "width: ".concat(node.attrs.width, "px")
83
+ style: "width: min(calc(100cqw - ".concat(gutterPadding, "px), ").concat(node.attrs.width, "px);")
88
84
  }, ['div', {
89
85
  class: 'resizer-item display-handle',
90
- style: (0, _platformFeatureFlags.fg)('platform_editor_breakout_use_css') ? (0, _lazyNodeView.convertToInlineCss)({
86
+ style: (0, _lazyNodeView.convertToInlineCss)({
91
87
  position: 'relative',
92
88
  userSelect: 'auto',
93
89
  boxSizing: 'border-box',
@@ -97,14 +93,6 @@ var tableNodeSpecWithFixedToDOM = exports.tableNodeSpecWithFixedToDOM = function
97
93
  minWidth: 'var(--ak-editor-table-min-width)',
98
94
  maxWidth: "min(calc(100cqw - var(--ak-editor-table-gutter-padding)), var(--ak-editor-table-max-width))",
99
95
  width: "min(calc(100cqw - var(--ak-editor-table-gutter-padding)), ".concat(node.attrs.width, ")")
100
- }) : (0, _lazyNodeView.convertToInlineCss)({
101
- position: 'relative',
102
- userSelect: 'auto',
103
- boxSizing: 'border-box',
104
- height: 'auto',
105
- minWidth: "".concat(tableMinWidth, "px"),
106
- maxWidth: "".concat(editorWidthFromGetter, "px"),
107
- width: "".concat(editorWidthFromGetter, "px;")
108
96
  })
109
97
  }, ['span', {
110
98
  class: 'resizer-hover-zone'
@@ -8,11 +8,13 @@ var _analytics = require("@atlaskit/editor-common/analytics");
8
8
  var _styles = require("@atlaskit/editor-common/styles");
9
9
  var _tableMap = require("@atlaskit/editor-tables/table-map");
10
10
  var _utils = require("@atlaskit/editor-tables/utils");
11
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
11
12
  var _columnResize = require("../commands/column-resize");
12
13
  var _misc = require("../commands/misc");
13
14
  var _pluginFactory = require("../plugin-factory");
14
15
  var _tableAnalytics = require("../table-analytics");
15
16
  var _columnWidth = require("../transforms/column-width");
17
+ var _nodes = require("../utils/nodes");
16
18
  var _selection = require("../utils/selection");
17
19
  var _commands = require("./commands");
18
20
  var _pluginFactory2 = require("./plugin-factory");
@@ -153,10 +155,13 @@ var handleMouseDown = exports.handleMouseDown = function handleMouseDown(view, e
153
155
  if (dragging) {
154
156
  var startX = dragging.startX;
155
157
 
156
- // If the table has changed (via collab for example) don't apply column widths
157
- // For example, if a table col is deleted we won't be able to reliably remap the new widths
158
- // There may be a more elegant solution to this, to avoid a jarring experience.
159
- if (table.eq(originalTable)) {
158
+ // If the dimensions of the table have changed through a remote modification by another
159
+ // person for example don't persist the new column widths as we couldn't reliably remap them
160
+ // For example, if a table col is deleted
161
+ // There may be a more elegant solution to this, to avoid a jarring experience. This used to
162
+ // be an equality check but that caused issues when a nested table would change (eg. when it
163
+ // dynamically updates its width on resize)
164
+ if ((0, _platformFeatureFlags.fg)('platform_editor_nested_tables_resizing') ? !(0, _nodes.tablesHaveDifferentNoOfColumns)(originalTable, table) : table.eq(originalTable)) {
160
165
  var _table$attrs;
161
166
  var map = _tableMap.TableMap.get(table);
162
167
  var colIndex = map.colCount($cell.pos - start) + ($cell.nodeAfter ? $cell.nodeAfter.attrs.colspan : 1) - 1;
@@ -10,6 +10,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
10
10
  var _nodeWidth = require("@atlaskit/editor-common/node-width");
11
11
  var _styles = require("@atlaskit/editor-common/styles");
12
12
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
13
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
13
14
  var _columnWidth = require("../../transforms/column-width");
14
15
  var _nodes = require("../../utils/nodes");
15
16
  var _misc = require("../utils/misc");
@@ -177,6 +178,11 @@ var scaleTable = exports.scaleTable = function scaleTable(tableRef, options, dom
177
178
  }
178
179
  if (resizeState) {
179
180
  tr = (0, _columnWidth.updateColumnWidths)(resizeState, node, start, api)(tr);
181
+ if ((0, _platformFeatureFlags.fg)('platform_editor_nested_tables_resizing')) {
182
+ // Avoid adding this transaction separately to the history as these are automatic updates
183
+ // as a consequence of another action
184
+ tr.setMeta('addToHistory', false);
185
+ }
180
186
  if (tr.docChanged) {
181
187
  tr.setMeta('scrollIntoView', false);
182
188
  // TODO: ED-8995
@@ -44,7 +44,7 @@ var unwrapContentFromTable = exports.unwrapContentFromTable = function unwrapCon
44
44
  // Flattens nested tables after a given nesting depth
45
45
  // If this looks familiar, it's a heavily modified version of `mapFragment` which has been
46
46
  // adjusted to support tracking nesting depth. This wasn't possible by using `mapFragment` directly
47
- var unwrapNestedTables = function unwrapNestedTables(content, schema, unwrapNestDepth) {
47
+ var _unwrapNestedTables = function unwrapNestedTables(content, schema, unwrapNestDepth) {
48
48
  var currentNestDepth = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
49
49
  var flattenNested = function flattenNested(node, tableDepth) {
50
50
  if (node.type === schema.nodes.table) {
@@ -58,7 +58,7 @@ var unwrapNestedTables = function unwrapNestedTables(content, schema, unwrapNest
58
58
  var children = [];
59
59
  for (var i = 0, size = content.childCount; i < size; i++) {
60
60
  var node = content.child(i);
61
- var transformed = node.isLeaf ? flattenNested(node, currentNestDepth) : flattenNested(node.copy(_model.Fragment.fromArray(unwrapNestedTables(node.content, schema, unwrapNestDepth, node.type === schema.nodes.table ? currentNestDepth + 1 : currentNestDepth))), currentNestDepth);
61
+ var transformed = node.isLeaf ? flattenNested(node, currentNestDepth) : flattenNested(node.copy(_model.Fragment.fromArray(_unwrapNestedTables(node.content, schema, unwrapNestDepth, node.type === schema.nodes.table ? currentNestDepth + 1 : currentNestDepth))), currentNestDepth);
62
62
  if (transformed) {
63
63
  if (Array.isArray(transformed)) {
64
64
  children.push.apply(children, (0, _toConsumableArray2.default)(transformed));
@@ -141,7 +141,7 @@ var transformSliceToRemoveNestedTables = exports.transformSliceToRemoveNestedTab
141
141
  }
142
142
 
143
143
  // after we've worked out what the allowed nesting depth is, unwrap nested tables
144
- var newChildren = unwrapNestedTables(node.content, schema, allowedTableNesting);
144
+ var newChildren = _unwrapNestedTables(node.content, schema, allowedTableNesting);
145
145
  return node.copy(_model.Fragment.fromArray(newChildren));
146
146
  });
147
147
  return new _model.Slice(newFragment, slice.openStart, openEnd);
@@ -10,7 +10,6 @@ var _react = _interopRequireWildcard(require("react"));
10
10
  var _rafSchd = _interopRequireDefault(require("raf-schd"));
11
11
  var _reactDom = require("react-dom");
12
12
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
13
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
14
13
  var _types = require("../../types");
15
14
  var _commonStyles = require("../common-styles");
16
15
  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); }
@@ -93,11 +92,8 @@ var FixedButton = exports.FixedButton = function FixedButton(_ref2) {
93
92
  };
94
93
  }
95
94
  }, [fixedButtonRef, observerTargetRef, tableWrapper, targetCellPosition, targetCellRef, isContextualMenuOpen]);
96
- var fixedButtonTop = (0, _platformFeatureFlags.fg)('platform_editor_breakout_use_css') ? 0 : stickyHeader.top;
95
+ var fixedButtonTop = 0;
97
96
  var containerLeft = (0, _react.useMemo)(function () {
98
- if (!(0, _platformFeatureFlags.fg)('platform_editor_breakout_use_css')) {
99
- return 0;
100
- }
101
97
  var container = targetCellRef.closest('[data-editor-container="true"]');
102
98
  return (container === null || container === void 0 ? void 0 : container.getBoundingClientRect().left) || 0;
103
99
  }, [targetCellRef]);
@@ -65,7 +65,7 @@ var ColumnControls = exports.ColumnControls = function ColumnControls(_ref) {
65
65
  var selectedColIndexes = getSelectedColumns((selectionState === null || selectionState === void 0 ? void 0 : selectionState.selection) || editorView.state.selection);
66
66
  var firstRow = tableRef.querySelector('tr');
67
67
  var hasHeaderRow = firstRow ? firstRow.getAttribute('data-header-row') : false;
68
- var rowControlStickyTop = (0, _platformFeatureFlags.fg)('platform_editor_breakout_use_css') ? 45 : rowHeights === null || rowHeights === void 0 ? void 0 : rowHeights[0];
68
+ var rowControlStickyTop = 45;
69
69
  var marginTop = hasHeaderRow && stickyTop !== undefined ? rowControlStickyTop !== null && rowControlStickyTop !== void 0 ? rowControlStickyTop : 0 : 0;
70
70
  var handleClick = (0, _react.useCallback)(function (event) {
71
71
  var state = editorView.state,
@@ -75,13 +75,9 @@ var TableFloatingColumnControls = function TableFloatingColumnControls(_ref) {
75
75
  }
76
76
  var colWidths = (0, _columnControls.getColumnsWidths)(editorView);
77
77
  if (stickyTop) {
78
- var _rowHeights$, _containerRef$current;
78
+ var _containerRef$current;
79
79
  var columnControlTopOffsetFromParent = '-12px';
80
- var headerRowHeight = hasHeaderRow && stickyTop !== undefined ? (_rowHeights$ = rowHeights === null || rowHeights === void 0 ? void 0 : rowHeights[0]) !== null && _rowHeights$ !== void 0 ? _rowHeights$ : 0 : 0;
81
- containerRef === null || containerRef === void 0 || (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 || _containerRef$current.style.setProperty('top', (0, _platformFeatureFlags.fg)('platform_editor_breakout_use_css') ? columnControlTopOffsetFromParent : // Ignored via go/ees005
82
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
83
- "".concat(stickyTop - headerRowHeight + 33, "px") // 33px is padding and margin applied on tr.sticky
84
- );
80
+ containerRef === null || containerRef === void 0 || (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 || _containerRef$current.style.setProperty('top', columnControlTopOffsetFromParent);
85
81
  } else {
86
82
  var _containerRef$current2;
87
83
  containerRef === null || containerRef === void 0 || (_containerRef$current2 = containerRef.current) === null || _containerRef$current2 === void 0 || _containerRef$current2.style.removeProperty('top');
@@ -18,7 +18,6 @@ var _reactIntlNext = require("react-intl-next");
18
18
  var _messages = require("@atlaskit/editor-common/messages");
19
19
  var _tableMap = require("@atlaskit/editor-tables/table-map");
20
20
  var _utils = require("@atlaskit/editor-tables/utils");
21
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
22
21
  var _commands = require("../../../pm-plugins/commands");
23
22
  var _types = require("../../../types");
24
23
  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); }
@@ -89,7 +88,7 @@ var CornerControlComponent = /*#__PURE__*/function (_Component) {
89
88
  }),
90
89
  style: {
91
90
  // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
92
- top: (0, _platformFeatureFlags.fg)('platform_editor_breakout_use_css') ? this.props.stickyTop !== undefined ? "0px" : undefined : this.props.stickyTop !== undefined ? "".concat(this.props.stickyTop, "px") : undefined
91
+ top: this.props.stickyTop !== undefined ? "0px" : undefined
93
92
  },
94
93
  contentEditable: false
95
94
  }, /*#__PURE__*/_react.default.createElement("button", {
@@ -16,7 +16,6 @@ var _react = _interopRequireWildcard(require("react"));
16
16
  var _classnames2 = _interopRequireDefault(require("classnames"));
17
17
  var _state = require("@atlaskit/editor-prosemirror/state");
18
18
  var _utils = require("@atlaskit/editor-tables/utils");
19
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
20
19
  var _commands = require("../../../pm-plugins/commands");
21
20
  var _rowControls = require("../../../pm-plugins/utils/row-controls");
22
21
  var _types = require("../../../types");
@@ -76,7 +75,7 @@ var NumberColumn = exports.default = /*#__PURE__*/function (_Component) {
76
75
  stickyTop = _this$props3.stickyTop,
77
76
  hasHeaderRow = _this$props3.hasHeaderRow;
78
77
  if (stickyTop && hasHeaderRow && index === 0) {
79
- var topOffset = (0, _platformFeatureFlags.fg)('platform_editor_breakout_use_css') ? 0 : stickyTop;
78
+ var topOffset = 0;
80
79
  return {
81
80
  height: rowHeight,
82
81
  top: "".concat(topOffset, "px")
@@ -15,7 +15,6 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
15
15
  var _react = _interopRequireWildcard(require("react"));
16
16
  var _reactIntlNext = require("react-intl-next");
17
17
  var _messages = require("@atlaskit/editor-common/messages");
18
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
19
18
  var _commands = require("../../../pm-plugins/commands");
20
19
  var _rowControls = require("../../../pm-plugins/utils/row-controls");
21
20
  var _types = require("../../../types");
@@ -90,9 +89,7 @@ var RowControlsComponent = /*#__PURE__*/function (_Component) {
90
89
  // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
91
90
  marginTop: "".concat(marginTop, "px"),
92
91
  // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
93
- top: (0, _platformFeatureFlags.fg)('platform_editor_breakout_use_css') ? thisRowSticky ? "3px" : undefined : thisRowSticky ? // Ignored via go/ees005
94
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
95
- "".concat(_this2.props.stickyTop + 3, "px") : undefined,
92
+ top: thisRowSticky ? "3px" : undefined,
96
93
  // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
97
94
  paddingTop: thisRowSticky ? "".concat(_consts.tableControlsSpacing, "px") : undefined
98
95
  }
@@ -782,7 +782,7 @@ class TableComponent extends React.Component {
782
782
  }
783
783
  }
784
784
  render() {
785
- var _this$state$stickyHea2, _this$state$stickyHea3, _this$props$options12;
785
+ var _this$props$options12;
786
786
  const {
787
787
  view,
788
788
  getNode,
@@ -899,7 +899,7 @@ class TableComponent extends React.Component {
899
899
  }
900
900
  const isNested = isTableNested(view.state, tablePos);
901
901
  const topShadowPadding = isDragAndDropEnabled ? 0 : shadowPadding;
902
- const topOffset = fg('platform_editor_breakout_use_css') ? 0 : (_this$state$stickyHea2 = (_this$state$stickyHea3 = this.state.stickyHeader) === null || _this$state$stickyHea3 === void 0 ? void 0 : _this$state$stickyHea3.top) !== null && _this$state$stickyHea2 !== void 0 ? _this$state$stickyHea2 : 0;
902
+ const topOffset = 0;
903
903
  const topStickyShadowPosition = this.state.stickyHeader && topOffset + this.state.stickyHeader.padding + topShadowPadding + 2;
904
904
  const {
905
905
  tableWithFixedColumnWidthsOption = false
@@ -2,7 +2,6 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import debounce from 'lodash/debounce';
3
3
  import throttle from 'lodash/throttle';
4
4
  import { findOverflowScrollParent } from '@atlaskit/editor-common/ui';
5
- import { fg } from '@atlaskit/platform-feature-flags';
6
5
  import { getPluginState } from '../pm-plugins/plugin-factory';
7
6
  import { pluginKey as tablePluginKey } from '../pm-plugins/plugin-key';
8
7
  import { updateStickyState } from '../pm-plugins/sticky-headers/commands';
@@ -505,11 +504,7 @@ export default class TableRow extends TableNodeView {
505
504
  this.refireIntersectionObservers();
506
505
  }, fastScrollThresholdMs);
507
506
  }
508
- if (fg('platform_editor_breakout_use_css')) {
509
- this.dom.style.top = `0px`;
510
- } else {
511
- this.dom.style.top = `${domTop}px`;
512
- }
507
+ this.dom.style.top = `0px`;
513
508
  updateTableMargin(table);
514
509
  this.dom.scrollLeft = wrapper.scrollLeft;
515
510
  this.emitOn(domTop, this.colControlsOffset);
@@ -2,7 +2,6 @@ import kebabCase from 'lodash/kebabCase';
2
2
  import { table, tableWithNestedTable } from '@atlaskit/adf-schema';
3
3
  import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
4
4
  import { akEditorGutterPaddingDynamic } from '@atlaskit/editor-shared-styles';
5
- import { fg } from '@atlaskit/platform-feature-flags';
6
5
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
7
6
  import { generateColgroup, getResizerMinWidth } from '../pm-plugins/table-resizing/utils/colgroup';
8
7
  import { TABLE_MAX_WIDTH } from '../pm-plugins/table-resizing/utils/consts';
@@ -16,7 +15,6 @@ export const tableNodeSpecWithFixedToDOM = config => {
16
15
  ...tableNode,
17
16
  toDOM: node => {
18
17
  const gutterPadding = akEditorGutterPaddingDynamic() * 2;
19
- const editorWidthFromGetter = fg('platform_editor_breakout_use_css') ? undefined : Math.min(config.getEditorContainerWidth().width - gutterPadding, node.attrs.width);
20
18
  const alignmentStyle = Object.entries(getAlignmentStyle(node.attrs.layout)).map(([k, v]) => `${kebabCase(k)}: ${kebabCase(v)}`).join(';');
21
19
  const tableMinWidth = getResizerMinWidth(node);
22
20
  const attrs = {
@@ -24,10 +22,7 @@ export const tableNodeSpecWithFixedToDOM = config => {
24
22
  'data-layout': node.attrs.layout,
25
23
  'data-autosize': node.attrs.__autoSize,
26
24
  'data-table-local-id': node.attrs.localId,
27
- 'data-table-width': node.attrs.width,
28
- ...(fg('platform_editor_breakout_use_css') ? {} : {
29
- style: `width: ${node.attrs.width}px;`
30
- })
25
+ 'data-table-width': node.attrs.width
31
26
  };
32
27
  let colgroup = '';
33
28
  if (config.allowColumnResizing) {
@@ -69,10 +64,10 @@ export const tableNodeSpecWithFixedToDOM = config => {
69
64
  style: alignmentStyle
70
65
  }, ['div', {
71
66
  class: 'pm-table-resizer-container',
72
- style: fg('platform_editor_breakout_use_css') ? `width: min(calc(100cqw - ${gutterPadding}px), ${node.attrs.width}px);` : `width: ${node.attrs.width}px`
67
+ style: `width: min(calc(100cqw - ${gutterPadding}px), ${node.attrs.width}px);`
73
68
  }, ['div', {
74
69
  class: 'resizer-item display-handle',
75
- style: fg('platform_editor_breakout_use_css') ? convertToInlineCss({
70
+ style: convertToInlineCss({
76
71
  position: 'relative',
77
72
  userSelect: 'auto',
78
73
  boxSizing: 'border-box',
@@ -82,14 +77,6 @@ export const tableNodeSpecWithFixedToDOM = config => {
82
77
  minWidth: 'var(--ak-editor-table-min-width)',
83
78
  maxWidth: `min(calc(100cqw - var(--ak-editor-table-gutter-padding)), var(--ak-editor-table-max-width))`,
84
79
  width: `min(calc(100cqw - var(--ak-editor-table-gutter-padding)), ${node.attrs.width})`
85
- }) : convertToInlineCss({
86
- position: 'relative',
87
- userSelect: 'auto',
88
- boxSizing: 'border-box',
89
- height: 'auto',
90
- minWidth: `${tableMinWidth}px`,
91
- maxWidth: `${editorWidthFromGetter}px`,
92
- width: `${editorWidthFromGetter}px;`
93
80
  })
94
81
  }, ['span', {
95
82
  class: 'resizer-hover-zone'
@@ -2,11 +2,13 @@ import { ACTION_SUBJECT, EVENT_TYPE, INPUT_METHOD, TABLE_ACTION, TABLE_OVERFLOW_
2
2
  import { tableCellMinWidth } from '@atlaskit/editor-common/styles';
3
3
  import { TableMap } from '@atlaskit/editor-tables/table-map';
4
4
  import { getSelectionRect } from '@atlaskit/editor-tables/utils';
5
+ import { fg } from '@atlaskit/platform-feature-flags';
5
6
  import { stopKeyboardColumnResizing } from '../commands/column-resize';
6
7
  import { updateResizeHandleDecorations } from '../commands/misc';
7
8
  import { getPluginState as getTablePluginState } from '../plugin-factory';
8
9
  import { META_KEYS } from '../table-analytics';
9
10
  import { updateColumnWidths } from '../transforms/column-width';
11
+ import { tablesHaveDifferentNoOfColumns } from '../utils/nodes';
10
12
  import { getSelectedColumnIndexes } from '../utils/selection';
11
13
  import { evenColumns, setDragging, stopResizing } from './commands';
12
14
  import { getPluginState } from './plugin-factory';
@@ -161,10 +163,13 @@ export const handleMouseDown = (view, event, localResizeHandlePos, getEditorCont
161
163
  startX
162
164
  } = dragging;
163
165
 
164
- // If the table has changed (via collab for example) don't apply column widths
165
- // For example, if a table col is deleted we won't be able to reliably remap the new widths
166
- // There may be a more elegant solution to this, to avoid a jarring experience.
167
- if (table.eq(originalTable)) {
166
+ // If the dimensions of the table have changed through a remote modification by another
167
+ // person for example don't persist the new column widths as we couldn't reliably remap them
168
+ // For example, if a table col is deleted
169
+ // There may be a more elegant solution to this, to avoid a jarring experience. This used to
170
+ // be an equality check but that caused issues when a nested table would change (eg. when it
171
+ // dynamically updates its width on resize)
172
+ if (fg('platform_editor_nested_tables_resizing') ? !tablesHaveDifferentNoOfColumns(originalTable, table) : table.eq(originalTable)) {
168
173
  var _table$attrs;
169
174
  const map = TableMap.get(table);
170
175
  const colIndex = map.colCount($cell.pos - start) + ($cell.nodeAfter ? $cell.nodeAfter.attrs.colspan : 1) - 1;
@@ -1,6 +1,7 @@
1
1
  import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
2
2
  import { tableCellMinWidth } from '@atlaskit/editor-common/styles';
3
3
  import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
4
+ import { fg } from '@atlaskit/platform-feature-flags';
4
5
  import { updateColumnWidths } from '../../transforms/column-width';
5
6
  import { getTableWidth } from '../../utils/nodes';
6
7
  import { getLayoutSize } from '../utils/misc';
@@ -163,6 +164,11 @@ export const scaleTable = (tableRef, options, domAtPos, api, isTableScalingEnabl
163
164
  }
164
165
  if (resizeState) {
165
166
  tr = updateColumnWidths(resizeState, node, start, api)(tr);
167
+ if (fg('platform_editor_nested_tables_resizing')) {
168
+ // Avoid adding this transaction separately to the history as these are automatic updates
169
+ // as a consequence of another action
170
+ tr.setMeta('addToHistory', false);
171
+ }
166
172
  if (tr.docChanged) {
167
173
  tr.setMeta('scrollIntoView', false);
168
174
  // TODO: ED-8995
@@ -2,7 +2,6 @@ import React, { useEffect, useMemo, useRef } from 'react';
2
2
  import rafSchedule from 'raf-schd';
3
3
  import { createPortal } from 'react-dom';
4
4
  import { akEditorTableCellOnStickyHeaderZIndex } from '@atlaskit/editor-shared-styles';
5
- import { fg } from '@atlaskit/platform-feature-flags';
6
5
  import { TableCssClassName as ClassName } from '../../types';
7
6
  import { insertColumnButtonOffset } from '../common-styles';
8
7
  const BUTTON_WIDTH = 20;
@@ -85,11 +84,8 @@ export const FixedButton = ({
85
84
  };
86
85
  }
87
86
  }, [fixedButtonRef, observerTargetRef, tableWrapper, targetCellPosition, targetCellRef, isContextualMenuOpen]);
88
- const fixedButtonTop = fg('platform_editor_breakout_use_css') ? 0 : stickyHeader.top;
87
+ const fixedButtonTop = 0;
89
88
  const containerLeft = useMemo(() => {
90
- if (!fg('platform_editor_breakout_use_css')) {
91
- return 0;
92
- }
93
89
  const container = targetCellRef.closest('[data-editor-container="true"]');
94
90
  return (container === null || container === void 0 ? void 0 : container.getBoundingClientRect().left) || 0;
95
91
  }, [targetCellRef]);
@@ -55,7 +55,7 @@ export const ColumnControls = ({
55
55
  const selectedColIndexes = getSelectedColumns((selectionState === null || selectionState === void 0 ? void 0 : selectionState.selection) || editorView.state.selection);
56
56
  const firstRow = tableRef.querySelector('tr');
57
57
  const hasHeaderRow = firstRow ? firstRow.getAttribute('data-header-row') : false;
58
- const rowControlStickyTop = fg('platform_editor_breakout_use_css') ? 45 : rowHeights === null || rowHeights === void 0 ? void 0 : rowHeights[0];
58
+ const rowControlStickyTop = 45;
59
59
  const marginTop = hasHeaderRow && stickyTop !== undefined ? rowControlStickyTop !== null && rowControlStickyTop !== void 0 ? rowControlStickyTop : 0 : 0;
60
60
  const handleClick = useCallback(event => {
61
61
  const {
@@ -64,14 +64,9 @@ const TableFloatingColumnControls = ({
64
64
  }
65
65
  const colWidths = getColumnsWidths(editorView);
66
66
  if (stickyTop) {
67
- var _rowHeights$, _containerRef$current;
67
+ var _containerRef$current;
68
68
  const columnControlTopOffsetFromParent = '-12px';
69
- const headerRowHeight = hasHeaderRow && stickyTop !== undefined ? (_rowHeights$ = rowHeights === null || rowHeights === void 0 ? void 0 : rowHeights[0]) !== null && _rowHeights$ !== void 0 ? _rowHeights$ : 0 : 0;
70
- containerRef === null || containerRef === void 0 ? void 0 : (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.style.setProperty('top', fg('platform_editor_breakout_use_css') ? columnControlTopOffsetFromParent :
71
- // Ignored via go/ees005
72
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
73
- `${stickyTop - headerRowHeight + 33}px` // 33px is padding and margin applied on tr.sticky
74
- );
69
+ containerRef === null || containerRef === void 0 ? void 0 : (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.style.setProperty('top', columnControlTopOffsetFromParent);
75
70
  } else {
76
71
  var _containerRef$current2;
77
72
  containerRef === null || containerRef === void 0 ? void 0 : (_containerRef$current2 = containerRef.current) === null || _containerRef$current2 === void 0 ? void 0 : _containerRef$current2.style.removeProperty('top');
@@ -5,7 +5,6 @@ import { injectIntl } from 'react-intl-next';
5
5
  import { tableMessages as messages } from '@atlaskit/editor-common/messages';
6
6
  import { TableMap } from '@atlaskit/editor-tables/table-map';
7
7
  import { findTable, isTableSelected, selectTable } from '@atlaskit/editor-tables/utils';
8
- import { fg } from '@atlaskit/platform-feature-flags';
9
8
  import { clearHoverSelection, hoverTable } from '../../../pm-plugins/commands';
10
9
  import { TableCssClassName as ClassName } from '../../../types';
11
10
  // Ignored via go/ees005
@@ -72,7 +71,7 @@ class CornerControlComponent extends Component {
72
71
  }),
73
72
  style: {
74
73
  // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
75
- top: fg('platform_editor_breakout_use_css') ? this.props.stickyTop !== undefined ? `0px` : undefined : this.props.stickyTop !== undefined ? `${this.props.stickyTop}px` : undefined
74
+ top: this.props.stickyTop !== undefined ? `0px` : undefined
76
75
  },
77
76
  contentEditable: false
78
77
  }, /*#__PURE__*/React.createElement("button", {
@@ -3,7 +3,6 @@ import React, { Component } from 'react';
3
3
  import classnames from 'classnames';
4
4
  import { Selection } from '@atlaskit/editor-prosemirror/state';
5
5
  import { isRowSelected } from '@atlaskit/editor-tables/utils';
6
- import { fg } from '@atlaskit/platform-feature-flags';
7
6
  import { clearHoverSelection } from '../../../pm-plugins/commands';
8
7
  import { getRowHeights } from '../../../pm-plugins/utils/row-controls';
9
8
  import { TableCssClassName as ClassName } from '../../../types';
@@ -60,7 +59,7 @@ export default class NumberColumn extends Component {
60
59
  hasHeaderRow
61
60
  } = this.props;
62
61
  if (stickyTop && hasHeaderRow && index === 0) {
63
- const topOffset = fg('platform_editor_breakout_use_css') ? 0 : stickyTop;
62
+ const topOffset = 0;
64
63
  return {
65
64
  height: rowHeight,
66
65
  top: `${topOffset}px`
@@ -2,7 +2,6 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import React, { Component } from 'react';
3
3
  import { injectIntl } from 'react-intl-next';
4
4
  import { tableMessages as messages } from '@atlaskit/editor-common/messages';
5
- import { fg } from '@atlaskit/platform-feature-flags';
6
5
  import { clearHoverSelection } from '../../../pm-plugins/commands';
7
6
  import { getRowClassNames, getRowHeights, getRowsParams } from '../../../pm-plugins/utils/row-controls';
8
7
  import { TableCssClassName as ClassName } from '../../../types';
@@ -70,10 +69,7 @@ class RowControlsComponent extends Component {
70
69
  // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
71
70
  marginTop: `${marginTop}px`,
72
71
  // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
73
- top: fg('platform_editor_breakout_use_css') ? thisRowSticky ? `3px` : undefined : thisRowSticky ?
74
- // Ignored via go/ees005
75
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
76
- `${this.props.stickyTop + 3}px` : undefined,
72
+ top: thisRowSticky ? `3px` : undefined,
77
73
  // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
78
74
  paddingTop: thisRowSticky ? `${tableControlsSpacing}px` : undefined
79
75
  }
@@ -807,8 +807,6 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
807
807
  key: "render",
808
808
  value: function render() {
809
809
  var _this5 = this,
810
- _this$state$stickyHea2,
811
- _this$state$stickyHea3,
812
810
  _this$props$options10;
813
811
  var _this$props12 = this.props,
814
812
  view = _this$props12.view,
@@ -925,7 +923,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
925
923
  }
926
924
  var isNested = isTableNested(view.state, tablePos);
927
925
  var topShadowPadding = isDragAndDropEnabled ? 0 : shadowPadding;
928
- var topOffset = fg('platform_editor_breakout_use_css') ? 0 : (_this$state$stickyHea2 = (_this$state$stickyHea3 = this.state.stickyHeader) === null || _this$state$stickyHea3 === void 0 ? void 0 : _this$state$stickyHea3.top) !== null && _this$state$stickyHea2 !== void 0 ? _this$state$stickyHea2 : 0;
926
+ var topOffset = 0;
929
927
  var topStickyShadowPosition = this.state.stickyHeader && topOffset + this.state.stickyHeader.padding + topShadowPadding + 2;
930
928
  var _getEditorFeatureFlag7 = getEditorFeatureFlags(),
931
929
  _getEditorFeatureFlag8 = _getEditorFeatureFlag7.tableWithFixedColumnWidthsOption,
@@ -9,7 +9,6 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
9
9
  import debounce from 'lodash/debounce';
10
10
  import throttle from 'lodash/throttle';
11
11
  import { findOverflowScrollParent } from '@atlaskit/editor-common/ui';
12
- import { fg } from '@atlaskit/platform-feature-flags';
13
12
  import { getPluginState } from '../pm-plugins/plugin-factory';
14
13
  import { pluginKey as tablePluginKey } from '../pm-plugins/plugin-key';
15
14
  import { updateStickyState } from '../pm-plugins/sticky-headers/commands';
@@ -536,11 +535,7 @@ var TableRow = /*#__PURE__*/function (_TableNodeView) {
536
535
  _this6.refireIntersectionObservers();
537
536
  }, fastScrollThresholdMs);
538
537
  }
539
- if (fg('platform_editor_breakout_use_css')) {
540
- this.dom.style.top = "0px";
541
- } else {
542
- this.dom.style.top = "".concat(domTop, "px");
543
- }
538
+ this.dom.style.top = "0px";
544
539
  updateTableMargin(table);
545
540
  this.dom.scrollLeft = wrapper.scrollLeft;
546
541
  this.emitOn(domTop, this.colControlsOffset);