@atlaskit/editor-plugin-table 28.0.6 → 28.0.8

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @atlaskit/editor-plugin-table
2
2
 
3
+ ## 28.0.8
4
+
5
+ ### Patch Changes
6
+
7
+ - [`c967639892512`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c967639892512) -
8
+ Cleanup experiment `platform_editor_table_q4_patch_5` and permanently restrict sticky table
9
+ headers to the first header row.
10
+ - Updated dependencies
11
+
12
+ ## 28.0.7
13
+
14
+ ### Patch Changes
15
+
16
+ - [`f34bb99565856`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f34bb99565856) -
17
+ Remove the `platform_editor_table_q4_patch_3` experiment and permanently retain interaction-aware
18
+ table cell highlighting.
19
+ - Updated dependencies
20
+
3
21
  ## 28.0.6
4
22
 
5
23
  ### Patch Changes
@@ -119,7 +119,7 @@ var TableCell = exports.default = /*#__PURE__*/function (_TableNodeView) {
119
119
  // `data-reaches-*` are presentation-only attrs written imperatively for the rounded-corner
120
120
  // masks. Ignore them so ProseMirror doesn't rebuild the table (and drop the header row's
121
121
  // sticky class) on every column insert.
122
- if (mutation.type === 'attributes' && (_mutation$attributeNa = mutation.attributeName) !== null && _mutation$attributeNa !== void 0 && _mutation$attributeNa.startsWith('data-reaches-') && (0, _expValEquals.expValEquals)('platform_editor_table_q4_loveability', 'isEnabled', true) && (0, _expValEquals.expValEquals)('platform_editor_table_q4_patch_3', 'isEnabled', true)) {
122
+ if (mutation.type === 'attributes' && (_mutation$attributeNa = mutation.attributeName) !== null && _mutation$attributeNa !== void 0 && _mutation$attributeNa.startsWith('data-reaches-') && (0, _expValEquals.expValEquals)('platform_editor_table_q4_loveability', 'isEnabled', true)) {
123
123
  return true;
124
124
  }
125
125
  return false;
@@ -110,17 +110,11 @@ var TableRow = exports.default = /*#__PURE__*/function (_TableNodeView) {
110
110
  if (pos) {
111
111
  var $pos = view.state.doc.resolve(pos);
112
112
  _this.isInNestedTable = (0, _nesting.getParentOfTypeCount)(view.state.schema.nodes.table)($pos) > 1;
113
- // Resolve rowIndex only when the flag is on — otherwise it's unused
114
- if ((0, _expValEquals.expValEquals)('platform_editor_fix_sticky_header_row', 'isEnabled', true) && !(0, _expValEquals.expValEquals)('platform_editor_table_q4_patch_5', 'isEnabled', true)) {
115
- rowIndex = $pos.index();
116
- }
117
113
  }
118
114
  } catch (_unused) {
119
115
  // Intentionally swallowed — getPos can return stale positions during AI streaming
120
116
  }
121
- if ((0, _expValEquals.expValEquals)('platform_editor_table_q4_patch_5', 'isEnabled', true)) {
122
- rowIndex = (0, _nodes.getTableRowIndex)(view, getPos);
123
- }
117
+ rowIndex = (0, _nodes.getTableRowIndex)(view, getPos);
124
118
  _this.isHeaderRow = (0, _nodes.supportedHeaderRow)(node, rowIndex);
125
119
  if (_this.isHeaderRow) {
126
120
  _this.dom.setAttribute('data-vc-nvs', 'true');
@@ -167,20 +161,7 @@ var TableRow = exports.default = /*#__PURE__*/function (_TableNodeView) {
167
161
 
168
162
  // see if we're changing into a header row or
169
163
  // changing away from one
170
- var rowIndex = 0;
171
- if ((0, _expValEquals.expValEquals)('platform_editor_fix_sticky_header_row', 'isEnabled', true)) {
172
- try {
173
- var pos = this.getPos();
174
- if (pos) {
175
- rowIndex = this.view.state.doc.resolve(pos).index();
176
- }
177
- } catch (_unused2) {
178
- // Intentionally swallowed — getPos can return stale positions during AI streaming
179
- }
180
- }
181
- if ((0, _expValEquals.expValEquals)('platform_editor_table_q4_patch_5', 'isEnabled', true)) {
182
- rowIndex = (0, _nodes.getTableRowIndex)(this.view, this.getPos);
183
- }
164
+ var rowIndex = (0, _nodes.getTableRowIndex)(this.view, this.getPos);
184
165
  var newNodeIsHeaderRow = (0, _nodes.supportedHeaderRow)(node, rowIndex);
185
166
  if (this.isHeaderRow !== newNodeIsHeaderRow) {
186
167
  return false; // re-create nodeview
@@ -516,7 +497,7 @@ var TableRow = exports.default = /*#__PURE__*/function (_TableNodeView) {
516
497
  return false;
517
498
  }
518
499
  }
519
- } catch (_unused3) {
500
+ } catch (_unused2) {
520
501
  // getPos can return stale positions during AI streaming — fall back to non-sticky
521
502
  return false;
522
503
  }
@@ -109,12 +109,8 @@ var TableRowNativeStickyWithFallback = exports.default = /*#__PURE__*/function (
109
109
  _this.disableNativeSticky = false;
110
110
  }
111
111
  });
112
- if ((0, _expValEquals.expValEquals)('platform_editor_table_q4_patch_5', 'isEnabled', true)) {
113
- var rowIndex = (0, _nodes.getTableRowIndex)(view, getPos);
114
- _this.isHeaderRow = (0, _nodes.supportedHeaderRow)(node, rowIndex);
115
- } else {
116
- _this.isHeaderRow = (0, _nodes.supportedHeaderRow)(node);
117
- }
112
+ var rowIndex = (0, _nodes.getTableRowIndex)(view, getPos);
113
+ _this.isHeaderRow = (0, _nodes.supportedHeaderRow)(node, rowIndex);
118
114
  if (_this.isHeaderRow && (0, _expValEquals.expValEquals)('platform_editor_table_q4_patch_4', 'isEnabled', true)) {
119
115
  _this.isSingleRowTable = _this.checkIsSingleRowTable();
120
116
  }
@@ -207,19 +203,7 @@ var TableRowNativeStickyWithFallback = exports.default = /*#__PURE__*/function (
207
203
 
208
204
  // see if we're changing into a header row or
209
205
  // changing away from one
210
- var rowIndex = 0;
211
- if ((0, _expValEquals.expValEquals)('platform_editor_table_q4_patch_5', 'isEnabled', true)) {
212
- rowIndex = (0, _nodes.getTableRowIndex)(this.view, this.getPos);
213
- } else if ((0, _expValEquals.expValEquals)('platform_editor_fix_sticky_header_row', 'isEnabled', true)) {
214
- try {
215
- var pos = this.getPos();
216
- if (pos) {
217
- rowIndex = this.view.state.doc.resolve(pos).index();
218
- }
219
- } catch (_unused2) {
220
- // Intentionally swallowed — getPos can return stale positions during AI streaming
221
- }
222
- }
206
+ var rowIndex = (0, _nodes.getTableRowIndex)(this.view, this.getPos);
223
207
  var newNodeIsHeaderRow = (0, _nodes.supportedHeaderRow)(node, rowIndex);
224
208
  if (this.isHeaderRow !== newNodeIsHeaderRow) {
225
209
  if (!newNodeIsHeaderRow && this.isHeaderRow) {
@@ -756,7 +740,7 @@ var TableRowNativeStickyWithFallback = exports.default = /*#__PURE__*/function (
756
740
  return false;
757
741
  }
758
742
  }
759
- } catch (_unused3) {
743
+ } catch (_unused2) {
760
744
  // getPos can return stale positions during AI streaming — fall back to non-sticky
761
745
  return false;
762
746
  }
@@ -936,7 +920,7 @@ var TableRowNativeStickyWithFallback = exports.default = /*#__PURE__*/function (
936
920
  return node.type === _this1.view.state.schema.nodes.table;
937
921
  })) === null || _findParentNodeCloses3 === void 0 ? void 0 : _findParentNodeCloses3.node;
