@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
@@ -7,7 +7,6 @@ import kebabCase from 'lodash/kebabCase';
7
7
  import { table, tableWithNestedTable } from '@atlaskit/adf-schema';
8
8
  import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
9
9
  import { akEditorGutterPaddingDynamic } from '@atlaskit/editor-shared-styles';
10
- import { fg } from '@atlaskit/platform-feature-flags';
11
10
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
12
11
  import { generateColgroup, getResizerMinWidth } from '../pm-plugins/table-resizing/utils/colgroup';
13
12
  import { TABLE_MAX_WIDTH } from '../pm-plugins/table-resizing/utils/consts';
@@ -20,7 +19,6 @@ export var tableNodeSpecWithFixedToDOM = function tableNodeSpecWithFixedToDOM(co
20
19
  return _objectSpread(_objectSpread({}, tableNode), {}, {
21
20
  toDOM: function toDOM(node) {
22
21
  var gutterPadding = akEditorGutterPaddingDynamic() * 2;
23
- var editorWidthFromGetter = fg('platform_editor_breakout_use_css') ? undefined : Math.min(config.getEditorContainerWidth().width - gutterPadding, node.attrs.width);
24
22
  var alignmentStyle = Object.entries(getAlignmentStyle(node.attrs.layout)).map(function (_ref) {
25
23
  var _ref2 = _slicedToArray(_ref, 2),
26
24
  k = _ref2[0],
@@ -28,15 +26,13 @@ export var tableNodeSpecWithFixedToDOM = function tableNodeSpecWithFixedToDOM(co
28
26
  return "".concat(kebabCase(k), ": ").concat(kebabCase(v));
29
27
  }).join(';');
30
28
  var tableMinWidth = getResizerMinWidth(node);
31
- var attrs = _objectSpread({
29
+ var attrs = {
32
30
  'data-number-column': node.attrs.isNumberColumnEnabled,
33
31
  'data-layout': node.attrs.layout,
34
32
  'data-autosize': node.attrs.__autoSize,
35
33
  'data-table-local-id': node.attrs.localId,
36
34
  'data-table-width': node.attrs.width
37
- }, fg('platform_editor_breakout_use_css') ? {} : {
38
- style: "width: ".concat(node.attrs.width, "px;")
39
- });
35
+ };
40
36
  var colgroup = '';
41
37
  if (config.allowColumnResizing) {
42
38
  colgroup = ['colgroup', {}].concat(_toConsumableArray(generateColgroup(node)));
@@ -77,10 +73,10 @@ export var tableNodeSpecWithFixedToDOM = function tableNodeSpecWithFixedToDOM(co
77
73
  style: alignmentStyle
78
74
  }, ['div', {
79
75
  class: 'pm-table-resizer-container',
80
- style: fg('platform_editor_breakout_use_css') ? "width: min(calc(100cqw - ".concat(gutterPadding, "px), ").concat(node.attrs.width, "px);") : "width: ".concat(node.attrs.width, "px")
76
+ style: "width: min(calc(100cqw - ".concat(gutterPadding, "px), ").concat(node.attrs.width, "px);")
81
77
  }, ['div', {
82
78
  class: 'resizer-item display-handle',
83
- style: fg('platform_editor_breakout_use_css') ? convertToInlineCss({
79
+ style: convertToInlineCss({
84
80
  position: 'relative',
85
81
  userSelect: 'auto',
86
82
  boxSizing: 'border-box',
@@ -90,14 +86,6 @@ export var tableNodeSpecWithFixedToDOM = function tableNodeSpecWithFixedToDOM(co
90
86
  minWidth: 'var(--ak-editor-table-min-width)',
91
87
  maxWidth: "min(calc(100cqw - var(--ak-editor-table-gutter-padding)), var(--ak-editor-table-max-width))",
92
88
  width: "min(calc(100cqw - var(--ak-editor-table-gutter-padding)), ".concat(node.attrs.width, ")")
93
- }) : convertToInlineCss({
94
- position: 'relative',
95
- userSelect: 'auto',
96
- boxSizing: 'border-box',
97
- height: 'auto',
98
- minWidth: "".concat(tableMinWidth, "px"),
99
- maxWidth: "".concat(editorWidthFromGetter, "px"),
100
- width: "".concat(editorWidthFromGetter, "px;")
101
89
  })
102
90
  }, ['span', {
103
91
  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';
@@ -147,10 +149,13 @@ export var handleMouseDown = function handleMouseDown(view, event, localResizeHa
147
149
  if (dragging) {
148
150
  var startX = dragging.startX;
149
151
 
150
- // If the table has changed (via collab for example) don't apply column widths
151
- // For example, if a table col is deleted we won't be able to reliably remap the new widths
152
- // There may be a more elegant solution to this, to avoid a jarring experience.
153
- if (table.eq(originalTable)) {
152
+ // If the dimensions of the table have changed through a remote modification by another
153
+ // person for example don't persist the new column widths as we couldn't reliably remap them
154
+ // For example, if a table col is deleted
155
+ // There may be a more elegant solution to this, to avoid a jarring experience. This used to
156
+ // be an equality check but that caused issues when a nested table would change (eg. when it
157
+ // dynamically updates its width on resize)
158
+ if (fg('platform_editor_nested_tables_resizing') ? !tablesHaveDifferentNoOfColumns(originalTable, table) : table.eq(originalTable)) {
154
159
  var _table$attrs;
155
160
  var map = TableMap.get(table);
156
161
  var colIndex = map.colCount($cell.pos - start) + ($cell.nodeAfter ? $cell.nodeAfter.attrs.colspan : 1) - 1;
@@ -4,6 +4,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
4
4
  import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
5
5
  import { tableCellMinWidth } from '@atlaskit/editor-common/styles';
6
6
  import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
7
+ import { fg } from '@atlaskit/platform-feature-flags';
7
8
  import { updateColumnWidths } from '../../transforms/column-width';
8
9
  import { getTableWidth } from '../../utils/nodes';
9
10
  import { getLayoutSize } from '../utils/misc';
@@ -169,6 +170,11 @@ export var scaleTable = function scaleTable(tableRef, options, domAtPos, api) {
169
170
  }
170
171
  if (resizeState) {
171
172
  tr = updateColumnWidths(resizeState, node, start, api)(tr);
173
+ if (fg('platform_editor_nested_tables_resizing')) {
174
+ // Avoid adding this transaction separately to the history as these are automatic updates
175
+ // as a consequence of another action
176
+ tr.setMeta('addToHistory', false);
177
+ }
172
178
  if (tr.docChanged) {
173
179
  tr.setMeta('scrollIntoView', false);
174
180
  // TODO: ED-8995
@@ -37,7 +37,7 @@ export var unwrapContentFromTable = function unwrapContentFromTable(maybeTable)
37
37
  // Flattens nested tables after a given nesting depth
38
38
  // If this looks familiar, it's a heavily modified version of `mapFragment` which has been
39
39
  // adjusted to support tracking nesting depth. This wasn't possible by using `mapFragment` directly
40
- var unwrapNestedTables = function unwrapNestedTables(content, schema, unwrapNestDepth) {
40
+ var _unwrapNestedTables = function unwrapNestedTables(content, schema, unwrapNestDepth) {
41
41
  var currentNestDepth = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
42
42
  var flattenNested = function flattenNested(node, tableDepth) {
43
43
  if (node.type === schema.nodes.table) {
@@ -51,7 +51,7 @@ var unwrapNestedTables = function unwrapNestedTables(content, schema, unwrapNest
51
51
  var children = [];
52
52
  for (var i = 0, size = content.childCount; i < size; i++) {
53
53
  var node = content.child(i);
54
- var transformed = node.isLeaf ? flattenNested(node, currentNestDepth) : flattenNested(node.copy(Fragment.fromArray(unwrapNestedTables(node.content, schema, unwrapNestDepth, node.type === schema.nodes.table ? currentNestDepth + 1 : currentNestDepth))), currentNestDepth);
54
+ var transformed = node.isLeaf ? flattenNested(node, currentNestDepth) : flattenNested(node.copy(Fragment.fromArray(_unwrapNestedTables(node.content, schema, unwrapNestDepth, node.type === schema.nodes.table ? currentNestDepth + 1 : currentNestDepth))), currentNestDepth);
55
55
  if (transformed) {
56
56
  if (Array.isArray(transformed)) {
57
57
  children.push.apply(children, _toConsumableArray(transformed));
@@ -134,7 +134,7 @@ export var transformSliceToRemoveNestedTables = function transformSliceToRemoveN
134
134
  }
135
135
 
136
136
  // after we've worked out what the allowed nesting depth is, unwrap nested tables
137
- var newChildren = unwrapNestedTables(node.content, schema, allowedTableNesting);
137
+ var newChildren = _unwrapNestedTables(node.content, schema, allowedTableNesting);
138
138
  return node.copy(Fragment.fromArray(newChildren));
139
139
  });
140
140
  return new Slice(newFragment, slice.openStart, openEnd);
@@ -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
  var BUTTON_WIDTH = 20;
@@ -83,11 +82,8 @@ export var FixedButton = function FixedButton(_ref2) {
83
82
  };
84
83
  }
85
84
  }, [fixedButtonRef, observerTargetRef, tableWrapper, targetCellPosition, targetCellRef, isContextualMenuOpen]);
86
- var fixedButtonTop = fg('platform_editor_breakout_use_css') ? 0 : stickyHeader.top;
85
+ var fixedButtonTop = 0;
87
86
  var containerLeft = useMemo(function () {
88
- if (!fg('platform_editor_breakout_use_css')) {
89
- return 0;
90
- }
91
87
  var container = targetCellRef.closest('[data-editor-container="true"]');
92
88
  return (container === null || container === void 0 ? void 0 : container.getBoundingClientRect().left) || 0;
93
89
  }, [targetCellRef]);
@@ -56,7 +56,7 @@ export var ColumnControls = function ColumnControls(_ref) {
56
56
  var selectedColIndexes = getSelectedColumns((selectionState === null || selectionState === void 0 ? void 0 : selectionState.selection) || editorView.state.selection);
57
57
  var firstRow = tableRef.querySelector('tr');
58
58
  var hasHeaderRow = firstRow ? firstRow.getAttribute('data-header-row') : false;
59
- var rowControlStickyTop = fg('platform_editor_breakout_use_css') ? 45 : rowHeights === null || rowHeights === void 0 ? void 0 : rowHeights[0];
59
+ var rowControlStickyTop = 45;
60
60
  var marginTop = hasHeaderRow && stickyTop !== undefined ? rowControlStickyTop !== null && rowControlStickyTop !== void 0 ? rowControlStickyTop : 0 : 0;
61
61
  var handleClick = useCallback(function (event) {
62
62
  var state = editorView.state,
@@ -65,13 +65,9 @@ var TableFloatingColumnControls = function TableFloatingColumnControls(_ref) {
65
65
  }
66
66
  var colWidths = getColumnsWidths(editorView);
67
67
  if (stickyTop) {
68
- var _rowHeights$, _containerRef$current;
68
+ var _containerRef$current;
69
69
  var columnControlTopOffsetFromParent = '-12px';
70
- var headerRowHeight = hasHeaderRow && stickyTop !== undefined ? (_rowHeights$ = rowHeights === null || rowHeights === void 0 ? void 0 : rowHeights[0]) !== null && _rowHeights$ !== void 0 ? _rowHeights$ : 0 : 0;
71
- containerRef === null || containerRef === void 0 || (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 || _containerRef$current.style.setProperty('top', fg('platform_editor_breakout_use_css') ? columnControlTopOffsetFromParent : // Ignored via go/ees005
72
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
73
- "".concat(stickyTop - headerRowHeight + 33, "px") // 33px is padding and margin applied on tr.sticky
74
- );
70
+ containerRef === null || containerRef === void 0 || (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 || _containerRef$current.style.setProperty('top', columnControlTopOffsetFromParent);
75
71
  } else {
76
72
  var _containerRef$current2;
77
73
  containerRef === null || containerRef === void 0 || (_containerRef$current2 = containerRef.current) === null || _containerRef$current2 === void 0 || _containerRef$current2.style.removeProperty('top');
@@ -12,7 +12,6 @@ import { injectIntl } from 'react-intl-next';
12
12
  import { tableMessages as messages } from '@atlaskit/editor-common/messages';
13
13
  import { TableMap } from '@atlaskit/editor-tables/table-map';
14
14
  import { findTable, isTableSelected, selectTable } from '@atlaskit/editor-tables/utils';
15
- import { fg } from '@atlaskit/platform-feature-flags';
16
15
  import { clearHoverSelection, hoverTable } from '../../../pm-plugins/commands';
17
16
  import { TableCssClassName as ClassName } from '../../../types';
18
17
  // Ignored via go/ees005
@@ -79,7 +78,7 @@ var CornerControlComponent = /*#__PURE__*/function (_Component) {
79
78
  }),
80
79
  style: {
81
80
  // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
82
- top: fg('platform_editor_breakout_use_css') ? this.props.stickyTop !== undefined ? "0px" : undefined : this.props.stickyTop !== undefined ? "".concat(this.props.stickyTop, "px") : undefined
81
+ top: this.props.stickyTop !== undefined ? "0px" : undefined
83
82
  },
84
83
  contentEditable: false
85
84
  }, /*#__PURE__*/React.createElement("button", {
@@ -10,7 +10,6 @@ import React, { Component } from 'react';
10
10
  import classnames from 'classnames';
11
11
  import { Selection } from '@atlaskit/editor-prosemirror/state';
12
12
  import { isRowSelected } from '@atlaskit/editor-tables/utils';
13
- import { fg } from '@atlaskit/platform-feature-flags';
14
13
  import { clearHoverSelection } from '../../../pm-plugins/commands';
15
14
  import { getRowHeights } from '../../../pm-plugins/utils/row-controls';
16
15
  import { TableCssClassName as ClassName } from '../../../types';
@@ -66,7 +65,7 @@ var NumberColumn = /*#__PURE__*/function (_Component) {
66
65
  stickyTop = _this$props3.stickyTop,
67
66
  hasHeaderRow = _this$props3.hasHeaderRow;
68
67
  if (stickyTop && hasHeaderRow && index === 0) {
69
- var topOffset = fg('platform_editor_breakout_use_css') ? 0 : stickyTop;
68
+ var topOffset = 0;
70
69
  return {
71
70
  height: rowHeight,
72
71
  top: "".concat(topOffset, "px")
@@ -9,7 +9,6 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
9
9
  import React, { Component } from 'react';
10
10
  import { injectIntl } from 'react-intl-next';
11
11
  import { tableMessages as messages } from '@atlaskit/editor-common/messages';
12
- import { fg } from '@atlaskit/platform-feature-flags';
13
12
  import { clearHoverSelection } from '../../../pm-plugins/commands';
14
13
  import { getRowClassNames, getRowHeights, getRowsParams } from '../../../pm-plugins/utils/row-controls';
15
14
  import { TableCssClassName as ClassName } from '../../../types';
@@ -80,9 +79,7 @@ var RowControlsComponent = /*#__PURE__*/function (_Component) {
80
79
  // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
81
80
  marginTop: "".concat(marginTop, "px"),
82
81
  // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
83
- top: fg('platform_editor_breakout_use_css') ? thisRowSticky ? "3px" : undefined : thisRowSticky ? // Ignored via go/ees005
84
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
85
- "".concat(_this2.props.stickyTop + 3, "px") : undefined,
82
+ top: thisRowSticky ? "3px" : undefined,
86
83
  // 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
87
84
  paddingTop: thisRowSticky ? "".concat(tableControlsSpacing, "px") : undefined
88
85
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "9.3.1",
3
+ "version": "9.3.3",
4
4
  "description": "Table plugin for the @atlaskit/editor",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -30,7 +30,7 @@
30
30
  "@atlaskit/adf-schema": "^46.1.0",
31
31
  "@atlaskit/button": "^20.4.0",
32
32
  "@atlaskit/custom-steps": "^0.9.0",
33
- "@atlaskit/editor-common": "^99.6.0",
33
+ "@atlaskit/editor-common": "^99.7.0",
34
34
  "@atlaskit/editor-palette": "1.7.0",
35
35
  "@atlaskit/editor-plugin-accessibility-utils": "^1.3.0",
36
36
  "@atlaskit/editor-plugin-analytics": "^1.11.0",
@@ -43,9 +43,9 @@
43
43
  "@atlaskit/editor-prosemirror": "6.2.1",
44
44
  "@atlaskit/editor-shared-styles": "^3.2.0",
45
45
  "@atlaskit/editor-tables": "^2.8.0",
46
- "@atlaskit/icon": "^23.5.0",
46
+ "@atlaskit/icon": "^23.6.0",
47
47
  "@atlaskit/menu": "^2.14.0",
48
- "@atlaskit/platform-feature-flags": "^0.3.0",
48
+ "@atlaskit/platform-feature-flags": "^1.0.0",
49
49
  "@atlaskit/pragmatic-drag-and-drop": "^1.5.0",
50
50
  "@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^2.1.0",
51
51
  "@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.0.0",
@@ -110,9 +110,6 @@
110
110
  "platform_editor_batch_steps_table": {
111
111
  "type": "boolean"
112
112
  },
113
- "platform_editor_breakout_use_css": {
114
- "type": "boolean"
115
- },
116
113
  "platform_editor_nested_table_in_nested_parent_fix": {
117
114
  "type": "boolean"
118
115
  },
@@ -143,6 +140,9 @@
143
140
  },
144
141
  "platform_editor_nested_tables_paste_dupe_fix": {
145
142
  "type": "boolean"
143
+ },
144
+ "platform_editor_nested_tables_resizing": {
145
+ "type": "boolean"
146
146
  }
147
147
  }
148
148
  }
@@ -908,9 +908,7 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
908
908
  const isNested = isTableNested(view.state, tablePos);
909
909
 
910
910
  const topShadowPadding = isDragAndDropEnabled ? 0 : shadowPadding;
911
- const topOffset = fg('platform_editor_breakout_use_css')
912
- ? 0
913
- : this.state.stickyHeader?.top ?? 0;
911
+ const topOffset = 0;
914
912
 
915
913
  const topStickyShadowPosition =
916
914
  this.state.stickyHeader && topOffset + this.state.stickyHeader.padding + topShadowPadding + 2;
@@ -5,7 +5,6 @@ import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
5
5
  import { findOverflowScrollParent } from '@atlaskit/editor-common/ui';
6
6
  import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
7
7
  import type { EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
8
- import { fg } from '@atlaskit/platform-feature-flags';
9
8
 
10
9
  import { getPluginState } from '../pm-plugins/plugin-factory';
11
10
  import { pluginKey as tablePluginKey } from '../pm-plugins/plugin-key';
@@ -611,12 +610,7 @@ export default class TableRow extends TableNodeView<HTMLTableRowElement> impleme
611
610
  this.refireIntersectionObservers();
612
611
  }, fastScrollThresholdMs);
613
612
  }
614
-
615
- if (fg('platform_editor_breakout_use_css')) {
616
- this.dom.style.top = `0px`;
617
- } else {
618
- this.dom.style.top = `${domTop}px`;
619
- }
613
+ this.dom.style.top = `0px`;
620
614
  updateTableMargin(table);
621
615
  this.dom.scrollLeft = wrapper.scrollLeft;
622
616
 
@@ -5,7 +5,6 @@ import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
5
5
  import type { GetEditorContainerWidth } from '@atlaskit/editor-common/types';
6
6
  import type { DOMOutputSpec, NodeSpec, Node as PMNode } from '@atlaskit/editor-prosemirror/model';
7
7
  import { akEditorGutterPaddingDynamic } from '@atlaskit/editor-shared-styles';
8
- import { fg } from '@atlaskit/platform-feature-flags';
9
8
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
10
9
 
11
10
  import { generateColgroup, getResizerMinWidth } from '../pm-plugins/table-resizing/utils/colgroup';
@@ -30,9 +29,6 @@ export const tableNodeSpecWithFixedToDOM = (config: Config): NodeSpec => {
30
29
  ...tableNode,
31
30
  toDOM: (node: PMNode): DOMOutputSpec => {
32
31
  const gutterPadding = akEditorGutterPaddingDynamic() * 2;
33
- const editorWidthFromGetter = fg('platform_editor_breakout_use_css')
34
- ? undefined
35
- : Math.min(config.getEditorContainerWidth().width - gutterPadding, node.attrs.width);
36
32
 
37
33
  const alignmentStyle = Object.entries(getAlignmentStyle(node.attrs.layout))
38
34
  .map(([k, v]) => `${kebabCase(k)}: ${kebabCase(v)}`)
@@ -46,9 +42,6 @@ export const tableNodeSpecWithFixedToDOM = (config: Config): NodeSpec => {
46
42
  'data-autosize': node.attrs.__autoSize,
47
43
  'data-table-local-id': node.attrs.localId,
48
44
  'data-table-width': node.attrs.width,
49
- ...(fg('platform_editor_breakout_use_css')
50
- ? {}
51
- : { style: `width: ${node.attrs.width}px;` }),
52
45
  };
53
46
 
54
47
  let colgroup: DOMOutputSpec = '';
@@ -136,35 +129,23 @@ export const tableNodeSpecWithFixedToDOM = (config: Config): NodeSpec => {
136
129
  'div',
137
130
  {
138
131
  class: 'pm-table-resizer-container',
139
- style: fg('platform_editor_breakout_use_css')
140
- ? `width: min(calc(100cqw - ${gutterPadding}px), ${node.attrs.width}px);`
141
- : `width: ${node.attrs.width}px`,
132
+ style: `width: min(calc(100cqw - ${gutterPadding}px), ${node.attrs.width}px);`,
142
133
  },
143
134
  [
144
135
  'div',
145
136
  {
146
137
  class: 'resizer-item display-handle',
147
- style: fg('platform_editor_breakout_use_css')
148
- ? convertToInlineCss({
149
- position: 'relative',
150
- userSelect: 'auto',
151
- boxSizing: 'border-box',
152
- '--ak-editor-table-gutter-padding': `${gutterPadding}px`,
153
- '--ak-editor-table-max-width': `${TABLE_MAX_WIDTH}px`,
154
- '--ak-editor-table-min-width': `${tableMinWidth}px`,
155
- minWidth: 'var(--ak-editor-table-min-width)',
156
- maxWidth: `min(calc(100cqw - var(--ak-editor-table-gutter-padding)), var(--ak-editor-table-max-width))`,
157
- width: `min(calc(100cqw - var(--ak-editor-table-gutter-padding)), ${node.attrs.width})`,
158
- })
159
- : convertToInlineCss({
160
- position: 'relative',
161
- userSelect: 'auto',
162
- boxSizing: 'border-box',
163
- height: 'auto',
164
- minWidth: `${tableMinWidth}px`,
165
- maxWidth: `${editorWidthFromGetter}px`,
166
- width: `${editorWidthFromGetter}px;`,
167
- }),
138
+ style: convertToInlineCss({
139
+ position: 'relative',
140
+ userSelect: 'auto',
141
+ boxSizing: 'border-box',
142
+ '--ak-editor-table-gutter-padding': `${gutterPadding}px`,
143
+ '--ak-editor-table-max-width': `${TABLE_MAX_WIDTH}px`,
144
+ '--ak-editor-table-min-width': `${tableMinWidth}px`,
145
+ minWidth: 'var(--ak-editor-table-min-width)',
146
+ maxWidth: `min(calc(100cqw - var(--ak-editor-table-gutter-padding)), var(--ak-editor-table-max-width))`,
147
+ width: `min(calc(100cqw - var(--ak-editor-table-gutter-padding)), ${node.attrs.width})`,
148
+ }),
168
149
  },
169
150
  [
170
151
  'span',
@@ -13,6 +13,7 @@ import type { GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/e
13
13
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
14
14
  import { TableMap } from '@atlaskit/editor-tables/table-map';
15
15
  import { getSelectionRect } from '@atlaskit/editor-tables/utils';
16
+ import { fg } from '@atlaskit/platform-feature-flags';
16
17
 
17
18
  import type { PluginInjectionAPI } from '../../types';
18
19
  import { stopKeyboardColumnResizing } from '../commands/column-resize';
@@ -20,6 +21,7 @@ import { updateResizeHandleDecorations } from '../commands/misc';
20
21
  import { getPluginState as getTablePluginState } from '../plugin-factory';
21
22
  import { META_KEYS } from '../table-analytics';
22
23
  import { updateColumnWidths } from '../transforms/column-width';
24
+ import { tablesHaveDifferentNoOfColumns } from '../utils/nodes';
23
25
  import { getSelectedColumnIndexes } from '../utils/selection';
24
26
 
25
27
  import { evenColumns, setDragging, stopResizing } from './commands';
@@ -195,10 +197,17 @@ export const handleMouseDown = (
195
197
  if (dragging) {
196
198
  const { startX } = dragging;
197
199
 
198
- // If the table has changed (via collab for example) don't apply column widths
199
- // For example, if a table col is deleted we won't be able to reliably remap the new widths
200
- // There may be a more elegant solution to this, to avoid a jarring experience.
201
- if (table.eq(originalTable)) {
200
+ // If the dimensions of the table have changed through a remote modification by another
201
+ // person for example don't persist the new column widths as we couldn't reliably remap them
202
+ // For example, if a table col is deleted
203
+ // There may be a more elegant solution to this, to avoid a jarring experience. This used to
204
+ // be an equality check but that caused issues when a nested table would change (eg. when it
205
+ // dynamically updates its width on resize)
206
+ if (
207
+ fg('platform_editor_nested_tables_resizing')
208
+ ? !tablesHaveDifferentNoOfColumns(originalTable, table)
209
+ : table.eq(originalTable)
210
+ ) {
202
211
  const map = TableMap.get(table);
203
212
  const colIndex =
204
213
  map.colCount($cell.pos - start) +
@@ -4,6 +4,7 @@ import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
4
4
  import type { Transaction } from '@atlaskit/editor-prosemirror/state';
5
5
  import type { DomAtPos } from '@atlaskit/editor-prosemirror/utils';
6
6
  import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
7
+ import { fg } from '@atlaskit/platform-feature-flags';
7
8
 
8
9
  import type { PluginInjectionAPI } from '../../../types';
9
10
  import { updateColumnWidths } from '../../transforms/column-width';
@@ -267,6 +268,11 @@ export const scaleTable =
267
268
 
268
269
  if (resizeState) {
269
270
  tr = updateColumnWidths(resizeState, node, start, api)(tr);
271
+ if (fg('platform_editor_nested_tables_resizing')) {
272
+ // Avoid adding this transaction separately to the history as these are automatic updates
273
+ // as a consequence of another action
274
+ tr.setMeta('addToHistory', false);
275
+ }
270
276
 
271
277
  if (tr.docChanged) {
272
278
  tr.setMeta('scrollIntoView', false);
@@ -4,7 +4,6 @@ import rafSchedule from 'raf-schd';
4
4
  import { createPortal } from 'react-dom';
5
5
 
6
6
  import { akEditorTableCellOnStickyHeaderZIndex } from '@atlaskit/editor-shared-styles';
7
- import { fg } from '@atlaskit/platform-feature-flags';
8
7
  import { token } from '@atlaskit/tokens';
9
8
 
10
9
  import type { RowStickyState } from '../../pm-plugins/sticky-headers/types';
@@ -134,13 +133,9 @@ export const FixedButton = ({
134
133
  isContextualMenuOpen,
135
134
  ]);
136
135
 
137
- const fixedButtonTop = fg('platform_editor_breakout_use_css') ? 0 : stickyHeader.top;
136
+ const fixedButtonTop = 0;
138
137
 
139
138
  const containerLeft = useMemo(() => {
140
- if (!fg('platform_editor_breakout_use_css')) {
141
- return 0;
142
- }
143
-
144
139
  const container = targetCellRef.closest('[data-editor-container="true"]');
145
140
  return container?.getBoundingClientRect().left || 0;
146
141
  }, [targetCellRef]);
@@ -96,7 +96,7 @@ export const ColumnControls = ({
96
96
  const firstRow = tableRef.querySelector('tr');
97
97
  const hasHeaderRow = firstRow ? firstRow.getAttribute('data-header-row') : false;
98
98
 
99
- const rowControlStickyTop = fg('platform_editor_breakout_use_css') ? 45 : rowHeights?.[0];
99
+ const rowControlStickyTop = 45;
100
100
  const marginTop = hasHeaderRow && stickyTop !== undefined ? rowControlStickyTop ?? 0 : 0;
101
101
 
102
102
  const handleClick = useCallback(
@@ -101,15 +101,7 @@ const TableFloatingColumnControls = ({
101
101
 
102
102
  if (stickyTop) {
103
103
  const columnControlTopOffsetFromParent = '-12px';
104
- const headerRowHeight = hasHeaderRow && stickyTop !== undefined ? rowHeights?.[0] ?? 0 : 0;
105
- containerRef?.current?.style.setProperty(
106
- 'top',
107
- fg('platform_editor_breakout_use_css')
108
- ? columnControlTopOffsetFromParent
109
- : // Ignored via go/ees005
110
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
111
- `${stickyTop! - headerRowHeight + 33}px`, // 33px is padding and margin applied on tr.sticky
112
- );
104
+ containerRef?.current?.style.setProperty('top', columnControlTopOffsetFromParent);
113
105
  } else {
114
106
  containerRef?.current?.style.removeProperty('top');
115
107
  }
@@ -7,7 +7,6 @@ import { injectIntl } from 'react-intl-next';
7
7
  import { tableMessages as messages } from '@atlaskit/editor-common/messages';
8
8
  import { TableMap } from '@atlaskit/editor-tables/table-map';
9
9
  import { findTable, isTableSelected, selectTable } from '@atlaskit/editor-tables/utils';
10
- import { fg } from '@atlaskit/platform-feature-flags';
11
10
 
12
11
  import { clearHoverSelection, hoverTable } from '../../../pm-plugins/commands';
13
12
  import { TableCssClassName as ClassName } from '../../../types';
@@ -39,13 +38,7 @@ class CornerControlComponent extends Component<CornerControlProps & WrappedCompo
39
38
  })}
40
39
  style={{
41
40
  // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
42
- top: fg('platform_editor_breakout_use_css')
43
- ? this.props.stickyTop !== undefined
44
- ? `0px`
45
- : undefined
46
- : this.props.stickyTop !== undefined
47
- ? `${this.props.stickyTop}px`
48
- : undefined,
41
+ top: this.props.stickyTop !== undefined ? `0px` : undefined,
49
42
  }}
50
43
  contentEditable={false}
51
44
  >
@@ -5,7 +5,6 @@ import classnames from 'classnames';
5
5
  import { Selection } from '@atlaskit/editor-prosemirror/state';
6
6
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
7
7
  import { isRowSelected } from '@atlaskit/editor-tables/utils';
8
- import { fg } from '@atlaskit/platform-feature-flags';
9
8
 
10
9
  import { clearHoverSelection } from '../../../pm-plugins/commands';
11
10
  import { getRowHeights } from '../../../pm-plugins/utils/row-controls';
@@ -123,7 +122,7 @@ export default class NumberColumn extends Component<Props, any> {
123
122
  private getCellStyles = (index: number, rowHeight: number) => {
124
123
  const { stickyTop, hasHeaderRow } = this.props;
125
124
  if (stickyTop && hasHeaderRow && index === 0) {
126
- const topOffset = fg('platform_editor_breakout_use_css') ? 0 : stickyTop;
125
+ const topOffset = 0;
127
126
 
128
127
  return {
129
128
  height: rowHeight,
@@ -6,7 +6,6 @@ import { injectIntl } from 'react-intl-next';
6
6
  import { tableMessages as messages } from '@atlaskit/editor-common/messages';
7
7
  import type { Selection } from '@atlaskit/editor-prosemirror/state';
8
8
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
9
- import { fg } from '@atlaskit/platform-feature-flags';
10
9
 
11
10
  import { clearHoverSelection } from '../../../pm-plugins/commands';
12
11
  import type { RowParams } from '../../../pm-plugins/utils/row-controls';
@@ -85,15 +84,7 @@ class RowControlsComponent extends Component<Props & WrappedComponentProps> {
85
84
  // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
86
85
  marginTop: `${marginTop}px`,
87
86
  // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
88
- top: fg('platform_editor_breakout_use_css')
89
- ? thisRowSticky
90
- ? `3px`
91
- : undefined
92
- : thisRowSticky
93
- ? // Ignored via go/ees005
94
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
95
- `${this.props.stickyTop! + 3}px`
96
- : undefined,
87
+ top: thisRowSticky ? `3px` : undefined,
97
88
  // 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
98
89
  paddingTop: thisRowSticky ? `${tableControlsSpacing}px` : undefined,
99
90
  }}