938
922
  return (tableNode === null || tableNode === void 0 ? void 0 : tableNode.childCount) === 1;
939
- } catch (_unused4) {
923
+ } catch (_unused3) {
940
924
  // getPos can return stale positions during AI streaming. Preserve the original sticky
941
925
  // header behaviour when the containing table cannot be determined.
942
926
  return false;
@@ -11,7 +11,6 @@ var _state = require("@atlaskit/editor-prosemirror/state");
11
11
  var _view = require("@atlaskit/editor-prosemirror/view");
12
12
  var _cellSelection = require("@atlaskit/editor-tables/cell-selection");
13
13
  var _utils = require("@atlaskit/editor-tables/utils");
14
- var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
15
14
  var _types = require("../../types");
16
15
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
17
16
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
@@ -67,32 +66,9 @@ var hasHadInteraction = function hasHadInteraction(api) {
67
66
  }
68
67
  return ((_api$interaction$shar = api.interaction.sharedState.currentState()) === null || _api$interaction$shar === void 0 ? void 0 : _api$interaction$shar.interactionState) !== 'hasNotHadInteraction';
69
68
  };
70
- var createLegacyStateField = function createLegacyStateField() {
71
- return {
72
- init: function init(_config, state) {
73
- return buildState(getActiveCellPos(state), state);
74
- },
75
- apply: function apply(tr, prev, _oldState, newState) {
76
- if (tr.docChanged) {
77
- // Doc changed — always rebuild since positions may have shifted.
78
- return buildState(getActiveCellPos(newState), newState);
79
- }
80
- if (!tr.selectionSet) {
81
- // Neither doc nor selection changed — nothing to do.
82
- return prev;
83
- }
84
69
 
85
- // Selection changed only rebuild if the cursor moved to a different cell.
86
- var nextCellPos = getActiveCellPos(newState);
87
- return nextCellPos === prev.cellPos ? prev : buildState(nextCellPos, newState);
88
- }
89
- };
90
- };
91
-
92
- /**
93
- * Stays hidden until the first interaction
94
- */
95
- var createGatedStateField = function createGatedStateField(api) {
70
+ /** Stays hidden until the first interaction. */
71
+ var createStateField = function createStateField(api) {
96
72
  return {
97
73
  init: function init(_config, state) {
98
74
  var interacted = hasHadInteraction(api);
@@ -128,7 +104,7 @@ var createGatedStateField = function createGatedStateField(api) {
128
104
  var createPlugin = exports.createPlugin = function createPlugin(api) {
129
105
  return new _safePlugin.SafePlugin({
130
106
  key: activeCellHighlightPluginKey,
131
- state: (0, _expValEquals.expValEquals)('platform_editor_table_q4_patch_3', 'isEnabled', true) ? createGatedStateField(api) : createLegacyStateField(),
107
+ state: createStateField(api),
132
108
  props: {
133
109
  decorations: function decorations(state) {
134
110
  var _activeCellHighlightP, _activeCellHighlightP2;
@@ -153,7 +153,7 @@ var getTableRowIndex = exports.getTableRowIndex = function getTableRowIndex(view
153
153
 
154
154
  /**
155
155
  * Check if a given node is a header row with this definition:
156
- * - the row is the first row when platform_editor_table_q4_patch_5 is enabled
156
+ * - the row is the first row
157
157
  * - all children are tableHeader cells
158
158
  * - no table cells have been merged with other table row cells (rowspan > 1)
159
159
  * - no table cells have been merged with other table column cells (colspan > 1),
@@ -167,7 +167,7 @@ var getTableRowIndex = exports.getTableRowIndex = function getTableRowIndex(view
167
167
  */
168
168
  var supportedHeaderRow = exports.supportedHeaderRow = function supportedHeaderRow(node) {
169
169
  var rowIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
170
- if ((0, _expValEquals.expValEquals)('platform_editor_table_q4_patch_5', 'isEnabled', true) && rowIndex !== 0) {
170
+ if (rowIndex !== 0) {
171
171
  return false;
172
172
  }
173
173
  var allHeaders = (0, _utils.mapChildren)(node, function (child) {
@@ -92,7 +92,7 @@ export default class TableCell extends TableNodeView {
92
92
  // `data-reaches-*` are presentation-only attrs written imperatively for the rounded-corner
93
93
  // masks. Ignore them so ProseMirror doesn't rebuild the table (and drop the header row's
94
94
  // sticky class) on every column insert.
95
- if (mutation.type === 'attributes' && (_mutation$attributeNa = mutation.attributeName) !== null && _mutation$attributeNa !== void 0 && _mutation$attributeNa.startsWith('data-reaches-') && expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true) && expValEquals('platform_editor_table_q4_patch_3', 'isEnabled', true)) {
95
+ if (mutation.type === 'attributes' && (_mutation$attributeNa = mutation.attributeName) !== null && _mutation$attributeNa !== void 0 && _mutation$attributeNa.startsWith('data-reaches-') && expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true)) {
96
96
  return true;
97
97
  }
98
98
  return false;
@@ -95,17 +95,11 @@ export default class TableRow extends TableNodeView {
95
95
  if (pos) {
96
96
  const $pos = view.state.doc.resolve(pos);
97
97
  this.isInNestedTable = getParentOfTypeCount(view.state.schema.nodes.table)($pos) > 1;
98
- // Resolve rowIndex only when the flag is on — otherwise it's unused
99
- if (expValEquals('platform_editor_fix_sticky_header_row', 'isEnabled', true) && !expValEquals('platform_editor_table_q4_patch_5', 'isEnabled', true)) {
100
- rowIndex = $pos.index();
101
- }
102
98
  }
103
99
  } catch {
104
100
  // Intentionally swallowed — getPos can return stale positions during AI streaming
105
101
  }
106
- if (expValEquals('platform_editor_table_q4_patch_5', 'isEnabled', true)) {
107
- rowIndex = getTableRowIndex(view, getPos);
108
- }
102
+ rowIndex = getTableRowIndex(view, getPos);
109
103
  this.isHeaderRow = supportedHeaderRow(node, rowIndex);
110
104
  if (this.isHeaderRow) {
111
105
  this.dom.setAttribute('data-vc-nvs', 'true');
@@ -147,20 +141,7 @@ export default class TableRow extends TableNodeView {
147
141
 
148
142
  // see if we're changing into a header row or
149
143
  // changing away from one
150
- let rowIndex = 0;
151
- if (expValEquals('platform_editor_fix_sticky_header_row', 'isEnabled', true)) {
152
- try {
153
- const pos = this.getPos();
154
- if (pos) {
155
- rowIndex = this.view.state.doc.resolve(pos).index();
156
- }
157
- } catch {
158
- // Intentionally swallowed — getPos can return stale positions during AI streaming
159
- }
160
- }
161
- if (expValEquals('platform_editor_table_q4_patch_5', 'isEnabled', true)) {
162
- rowIndex = getTableRowIndex(this.view, this.getPos);
163
- }
144
+ const rowIndex = getTableRowIndex(this.view, this.getPos);
164
145
  const newNodeIsHeaderRow = supportedHeaderRow(node, rowIndex);
165
146
  if (this.isHeaderRow !== newNodeIsHeaderRow) {
166
147
  return false; // re-create nodeview
@@ -93,12 +93,8 @@ export default class TableRowNativeStickyWithFallback extends TableNodeView {
93
93
  this.disableNativeSticky = false;
94
94
  }
95
95
  });
96
- if (expValEquals('platform_editor_table_q4_patch_5', 'isEnabled', true)) {
97
- const rowIndex = getTableRowIndex(view, getPos);
98
- this.isHeaderRow = supportedHeaderRow(node, rowIndex);
99
- } else {
100
- this.isHeaderRow = supportedHeaderRow(node);
101
- }
96
+ const rowIndex = getTableRowIndex(view, getPos);
97
+ this.isHeaderRow = supportedHeaderRow(node, rowIndex);
102
98
  if (this.isHeaderRow && expValEquals('platform_editor_table_q4_patch_4', 'isEnabled', true)) {
103
99
  this.isSingleRowTable = this.checkIsSingleRowTable();
104
100
  }
@@ -188,19 +184,7 @@ export default class TableRowNativeStickyWithFallback extends TableNodeView {
188
184
 
189
185
  // see if we're changing into a header row or
190
186
  // changing away from one
191
- let rowIndex = 0;
192
- if (expValEquals('platform_editor_table_q4_patch_5', 'isEnabled', true)) {
193
- rowIndex = getTableRowIndex(this.view, this.getPos);
194
- } else if (expValEquals('platform_editor_fix_sticky_header_row', 'isEnabled', true)) {
195
- try {
196
- const pos = this.getPos();
197
- if (pos) {
198
- rowIndex = this.view.state.doc.resolve(pos).index();
199
- }
200
- } catch {
201
- // Intentionally swallowed — getPos can return stale positions during AI streaming
202
- }
203
- }
187
+ const rowIndex = getTableRowIndex(this.view, this.getPos);
204
188
  const newNodeIsHeaderRow = supportedHeaderRow(node, rowIndex);
205
189
  if (this.isHeaderRow !== newNodeIsHeaderRow) {
206
190
  if (!newNodeIsHeaderRow && this.isHeaderRow) {
@@ -3,7 +3,6 @@ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
3
3
  import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
4
4
  import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
5
5
  import { findCellClosestToPos } from '@atlaskit/editor-tables/utils';
6
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
7
6
  import { TableCssClassName as ClassName } from '../../types';
8
7
  const EMPTY_STATE = {
9
8
  cellPos: -1,
@@ -57,28 +56,9 @@ const hasHadInteraction = api => {
57
56
  }
58
57
  return ((_api$interaction$shar = api.interaction.sharedState.currentState()) === null || _api$interaction$shar === void 0 ? void 0 : _api$interaction$shar.interactionState) !== 'hasNotHadInteraction';
59
58
  };
60
- const createLegacyStateField = () => ({
61
- init: (_config, state) => buildState(getActiveCellPos(state), state),
62
- apply: (tr, prev, _oldState, newState) => {
63
- if (tr.docChanged) {
64
- // Doc changed — always rebuild since positions may have shifted.
65
- return buildState(getActiveCellPos(newState), newState);
66
- }
67
- if (!tr.selectionSet) {
68
- // Neither doc nor selection changed — nothing to do.
69
- return prev;
70
- }
71
-
72
- // Selection changed — only rebuild if the cursor moved to a different cell.
73
- const nextCellPos = getActiveCellPos(newState);
74
- return nextCellPos === prev.cellPos ? prev : buildState(nextCellPos, newState);
75
- }
76
- });
77
59
 
78
- /**
79
- * Stays hidden until the first interaction
80
- */
81
- const createGatedStateField = api => ({
60
+ /** Stays hidden until the first interaction. */
61
+ const createStateField = api => ({
82
62
  init: (_config, state) => {
83
63
  const interacted = hasHadInteraction(api);
84
64
  return {
@@ -114,7 +94,7 @@ const createGatedStateField = api => ({
114
94
  export const createPlugin = api => {
115
95
  return new SafePlugin({
116
96
  key: activeCellHighlightPluginKey,
117
- state: expValEquals('platform_editor_table_q4_patch_3', 'isEnabled', true) ? createGatedStateField(api) : createLegacyStateField(),
97
+ state: createStateField(api),
118
98
  props: {
119
99
  decorations: state => {
120
100
  var _activeCellHighlightP, _activeCellHighlightP2;
@@ -121,7 +121,7 @@ export const getTableRowIndex = (view, getPos) => {
121
121
 
122
122
  /**
123
123
  * Check if a given node is a header row with this definition:
124
- * - the row is the first row when platform_editor_table_q4_patch_5 is enabled
124
+ * - the row is the first row
125
125
  * - all children are tableHeader cells
126
126
  * - no table cells have been merged with other table row cells (rowspan > 1)
127
127
  * - no table cells have been merged with other table column cells (colspan > 1),
@@ -134,7 +134,7 @@ export const getTableRowIndex = (view, getPos) => {
134
134
  * @returns boolean if it meets definition
135
135
  */
136
136
  export const supportedHeaderRow = (node, rowIndex = 0) => {
137
- if (expValEquals('platform_editor_table_q4_patch_5', 'isEnabled', true) && rowIndex !== 0) {
137
+ if (rowIndex !== 0) {
138
138
  return false;
139
139
  }
140
140
  const allHeaders = mapChildren(node, child => child.type.name === 'tableHeader').every(Boolean);
@@ -112,7 +112,7 @@ var TableCell = /*#__PURE__*/function (_TableNodeView) {
112
112
  // `data-reaches-*` are presentation-only attrs written imperatively for the rounded-corner
113
113
  // masks. Ignore them so ProseMirror doesn't rebuild the table (and drop the header row's
114
114
  // sticky class) on every column insert.
115
- if (mutation.type === 'attributes' && (_mutation$attributeNa = mutation.attributeName) !== null && _mutation$attributeNa !== void 0 && _mutation$attributeNa.startsWith('data-reaches-') && expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true) && expValEquals('platform_editor_table_q4_patch_3', 'isEnabled', true)) {
115
+ if (mutation.type === 'attributes' && (_mutation$attributeNa = mutation.attributeName) !== null && _mutation$attributeNa !== void 0 && _mutation$attributeNa.startsWith('data-reaches-') && expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true)) {
116
116
  return true;
117
117
  }
118
118
  return false;
@@ -103,17 +103,11 @@ var TableRow = /*#__PURE__*/function (_TableNodeView) {
103
103
  if (pos) {
104
104
  var $pos = view.state.doc.resolve(pos);
105
105
  _this.isInNestedTable = getParentOfTypeCount(view.state.schema.nodes.table)($pos) > 1;
106
- // Resolve rowIndex only when the flag is on — otherwise it's unused
107
- if (expValEquals('platform_editor_fix_sticky_header_row', 'isEnabled', true) && !expValEquals('platform_editor_table_q4_patch_5', 'isEnabled', true)) {
108
- rowIndex = $pos.index();
109
- }
110
106
  }
111
107
  } catch (_unused) {
112
108
  // Intentionally swallowed — getPos can return stale positions during AI streaming
113
109
  }
114
- if (expValEquals('platform_editor_table_q4_patch_5', 'isEnabled', true)) {
115
- rowIndex = getTableRowIndex(view, getPos);
116
- }
110
+ rowIndex = getTableRowIndex(view, getPos);
117
111
  _this.isHeaderRow = supportedHeaderRow(node, rowIndex);
118
112
  if (_this.isHeaderRow) {
119
113
  _this.dom.setAttribute('data-vc-nvs', 'true');
@@ -160,20 +154,7 @@ var TableRow = /*#__PURE__*/function (_TableNodeView) {
160
154
 
161
155
  // see if we're changing into a header row or
162
156
  // changing away from one
163
- var rowIndex = 0;
164
- if (expValEquals('platform_editor_fix_sticky_header_row', 'isEnabled', true)) {
165
- try {
166
- var pos = this.getPos();
167
- if (pos) {
168
- rowIndex = this.view.state.doc.resolve(pos).index();
169
- }
170
- } catch (_unused2) {
171
- // Intentionally swallowed — getPos can return stale positions during AI streaming
172
- }
173
- }
174
- if (expValEquals('platform_editor_table_q4_patch_5', 'isEnabled', true)) {
175
- rowIndex = getTableRowIndex(this.view, this.getPos);
176
- }
157
+ var rowIndex = getTableRowIndex(this.view, this.getPos);
177
158
  var newNodeIsHeaderRow = supportedHeaderRow(node, rowIndex);
178
159
  if (this.isHeaderRow !== newNodeIsHeaderRow) {
179
160
  return false; // re-create nodeview
@@ -509,7 +490,7 @@ var TableRow = /*#__PURE__*/function (_TableNodeView) {
509
490
  return false;
510
491
  }
511
492
  }
512
- } catch (_unused3) {
493
+ } catch (_unused2) {
513
494
  // getPos can return stale positions during AI streaming — fall back to non-sticky
514
495
  return false;
515
496
  }
@@ -102,12 +102,8 @@ var TableRowNativeStickyWithFallback = /*#__PURE__*/function (_TableNodeView) {
102
102
  _this.disableNativeSticky = false;
103
103
  }
104
104
  });
105
- if (expValEquals('platform_editor_table_q4_patch_5', 'isEnabled', true)) {
106
- var rowIndex = getTableRowIndex(view, getPos);
107
- _this.isHeaderRow = supportedHeaderRow(node, rowIndex);
108
- } else {
109
- _this.isHeaderRow = supportedHeaderRow(node);
110
- }
105
+ var rowIndex = getTableRowIndex(view, getPos);
106
+ _this.isHeaderRow = supportedHeaderRow(node, rowIndex);
111
107
  if (_this.isHeaderRow && expValEquals('platform_editor_table_q4_patch_4', 'isEnabled', true)) {
112
108
  _this.isSingleRowTable = _this.checkIsSingleRowTable();
113
109
  }
@@ -200,19 +196,7 @@ var TableRowNativeStickyWithFallback = /*#__PURE__*/function (_TableNodeView) {
200
196
 
201
197
  // see if we're changing into a header row or
202
198
  // changing away from one
203
- var rowIndex = 0;
204
- if (expValEquals('platform_editor_table_q4_patch_5', 'isEnabled', true)) {
205
- rowIndex = getTableRowIndex(this.view, this.getPos);
206
- } else if (expValEquals('platform_editor_fix_sticky_header_row', 'isEnabled', true)) {
207
- try {
208
- var pos = this.getPos();
209
- if (pos) {
210
- rowIndex = this.view.state.doc.resolve(pos).index();
211
- }
212
- } catch (_unused2) {
213
- // Intentionally swallowed — getPos can return stale positions during AI streaming
214
- }
215
- }
199
+ var rowIndex = getTableRowIndex(this.view, this.getPos);
216
200
  var newNodeIsHeaderRow = supportedHeaderRow(node, rowIndex);
217
201
  if (this.isHeaderRow !== newNodeIsHeaderRow) {
218
202
  if (!newNodeIsHeaderRow && this.isHeaderRow) {
@@ -749,7 +733,7 @@ var TableRowNativeStickyWithFallback = /*#__PURE__*/function (_TableNodeView) {
749
733
  return false;
750
734
  }
751
735
  }
752
- } catch (_unused3) {
736
+ } catch (_unused2) {
753
737
  // getPos can return stale positions during AI streaming — fall back to non-sticky
754
738
  return false;
755
739
  }
@@ -929,7 +913,7 @@ var TableRowNativeStickyWithFallback = /*#__PURE__*/function (_TableNodeView) {
929
913
  return node.type === _this1.view.state.schema.nodes.table;
930
914
  })) === null || _findParentNodeCloses3 === void 0 ? void 0 : _findParentNodeCloses3.node;
931
915
  return (tableNode === null || tableNode === void 0 ? void 0 : tableNode.childCount) === 1;
932
- } catch (_unused4) {
916
+ } catch (_unused3) {
933
917
  // getPos can return stale positions during AI streaming. Preserve the original sticky
934
918
  // header behaviour when the containing table cannot be determined.
935
919
  return false;
@@ -6,7 +6,6 @@ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
6
6
  import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
7
7
  import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
8
8
  import { findCellClosestToPos } from '@atlaskit/editor-tables/utils';
9
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
10
9
  import { TableCssClassName as ClassName } from '../../types';
11
10
  var EMPTY_STATE = {
12
11
  cellPos: -1,
@@ -60,32 +59,9 @@ var hasHadInteraction = function hasHadInteraction(api) {
60
59
  }
61
60
  return ((_api$interaction$shar = api.interaction.sharedState.currentState()) === null || _api$interaction$shar === void 0 ? void 0 : _api$interaction$shar.interactionState) !== 'hasNotHadInteraction';
62
61
  };
63
- var createLegacyStateField = function createLegacyStateField() {
64
- return {
65
- init: function init(_config, state) {
66
- return buildState(getActiveCellPos(state), state);
67
- },
68
- apply: function apply(tr, prev, _oldState, newState) {
69
- if (tr.docChanged) {
70
- // Doc changed — always rebuild since positions may have shifted.
71
- return buildState(getActiveCellPos(newState), newState);
72
- }
73
- if (!tr.selectionSet) {
74
- // Neither doc nor selection changed — nothing to do.
75
- return prev;
76
- }
77
62
 
78
- // Selection changed only rebuild if the cursor moved to a different cell.
79
- var nextCellPos = getActiveCellPos(newState);
80
- return nextCellPos === prev.cellPos ? prev : buildState(nextCellPos, newState);
81
- }
82
- };
83
- };
84
-
85
- /**
86
- * Stays hidden until the first interaction
87
- */
88
- var createGatedStateField = function createGatedStateField(api) {
63
+ /** Stays hidden until the first interaction. */
64
+ var createStateField = function createStateField(api) {
89
65
  return {
90
66
  init: function init(_config, state) {
91
67
  var interacted = hasHadInteraction(api);
@@ -121,7 +97,7 @@ var createGatedStateField = function createGatedStateField(api) {
121
97
  export var createPlugin = function createPlugin(api) {
122
98
  return new SafePlugin({
123
99
  key: activeCellHighlightPluginKey,
124
- state: expValEquals('platform_editor_table_q4_patch_3', 'isEnabled', true) ? createGatedStateField(api) : createLegacyStateField(),
100
+ state: createStateField(api),
125
101
  props: {
126
102
  decorations: function decorations(state) {
127
103
  var _activeCellHighlightP, _activeCellHighlightP2;
@@ -146,7 +146,7 @@ export var getTableRowIndex = function getTableRowIndex(view, getPos) {
146
146
 
147
147
  /**
148
148
  * Check if a given node is a header row with this definition:
149
- * - the row is the first row when platform_editor_table_q4_patch_5 is enabled
149
+ * - the row is the first row
150
150
  * - all children are tableHeader cells
151
151
  * - no table cells have been merged with other table row cells (rowspan > 1)
152
152
  * - no table cells have been merged with other table column cells (colspan > 1),
@@ -160,7 +160,7 @@ export var getTableRowIndex = function getTableRowIndex(view, getPos) {
160
160
  */
161
161
  export var supportedHeaderRow = function supportedHeaderRow(node) {
162
162
  var rowIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
163
- if (expValEquals('platform_editor_table_q4_patch_5', 'isEnabled', true) && rowIndex !== 0) {
163
+ if (rowIndex !== 0) {
164
164
  return false;
165
165
  }
166
166
  var allHeaders = mapChildren(node, function (child) {
@@ -21,7 +21,7 @@ export declare const isTableNestedUnderBodiedSyncBlock: (state: EditorState, tab
21
21
  export declare const getTableRowIndex: (view: EditorView, getPos: () => number | undefined) => number;
22
22
  /**
23
23
  * Check if a given node is a header row with this definition:
24
- * - the row is the first row when platform_editor_table_q4_patch_5 is enabled
24
+ * - the row is the first row
25
25
  * - all children are tableHeader cells
26
26
  * - no table cells have been merged with other table row cells (rowspan > 1)
27
27
  * - no table cells have been merged with other table column cells (colspan > 1),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "28.0.6",
3
+ "version": "28.0.8",
4
4
  "description": "Table plugin for the @atlaskit/editor",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -29,7 +29,7 @@
29
29
  "@atlaskit/editor-plugin-batch-attribute-updates": "^16.0.0",
30
30
  "@atlaskit/editor-plugin-content-insertion": "^16.0.0",
31
31
  "@atlaskit/editor-plugin-editor-viewmode": "^18.0.0",
32
- "@atlaskit/editor-plugin-extension": "19.0.4",
32
+ "@atlaskit/editor-plugin-extension": "19.0.6",
33
33
  "@atlaskit/editor-plugin-guideline": "^16.0.0",
34
34
  "@atlaskit/editor-plugin-interaction": "^27.0.0",
35
35
  "@atlaskit/editor-plugin-limited-mode": "^13.0.0",
@@ -42,7 +42,7 @@
42
42
  "@atlaskit/editor-shared-styles": "^4.0.0",
43
43
  "@atlaskit/editor-tables": "^3.0.0",
44
44
  "@atlaskit/editor-toolbar": "^2.6.0",
45
- "@atlaskit/editor-ui-control-model": "^2.8.0",
45
+ "@atlaskit/editor-ui-control-model": "^2.9.0",
46
46
  "@atlaskit/icon": "^37.5.0",
47
47
  "@atlaskit/icon-lab": "^7.7.0",
48
48
  "@atlaskit/insm": "^3.0.0",
@@ -53,7 +53,7 @@
53
53
  "@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^3.1.0",
54
54
  "@atlaskit/pragmatic-drag-and-drop-hitbox": "^2.1.0",
55
55
  "@atlaskit/primitives": "^22.4.0",
56
- "@atlaskit/tmp-editor-statsig": "^164.0.0",
56
+ "@atlaskit/tmp-editor-statsig": "^166.0.0",
57
57
  "@atlaskit/toggle": "^17.2.0",
58
58
  "@atlaskit/tokens": "^16.8.0",
59
59
  "@atlaskit/tooltip": "^24.2.0",
@@ -68,7 +68,7 @@
68
68
  "uuid": "^3.1.0"
69
69
  },
70
70
  "peerDependencies": {
71
- "@atlaskit/editor-common": "^120.3.0",
71
+ "@atlaskit/editor-common": "^120.6.0",
72
72
  "react": "^18.2.0 || ^19.2.0",
73
73
  "react-dom": "^18.2.0 || ^19.2.0",
74
74
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"