@atlaskit/editor-plugin-table 10.12.8 → 10.12.9

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,15 @@
1
1
  # @atlaskit/editor-plugin-table
2
2
 
3
+ ## 10.12.9
4
+
5
+ ### Patch Changes
6
+
7
+ - [#175949](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/175949)
8
+ [`142db856d66fe`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/142db856d66fe) -
9
+ ED-27516: Remove feature gate – platform_editor_table_initial_load_fix. This is the second
10
+ attempt, as this previously merged with broken unit tests that somehow passed CI.
11
+ - Updated dependencies
12
+
3
13
  ## 10.12.8
4
14
 
5
15
  ### Patch Changes
@@ -17,7 +17,6 @@ var _nesting = require("@atlaskit/editor-common/nesting");
17
17
  var _nodeVisibility = require("@atlaskit/editor-common/node-visibility");
18
18
  var _ui = require("@atlaskit/editor-common/ui");
19
19
  var _utils = require("@atlaskit/editor-prosemirror/utils");
20
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
21
20
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
22
21
  var _pluginFactory = require("../pm-plugins/plugin-factory");
23
22
  var _pluginKey = require("../pm-plugins/plugin-key");
@@ -296,6 +295,7 @@ var TableRow = exports.default = /*#__PURE__*/function (_TableNodeView) {
296
295
  var getSentinelBottom = function getSentinelBottom() {
297
296
  // Multiple bottom sentinels may be found if there are nested tables.
298
297
  // We need to make sure we get the last one which will belong to the parent table.
298
+
299
299
  var bottomSentinels = tableContainer && tableContainer.getElementsByClassName(_types.TableCssClassName.TABLE_STICKY_SENTINEL_BOTTOM);
300
300
  return (
301
301
  // eslint-disable-next-line @atlaskit/editor/no-as-casting
@@ -312,66 +312,43 @@ var TableRow = exports.default = /*#__PURE__*/function (_TableNodeView) {
312
312
  // skip if already observed for another row on this table
313
313
  if (el && !el.dataset.isObserved) {
314
314
  el.dataset.isObserved = 'true';
315
+
315
316
  // Ignored via go/ees005
316
317
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
317
318
  _this2.intersectionObserver.observe(el);
318
319
  }
319
320
  });
320
321
  };
321
- if ((0, _platformFeatureFlags.fg)('platform_editor_table_initial_load_fix')) {
322
- var isInitialProsemirrorToDomRender = tableContainer.hasAttribute('data-prosemirror-initial-toDOM-render');
322
+ var isInitialProsemirrorToDomRender = tableContainer.hasAttribute('data-prosemirror-initial-toDOM-render');
323
323
 
324
- // Sentinels may be in the DOM but they're part of the prosemirror placeholder structure which is replaced with the fully rendered React node.
325
- if (sentinelsInDom() && !isInitialProsemirrorToDomRender) {
326
- // great - DOM ready, observe as normal
327
- observeStickySentinels();
328
- } else {
329
- // concurrent loading issue - here TableRow is too eager trying to
330
- // observe sentinels before they are in the DOM, use MutationObserver
331
- // to wait for sentinels to be added to the parent Table node DOM
332
- // then attach the IntersectionObserver
333
- _this2.tableContainerObserver = new MutationObserver(function () {
334
- // Check if the tableContainer is still connected to the DOM. It can become disconnected when the placholder
335
- // prosemirror node is replaced with the fully rendered React node (see _handleTableRef).
336
- if (!tableContainer || !tableContainer.isConnected) {
337
- tableContainer = getTableContainer();
338
- }
339
- if (sentinelsInDom()) {
340
- var _this2$tableContainer;
341
- observeStickySentinels();
342
- (_this2$tableContainer = _this2.tableContainerObserver) === null || _this2$tableContainer === void 0 || _this2$tableContainer.disconnect();
343
- }
344
- });
345
- var mutatingNode = tableContainer;
346
- if (mutatingNode && _this2.tableContainerObserver) {
347
- _this2.tableContainerObserver.observe(mutatingNode, {
348
- subtree: true,
349
- childList: true
350
- });
351
- }
352
- }
324
+ // Sentinels may be in the DOM but they're part of the prosemirror placeholder structure which is replaced with the fully rendered React node.
325
+ if (sentinelsInDom() && !isInitialProsemirrorToDomRender) {
326
+ // great - DOM ready, observe as normal
327
+ observeStickySentinels();
353
328
  } else {
354
- if (sentinelsInDom()) {
355
- // great - DOM ready, observe as normal
356
- observeStickySentinels();
357
- } else {
358
- // concurrent loading issue - here TableRow is too eager trying to
359
- // observe sentinels before they are in the DOM, use MutationObserver
360
- // to wait for sentinels to be added to the parent Table node DOM
361
- // then attach the IntersectionObserver
362
- var tableContainerObserver = new MutationObserver(function () {
363
- if (sentinelsInDom()) {
364
- observeStickySentinels();
365
- tableContainerObserver.disconnect();
366
- }
367
- });
368
- var _mutatingNode = tableContainer;
369
- if (_mutatingNode) {
370
- tableContainerObserver.observe(_mutatingNode, {
371
- subtree: true,
372
- childList: true
373
- });
329
+ // concurrent loading issue - here TableRow is too eager trying to
330
+ // observe sentinels before they are in the DOM, use MutationObserver
331
+ // to wait for sentinels to be added to the parent Table node DOM
332
+ // then attach the IntersectionObserver
333
+ _this2.tableContainerObserver = new MutationObserver(function () {
334
+ // Check if the tableContainer is still connected to the DOM. It can become disconnected when the placholder
335
+ // prosemirror node is replaced with the fully rendered React node (see _handleTableRef).
336
+
337
+ if (!tableContainer || !tableContainer.isConnected) {
338
+ tableContainer = getTableContainer();
339
+ }
340
+ if (sentinelsInDom()) {
341
+ var _this2$tableContainer;
342
+ observeStickySentinels();
343
+ (_this2$tableContainer = _this2.tableContainerObserver) === null || _this2$tableContainer === void 0 || _this2$tableContainer.disconnect();
374
344
  }
345
+ });
346
+ var mutatingNode = tableContainer;
347
+ if (mutatingNode && _this2.tableContainerObserver) {
348
+ _this2.tableContainerObserver.observe(mutatingNode, {
349
+ subtree: true,
350
+ childList: true
351
+ });
375
352
  }
376
353
  }
377
354
  }
@@ -13,7 +13,6 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
13
13
  var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
14
14
  var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
15
15
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
16
- var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
17
16
  var _react = _interopRequireDefault(require("react"));
18
17
  var _nodeWidth = require("@atlaskit/editor-common/node-width");
19
18
  var _reactNodeView = _interopRequireDefault(require("@atlaskit/editor-common/react-node-view"));
@@ -27,7 +26,6 @@ var _pluginKey = require("../pm-plugins/drag-and-drop/plugin-key");
27
26
  var _pluginFactory = require("../pm-plugins/plugin-factory");
28
27
  var _pluginKey2 = require("../pm-plugins/plugin-key");
29
28
  var _pluginKey3 = require("../pm-plugins/table-resizing/plugin-key");
30
- var _colgroup = require("../pm-plugins/table-resizing/utils/colgroup");
31
29
  var _tableWidth = require("../pm-plugins/table-width");
32
30
  var _nodes = require("../pm-plugins/utils/nodes");
33
31
  var _TableComponent = _interopRequireDefault(require("./TableComponent"));
@@ -67,15 +65,6 @@ var handleInlineTableWidth = function handleInlineTableWidth(table, width) {
67
65
  }
68
66
  table.style.setProperty('width', "".concat(width, "px"));
69
67
  };
70
-
71
- // Remove after removing the platform_editor_table_initial_load_fix flag.
72
- var toDOM = function toDOM(node, props) {
73
- var colgroup = '';
74
- if (props.allowColumnResizing) {
75
- colgroup = ['colgroup', {}].concat((0, _toConsumableArray2.default)((0, _colgroup.generateColgroup)(node)));
76
- }
77
- return ['table', tableAttributes(node), colgroup, ['tbody', 0]];
78
- };
79
68
  var TableView = exports.default = /*#__PURE__*/function (_ReactNodeView) {
80
69
  function TableView(props) {
81
70
  var _this;
@@ -89,37 +78,26 @@ var TableView = exports.default = /*#__PURE__*/function (_ReactNodeView) {
89
78
  _this.eventDispatcher = props.eventDispatcher;
90
79
  _this.options = props.options;
91
80
  _this.getEditorFeatureFlags = props.getEditorFeatureFlags;
92
- if ((0, _platformFeatureFlags.fg)('platform_editor_table_initial_load_fix')) {
93
- _this.handleRef = function (node) {
94
- return _this._handleTableRef(node);
95
- };
96
- }
81
+ _this.handleRef = function (node) {
82
+ return _this._handleTableRef(node);
83
+ };
97
84
  return _this;
98
85
  }
99
86
  (0, _inherits2.default)(TableView, _ReactNodeView);
100
87
  return (0, _createClass2.default)(TableView, [{
101
88
  key: "getContentDOM",
102
89
  value: function getContentDOM() {
103
- var tableDOMStructure;
104
- if ((0, _platformFeatureFlags.fg)('platform_editor_table_initial_load_fix')) {
105
- tableDOMStructure = (0, _toDOM.tableNodeSpecWithFixedToDOM)({
106
- allowColumnResizing: !!this.reactComponentProps.allowColumnResizing,
107
- tableResizingEnabled: !!this.reactComponentProps.allowTableResizing,
108
- getEditorContainerWidth: this.reactComponentProps.getEditorContainerWidth
109
- }).toDOM(this.node);
110
- } else {
111
- tableDOMStructure = toDOM(this.node, this.reactComponentProps);
112
- }
90
+ var tableDOMStructure = (0, _toDOM.tableNodeSpecWithFixedToDOM)({
91
+ allowColumnResizing: !!this.reactComponentProps.allowColumnResizing,
92
+ tableResizingEnabled: !!this.reactComponentProps.allowTableResizing,
93
+ getEditorContainerWidth: this.reactComponentProps.getEditorContainerWidth
94
+ }).toDOM(this.node);
113
95
  var rendered = _model.DOMSerializer.renderSpec(document, tableDOMStructure);
114
96
  if (rendered.dom) {
115
97
  var _this$options, _this$options2, _this$getEditorFeatur;
116
- if ((0, _platformFeatureFlags.fg)('platform_editor_table_initial_load_fix')) {
117
- var tableElement = rendered.dom.querySelector('table');
118
- this.table = tableElement ? tableElement : rendered.dom;
119
- this.renderedDOM = rendered.dom;
120
- } else {
121
- this.table = rendered.dom;
122
- }
98
+ var tableElement = rendered.dom.querySelector('table');
99
+ this.table = tableElement ? tableElement : rendered.dom;
100
+ this.renderedDOM = rendered.dom;
123
101
  if (!((_this$options = this.options) !== null && _this$options !== void 0 && _this$options.isTableScalingEnabled) || (_this$options2 = this.options) !== null && _this$options2 !== void 0 && _this$options2.isTableScalingEnabled && (_this$getEditorFeatur = this.getEditorFeatureFlags) !== null && _this$getEditorFeatur !== void 0 && _this$getEditorFeatur.call(this).tableWithFixedColumnWidthsOption && this.node.attrs.displayMode === 'fixed') {
124
102
  var tableInlineWidth = getInlineWidth(this.node, this.reactComponentProps.options, this.reactComponentProps.view.state, this.reactComponentProps.getPos(), this.reactComponentProps.allowTableResizing);
125
103
  if (tableInlineWidth) {
@@ -5,7 +5,6 @@ import { getParentOfTypeCount } from '@atlaskit/editor-common/nesting';
5
5
  import { nodeVisibilityManager } from '@atlaskit/editor-common/node-visibility';
6
6
  import { findOverflowScrollParent } from '@atlaskit/editor-common/ui';
7
7
  import { findParentNodeClosestToPos } from '@atlaskit/editor-prosemirror/utils';
8
- import { fg } from '@atlaskit/platform-feature-flags';
9
8
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
10
9
  import { getPluginState } from '../pm-plugins/plugin-factory';
11
10
  import { pluginKey as tablePluginKey } from '../pm-plugins/plugin-key';
@@ -263,6 +262,7 @@ export default class TableRow extends TableNodeView {
263
262
  const getSentinelBottom = () => {
264
263
  // Multiple bottom sentinels may be found if there are nested tables.
265
264
  // We need to make sure we get the last one which will belong to the parent table.
265
+
266
266
  const bottomSentinels = tableContainer && tableContainer.getElementsByClassName(ClassName.TABLE_STICKY_SENTINEL_BOTTOM);
267
267
  return (
268
268
  // eslint-disable-next-line @atlaskit/editor/no-as-casting
@@ -277,66 +277,43 @@ export default class TableRow extends TableNodeView {
277
277
  // skip if already observed for another row on this table
278
278
  if (el && !el.dataset.isObserved) {
279
279
  el.dataset.isObserved = 'true';
280
+
280
281
  // Ignored via go/ees005
281
282
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
282
283
  this.intersectionObserver.observe(el);
283
284
  }
284
285
  });
285
286
  };
286
- if (fg('platform_editor_table_initial_load_fix')) {
287
- const isInitialProsemirrorToDomRender = tableContainer.hasAttribute('data-prosemirror-initial-toDOM-render');
288
-
289
- // Sentinels may be in the DOM but they're part of the prosemirror placeholder structure which is replaced with the fully rendered React node.
290
- if (sentinelsInDom() && !isInitialProsemirrorToDomRender) {
291
- // great - DOM ready, observe as normal
292
- observeStickySentinels();
293
- } else {
294
- // concurrent loading issue - here TableRow is too eager trying to
295
- // observe sentinels before they are in the DOM, use MutationObserver
296
- // to wait for sentinels to be added to the parent Table node DOM
297
- // then attach the IntersectionObserver
298
- this.tableContainerObserver = new MutationObserver(() => {
299
- // Check if the tableContainer is still connected to the DOM. It can become disconnected when the placholder
300
- // prosemirror node is replaced with the fully rendered React node (see _handleTableRef).
301
- if (!tableContainer || !tableContainer.isConnected) {
302
- tableContainer = getTableContainer();
303
- }
304
- if (sentinelsInDom()) {
305
- var _this$tableContainerO;
306
- observeStickySentinels();
307
- (_this$tableContainerO = this.tableContainerObserver) === null || _this$tableContainerO === void 0 ? void 0 : _this$tableContainerO.disconnect();
308
- }
309
- });
310
- const mutatingNode = tableContainer;
311
- if (mutatingNode && this.tableContainerObserver) {
312
- this.tableContainerObserver.observe(mutatingNode, {
313
- subtree: true,
314
- childList: true
315
- });
316
- }
317
- }
287
+ const isInitialProsemirrorToDomRender = tableContainer.hasAttribute('data-prosemirror-initial-toDOM-render');
288
+
289
+ // Sentinels may be in the DOM but they're part of the prosemirror placeholder structure which is replaced with the fully rendered React node.
290
+ if (sentinelsInDom() && !isInitialProsemirrorToDomRender) {
291
+ // great - DOM ready, observe as normal
292
+ observeStickySentinels();
318
293
  } else {
319
- if (sentinelsInDom()) {
320
- // great - DOM ready, observe as normal
321
- observeStickySentinels();
322
- } else {
323
- // concurrent loading issue - here TableRow is too eager trying to
324
- // observe sentinels before they are in the DOM, use MutationObserver
325
- // to wait for sentinels to be added to the parent Table node DOM
326
- // then attach the IntersectionObserver
327
- const tableContainerObserver = new MutationObserver(() => {
328
- if (sentinelsInDom()) {
329
- observeStickySentinels();
330
- tableContainerObserver.disconnect();
331
- }
332
- });
333
- const mutatingNode = tableContainer;
334
- if (mutatingNode) {
335
- tableContainerObserver.observe(mutatingNode, {
336
- subtree: true,
337
- childList: true
338
- });
294
+ // concurrent loading issue - here TableRow is too eager trying to
295
+ // observe sentinels before they are in the DOM, use MutationObserver
296
+ // to wait for sentinels to be added to the parent Table node DOM
297
+ // then attach the IntersectionObserver
298
+ this.tableContainerObserver = new MutationObserver(() => {
299
+ // Check if the tableContainer is still connected to the DOM. It can become disconnected when the placholder
300
+ // prosemirror node is replaced with the fully rendered React node (see _handleTableRef).
301
+
302
+ if (!tableContainer || !tableContainer.isConnected) {
303
+ tableContainer = getTableContainer();
304
+ }
305
+ if (sentinelsInDom()) {
306
+ var _this$tableContainerO;
307
+ observeStickySentinels();
308
+ (_this$tableContainerO = this.tableContainerObserver) === null || _this$tableContainerO === void 0 ? void 0 : _this$tableContainerO.disconnect();
339
309
  }
310
+ });
311
+ const mutatingNode = tableContainer;
312
+ if (mutatingNode && this.tableContainerObserver) {
313
+ this.tableContainerObserver.observe(mutatingNode, {
314
+ subtree: true,
315
+ childList: true
316
+ });
340
317
  }
341
318
  }
342
319
  }
@@ -12,7 +12,6 @@ import { pluginKey as tableDragAndDropPluginKey } from '../pm-plugins/drag-and-d
12
12
  import { getPluginState } from '../pm-plugins/plugin-factory';
13
13
  import { pluginKey } from '../pm-plugins/plugin-key';
14
14
  import { pluginKey as tableResizingPluginKey } from '../pm-plugins/table-resizing/plugin-key';
15
- import { generateColgroup } from '../pm-plugins/table-resizing/utils/colgroup';
16
15
  import { pluginKey as tableWidthPluginKey } from '../pm-plugins/table-width';
17
16
  import { isTableNested } from '../pm-plugins/utils/nodes';
18
17
  import TableComponent from './TableComponent';
@@ -49,15 +48,6 @@ const handleInlineTableWidth = (table, width) => {
49
48
  }
50
49
  table.style.setProperty('width', `${width}px`);
51
50
  };
52
-
53
- // Remove after removing the platform_editor_table_initial_load_fix flag.
54
- const toDOM = (node, props) => {
55
- let colgroup = '';
56
- if (props.allowColumnResizing) {
57
- colgroup = ['colgroup', {}, ...generateColgroup(node)];
58
- }
59
- return ['table', tableAttributes(node), colgroup, ['tbody', 0]];
60
- };
61
51
  export default class TableView extends ReactNodeView {
62
52
  constructor(props) {
63
53
  super(props.node, props.view, props.getPos, props.portalProviderAPI, props.eventDispatcher, props);
@@ -69,31 +59,20 @@ export default class TableView extends ReactNodeView {
69
59
  this.eventDispatcher = props.eventDispatcher;
70
60
  this.options = props.options;
71
61
  this.getEditorFeatureFlags = props.getEditorFeatureFlags;
72
- if (fg('platform_editor_table_initial_load_fix')) {
73
- this.handleRef = node => this._handleTableRef(node);
74
- }
62
+ this.handleRef = node => this._handleTableRef(node);
75
63
  }
76
64
  getContentDOM() {
77
- let tableDOMStructure;
78
- if (fg('platform_editor_table_initial_load_fix')) {
79
- tableDOMStructure = tableNodeSpecWithFixedToDOM({
80
- allowColumnResizing: !!this.reactComponentProps.allowColumnResizing,
81
- tableResizingEnabled: !!this.reactComponentProps.allowTableResizing,
82
- getEditorContainerWidth: this.reactComponentProps.getEditorContainerWidth
83
- }).toDOM(this.node);
84
- } else {
85
- tableDOMStructure = toDOM(this.node, this.reactComponentProps);
86
- }
65
+ const tableDOMStructure = tableNodeSpecWithFixedToDOM({
66
+ allowColumnResizing: !!this.reactComponentProps.allowColumnResizing,
67
+ tableResizingEnabled: !!this.reactComponentProps.allowTableResizing,
68
+ getEditorContainerWidth: this.reactComponentProps.getEditorContainerWidth
69
+ }).toDOM(this.node);
87
70
  const rendered = DOMSerializer.renderSpec(document, tableDOMStructure);
88
71
  if (rendered.dom) {
89
72
  var _this$options, _this$options2, _this$getEditorFeatur;
90
- if (fg('platform_editor_table_initial_load_fix')) {
91
- const tableElement = rendered.dom.querySelector('table');
92
- this.table = tableElement ? tableElement : rendered.dom;
93
- this.renderedDOM = rendered.dom;
94
- } else {
95
- this.table = rendered.dom;
96
- }
73
+ const tableElement = rendered.dom.querySelector('table');
74
+ this.table = tableElement ? tableElement : rendered.dom;
75
+ this.renderedDOM = rendered.dom;
97
76
  if (!((_this$options = this.options) !== null && _this$options !== void 0 && _this$options.isTableScalingEnabled) || (_this$options2 = this.options) !== null && _this$options2 !== void 0 && _this$options2.isTableScalingEnabled && (_this$getEditorFeatur = this.getEditorFeatureFlags) !== null && _this$getEditorFeatur !== void 0 && _this$getEditorFeatur.call(this).tableWithFixedColumnWidthsOption && this.node.attrs.displayMode === 'fixed') {
98
77
  const tableInlineWidth = getInlineWidth(this.node, this.reactComponentProps.options, this.reactComponentProps.view.state, this.reactComponentProps.getPos(), this.reactComponentProps.allowTableResizing);
99
78
  if (tableInlineWidth) {
@@ -12,7 +12,6 @@ import { getParentOfTypeCount } from '@atlaskit/editor-common/nesting';
12
12
  import { nodeVisibilityManager } from '@atlaskit/editor-common/node-visibility';
13
13
  import { findOverflowScrollParent } from '@atlaskit/editor-common/ui';
14
14
  import { findParentNodeClosestToPos } from '@atlaskit/editor-prosemirror/utils';
15
- import { fg } from '@atlaskit/platform-feature-flags';
16
15
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
17
16
  import { getPluginState } from '../pm-plugins/plugin-factory';
18
17
  import { pluginKey as tablePluginKey } from '../pm-plugins/plugin-key';
@@ -289,6 +288,7 @@ var TableRow = /*#__PURE__*/function (_TableNodeView) {
289
288
  var getSentinelBottom = function getSentinelBottom() {
290
289
  // Multiple bottom sentinels may be found if there are nested tables.
291
290
  // We need to make sure we get the last one which will belong to the parent table.
291
+
292
292
  var bottomSentinels = tableContainer && tableContainer.getElementsByClassName(ClassName.TABLE_STICKY_SENTINEL_BOTTOM);
293
293
  return (
294
294
  // eslint-disable-next-line @atlaskit/editor/no-as-casting
@@ -305,66 +305,43 @@ var TableRow = /*#__PURE__*/function (_TableNodeView) {
305
305
  // skip if already observed for another row on this table
306
306
  if (el && !el.dataset.isObserved) {
307
307
  el.dataset.isObserved = 'true';
308
+
308
309
  // Ignored via go/ees005
309
310
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
310
311
  _this2.intersectionObserver.observe(el);
311
312
  }
312
313
  });
313
314
  };
314
- if (fg('platform_editor_table_initial_load_fix')) {
315
- var isInitialProsemirrorToDomRender = tableContainer.hasAttribute('data-prosemirror-initial-toDOM-render');
315
+ var isInitialProsemirrorToDomRender = tableContainer.hasAttribute('data-prosemirror-initial-toDOM-render');
316
316
 
317
- // Sentinels may be in the DOM but they're part of the prosemirror placeholder structure which is replaced with the fully rendered React node.
318
- if (sentinelsInDom() && !isInitialProsemirrorToDomRender) {
319
- // great - DOM ready, observe as normal
320
- observeStickySentinels();
321
- } else {
322
- // concurrent loading issue - here TableRow is too eager trying to
323
- // observe sentinels before they are in the DOM, use MutationObserver
324
- // to wait for sentinels to be added to the parent Table node DOM
325
- // then attach the IntersectionObserver
326
- _this2.tableContainerObserver = new MutationObserver(function () {
327
- // Check if the tableContainer is still connected to the DOM. It can become disconnected when the placholder
328
- // prosemirror node is replaced with the fully rendered React node (see _handleTableRef).
329
- if (!tableContainer || !tableContainer.isConnected) {
330
- tableContainer = getTableContainer();
331
- }
332
- if (sentinelsInDom()) {
333
- var _this2$tableContainer;
334
- observeStickySentinels();
335
- (_this2$tableContainer = _this2.tableContainerObserver) === null || _this2$tableContainer === void 0 || _this2$tableContainer.disconnect();
336
- }
337
- });
338
- var mutatingNode = tableContainer;
339
- if (mutatingNode && _this2.tableContainerObserver) {
340
- _this2.tableContainerObserver.observe(mutatingNode, {
341
- subtree: true,
342
- childList: true
343
- });
344
- }
345
- }
317
+ // Sentinels may be in the DOM but they're part of the prosemirror placeholder structure which is replaced with the fully rendered React node.
318
+ if (sentinelsInDom() && !isInitialProsemirrorToDomRender) {
319
+ // great - DOM ready, observe as normal
320
+ observeStickySentinels();
346
321
  } else {
347
- if (sentinelsInDom()) {
348
- // great - DOM ready, observe as normal
349
- observeStickySentinels();
350
- } else {
351
- // concurrent loading issue - here TableRow is too eager trying to
352
- // observe sentinels before they are in the DOM, use MutationObserver
353
- // to wait for sentinels to be added to the parent Table node DOM
354
- // then attach the IntersectionObserver
355
- var tableContainerObserver = new MutationObserver(function () {
356
- if (sentinelsInDom()) {
357
- observeStickySentinels();
358
- tableContainerObserver.disconnect();
359
- }
360
- });
361
- var _mutatingNode = tableContainer;
362
- if (_mutatingNode) {
363
- tableContainerObserver.observe(_mutatingNode, {
364
- subtree: true,
365
- childList: true
366
- });
322
+ // concurrent loading issue - here TableRow is too eager trying to
323
+ // observe sentinels before they are in the DOM, use MutationObserver
324
+ // to wait for sentinels to be added to the parent Table node DOM
325
+ // then attach the IntersectionObserver
326
+ _this2.tableContainerObserver = new MutationObserver(function () {
327
+ // Check if the tableContainer is still connected to the DOM. It can become disconnected when the placholder
328
+ // prosemirror node is replaced with the fully rendered React node (see _handleTableRef).
329
+
330
+ if (!tableContainer || !tableContainer.isConnected) {
331
+ tableContainer = getTableContainer();
332
+ }
333
+ if (sentinelsInDom()) {
334
+ var _this2$tableContainer;
335
+ observeStickySentinels();
336
+ (_this2$tableContainer = _this2.tableContainerObserver) === null || _this2$tableContainer === void 0 || _this2$tableContainer.disconnect();
367
337
  }
338
+ });
339
+ var mutatingNode = tableContainer;
340
+ if (mutatingNode && _this2.tableContainerObserver) {
341
+ _this2.tableContainerObserver.observe(mutatingNode, {
342
+ subtree: true,
343
+ childList: true
344
+ });
368
345
  }
369
346
  }
370
347
  }
@@ -6,7 +6,6 @@ import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
6
6
  import _get from "@babel/runtime/helpers/get";
7
7
  import _inherits from "@babel/runtime/helpers/inherits";
8
8
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
9
- import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
10
9
  function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
11
10
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
12
11
  function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; }
@@ -23,7 +22,6 @@ import { pluginKey as tableDragAndDropPluginKey } from '../pm-plugins/drag-and-d
23
22
  import { getPluginState } from '../pm-plugins/plugin-factory';
24
23
  import { pluginKey } from '../pm-plugins/plugin-key';
25
24
  import { pluginKey as tableResizingPluginKey } from '../pm-plugins/table-resizing/plugin-key';
26
- import { generateColgroup } from '../pm-plugins/table-resizing/utils/colgroup';
27
25
  import { pluginKey as tableWidthPluginKey } from '../pm-plugins/table-width';
28
26
  import { isTableNested } from '../pm-plugins/utils/nodes';
29
27
  import TableComponent from './TableComponent';
@@ -60,15 +58,6 @@ var handleInlineTableWidth = function handleInlineTableWidth(table, width) {
60
58
  }
61
59
  table.style.setProperty('width', "".concat(width, "px"));
62
60
  };
63
-
64
- // Remove after removing the platform_editor_table_initial_load_fix flag.
65
- var toDOM = function toDOM(node, props) {
66
- var colgroup = '';
67
- if (props.allowColumnResizing) {
68
- colgroup = ['colgroup', {}].concat(_toConsumableArray(generateColgroup(node)));
69
- }
70
- return ['table', tableAttributes(node), colgroup, ['tbody', 0]];
71
- };
72
61
  var TableView = /*#__PURE__*/function (_ReactNodeView) {
73
62
  function TableView(props) {
74
63
  var _this;
@@ -82,37 +71,26 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
82
71
  _this.eventDispatcher = props.eventDispatcher;
83
72
  _this.options = props.options;
84
73
  _this.getEditorFeatureFlags = props.getEditorFeatureFlags;
85
- if (fg('platform_editor_table_initial_load_fix')) {
86
- _this.handleRef = function (node) {
87
- return _this._handleTableRef(node);
88
- };
89
- }
74
+ _this.handleRef = function (node) {
75
+ return _this._handleTableRef(node);
76
+ };
90
77
  return _this;
91
78
  }
92
79
  _inherits(TableView, _ReactNodeView);
93
80
  return _createClass(TableView, [{
94
81
  key: "getContentDOM",
95
82
  value: function getContentDOM() {
96
- var tableDOMStructure;
97
- if (fg('platform_editor_table_initial_load_fix')) {
98
- tableDOMStructure = tableNodeSpecWithFixedToDOM({
99
- allowColumnResizing: !!this.reactComponentProps.allowColumnResizing,
100
- tableResizingEnabled: !!this.reactComponentProps.allowTableResizing,
101
- getEditorContainerWidth: this.reactComponentProps.getEditorContainerWidth
102
- }).toDOM(this.node);
103
- } else {
104
- tableDOMStructure = toDOM(this.node, this.reactComponentProps);
105
- }
83
+ var tableDOMStructure = tableNodeSpecWithFixedToDOM({
84
+ allowColumnResizing: !!this.reactComponentProps.allowColumnResizing,
85
+ tableResizingEnabled: !!this.reactComponentProps.allowTableResizing,
86
+ getEditorContainerWidth: this.reactComponentProps.getEditorContainerWidth
87
+ }).toDOM(this.node);
106
88
  var rendered = DOMSerializer.renderSpec(document, tableDOMStructure);
107
89
  if (rendered.dom) {
108
90
  var _this$options, _this$options2, _this$getEditorFeatur;
109
- if (fg('platform_editor_table_initial_load_fix')) {
110
- var tableElement = rendered.dom.querySelector('table');
111
- this.table = tableElement ? tableElement : rendered.dom;
112
- this.renderedDOM = rendered.dom;
113
- } else {
114
- this.table = rendered.dom;
115
- }
91
+ var tableElement = rendered.dom.querySelector('table');
92
+ this.table = tableElement ? tableElement : rendered.dom;
93
+ this.renderedDOM = rendered.dom;
116
94
  if (!((_this$options = this.options) !== null && _this$options !== void 0 && _this$options.isTableScalingEnabled) || (_this$options2 = this.options) !== null && _this$options2 !== void 0 && _this$options2.isTableScalingEnabled && (_this$getEditorFeatur = this.getEditorFeatureFlags) !== null && _this$getEditorFeatur !== void 0 && _this$getEditorFeatur.call(this).tableWithFixedColumnWidthsOption && this.node.attrs.displayMode === 'fixed') {
117
95
  var tableInlineWidth = getInlineWidth(this.node, this.reactComponentProps.options, this.reactComponentProps.view.state, this.reactComponentProps.getPos(), this.reactComponentProps.allowTableResizing);
118
96
  if (tableInlineWidth) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "10.12.8",
3
+ "version": "10.12.9",
4
4
  "description": "Table plugin for the @atlaskit/editor",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -32,7 +32,7 @@
32
32
  "@atlaskit/adf-schema": "^47.6.0",
33
33
  "@atlaskit/button": "^23.2.0",
34
34
  "@atlaskit/custom-steps": "^0.11.0",
35
- "@atlaskit/editor-common": "^107.1.0",
35
+ "@atlaskit/editor-common": "^107.2.0",
36
36
  "@atlaskit/editor-palette": "^2.1.0",
37
37
  "@atlaskit/editor-plugin-accessibility-utils": "^2.0.0",
38
38
  "@atlaskit/editor-plugin-analytics": "^2.3.0",
@@ -55,7 +55,7 @@
55
55
  "@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.1.0",
56
56
  "@atlaskit/primitives": "^14.9.0",
57
57
  "@atlaskit/theme": "^18.0.0",
58
- "@atlaskit/tmp-editor-statsig": "^8.0.0",
58
+ "@atlaskit/tmp-editor-statsig": "^8.2.0",
59
59
  "@atlaskit/toggle": "^15.0.0",
60
60
  "@atlaskit/tokens": "^5.4.0",
61
61
  "@atlaskit/tooltip": "^20.3.0",
@@ -124,9 +124,6 @@
124
124
  "type": "boolean",
125
125
  "referenceOnly": true
126
126
  },
127
- "platform_editor_table_initial_load_fix": {
128
- "type": "boolean"
129
- },
130
127
  "platform_editor_table_overflow_in_full_width_fix": {
131
128
  "type": "boolean"
132
129
  },
@@ -8,7 +8,6 @@ import { findOverflowScrollParent } from '@atlaskit/editor-common/ui';
8
8
  import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
9
9
  import { findParentNodeClosestToPos } from '@atlaskit/editor-prosemirror/utils';
10
10
  import type { EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
11
- import { fg } from '@atlaskit/platform-feature-flags';
12
11
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
13
12
 
14
13
  import { getPluginState } from '../pm-plugins/plugin-factory';
@@ -335,6 +334,7 @@ export default class TableRow extends TableNodeView<HTMLTableRowElement> impleme
335
334
  const getSentinelBottom = () => {
336
335
  // Multiple bottom sentinels may be found if there are nested tables.
337
336
  // We need to make sure we get the last one which will belong to the parent table.
337
+
338
338
  const bottomSentinels =
339
339
  tableContainer &&
340
340
  tableContainer.getElementsByClassName(ClassName.TABLE_STICKY_SENTINEL_BOTTOM);
@@ -354,6 +354,7 @@ export default class TableRow extends TableNodeView<HTMLTableRowElement> impleme
354
354
  // skip if already observed for another row on this table
355
355
  if (el && !el.dataset.isObserved) {
356
356
  el.dataset.isObserved = 'true';
357
+
357
358
  // Ignored via go/ees005
358
359
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
359
360
  this.intersectionObserver!.observe(el);
@@ -361,57 +362,35 @@ export default class TableRow extends TableNodeView<HTMLTableRowElement> impleme
361
362
  });
362
363
  };
363
364
 
364
- if (fg('platform_editor_table_initial_load_fix')) {
365
- const isInitialProsemirrorToDomRender = tableContainer.hasAttribute(
366
- 'data-prosemirror-initial-toDOM-render',
367
- );
365
+ const isInitialProsemirrorToDomRender = tableContainer.hasAttribute(
366
+ 'data-prosemirror-initial-toDOM-render',
367
+ );
368
368
 
369
- // Sentinels may be in the DOM but they're part of the prosemirror placeholder structure which is replaced with the fully rendered React node.
370
- if (sentinelsInDom() && !isInitialProsemirrorToDomRender) {
371
- // great - DOM ready, observe as normal
372
- observeStickySentinels();
373
- } else {
374
- // concurrent loading issue - here TableRow is too eager trying to
375
- // observe sentinels before they are in the DOM, use MutationObserver
376
- // to wait for sentinels to be added to the parent Table node DOM
377
- // then attach the IntersectionObserver
378
- this.tableContainerObserver = new MutationObserver(() => {
379
- // Check if the tableContainer is still connected to the DOM. It can become disconnected when the placholder
380
- // prosemirror node is replaced with the fully rendered React node (see _handleTableRef).
381
- if (!tableContainer || !tableContainer.isConnected) {
382
- tableContainer = getTableContainer();
383
- }
384
- if (sentinelsInDom()) {
385
- observeStickySentinels();
386
- this.tableContainerObserver?.disconnect();
387
- }
388
- });
389
-
390
- const mutatingNode = tableContainer;
391
- if (mutatingNode && this.tableContainerObserver) {
392
- this.tableContainerObserver.observe(mutatingNode, { subtree: true, childList: true });
393
- }
394
- }
369
+ // Sentinels may be in the DOM but they're part of the prosemirror placeholder structure which is replaced with the fully rendered React node.
370
+ if (sentinelsInDom() && !isInitialProsemirrorToDomRender) {
371
+ // great - DOM ready, observe as normal
372
+ observeStickySentinels();
395
373
  } else {
396
- if (sentinelsInDom()) {
397
- // great - DOM ready, observe as normal
398
- observeStickySentinels();
399
- } else {
400
- // concurrent loading issue - here TableRow is too eager trying to
401
- // observe sentinels before they are in the DOM, use MutationObserver
402
- // to wait for sentinels to be added to the parent Table node DOM
403
- // then attach the IntersectionObserver
404
- const tableContainerObserver = new MutationObserver(() => {
405
- if (sentinelsInDom()) {
406
- observeStickySentinels();
407
- tableContainerObserver.disconnect();
408
- }
409
- });
410
-
411
- const mutatingNode = tableContainer;
412
- if (mutatingNode) {
413
- tableContainerObserver.observe(mutatingNode, { subtree: true, childList: true });
374
+ // concurrent loading issue - here TableRow is too eager trying to
375
+ // observe sentinels before they are in the DOM, use MutationObserver
376
+ // to wait for sentinels to be added to the parent Table node DOM
377
+ // then attach the IntersectionObserver
378
+ this.tableContainerObserver = new MutationObserver(() => {
379
+ // Check if the tableContainer is still connected to the DOM. It can become disconnected when the placholder
380
+ // prosemirror node is replaced with the fully rendered React node (see _handleTableRef).
381
+
382
+ if (!tableContainer || !tableContainer.isConnected) {
383
+ tableContainer = getTableContainer();
384
+ }
385
+ if (sentinelsInDom()) {
386
+ observeStickySentinels();
387
+ this.tableContainerObserver?.disconnect();
414
388
  }
389
+ });
390
+
391
+ const mutatingNode = tableContainer;
392
+ if (mutatingNode && this.tableContainerObserver) {
393
+ this.tableContainerObserver.observe(mutatingNode, { subtree: true, childList: true });
415
394
  }
416
395
  }
417
396
  }
@@ -13,7 +13,7 @@ import type {
13
13
  getPosHandlerNode,
14
14
  } from '@atlaskit/editor-common/types';
15
15
  import { WithPluginState } from '@atlaskit/editor-common/with-plugin-state';
16
- import type { DOMOutputSpec, Node as PmNode } from '@atlaskit/editor-prosemirror/model';
16
+ import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
17
17
  import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
18
18
  import {
19
19
  type EditorState,
@@ -30,7 +30,6 @@ import { pluginKey as tableDragAndDropPluginKey } from '../pm-plugins/drag-and-d
30
30
  import { getPluginState } from '../pm-plugins/plugin-factory';
31
31
  import { pluginKey } from '../pm-plugins/plugin-key';
32
32
  import { pluginKey as tableResizingPluginKey } from '../pm-plugins/table-resizing/plugin-key';
33
- import { generateColgroup } from '../pm-plugins/table-resizing/utils/colgroup';
34
33
  import { pluginKey as tableWidthPluginKey } from '../pm-plugins/table-width';
35
34
  import { isTableNested } from '../pm-plugins/utils/nodes';
36
35
  import type { PluginInjectionAPI } from '../types';
@@ -90,15 +89,6 @@ const handleInlineTableWidth = (table: HTMLElement, width: number | undefined) =
90
89
  table.style.setProperty('width', `${width}px`);
91
90
  };
92
91
 
93
- // Remove after removing the platform_editor_table_initial_load_fix flag.
94
- const toDOM = (node: PmNode, props: Props) => {
95
- let colgroup: DOMOutputSpec = '';
96
- if (props.allowColumnResizing) {
97
- colgroup = ['colgroup', {}, ...generateColgroup(node)];
98
- }
99
- return ['table', tableAttributes(node), colgroup, ['tbody', 0]] as DOMOutputSpec;
100
- };
101
-
102
92
  export default class TableView extends ReactNodeView<Props> {
103
93
  private table: HTMLElement | undefined;
104
94
  private renderedDOM?: HTMLElement;
@@ -122,22 +112,15 @@ export default class TableView extends ReactNodeView<Props> {
122
112
  this.options = props.options;
123
113
  this.getEditorFeatureFlags = props.getEditorFeatureFlags;
124
114
 
125
- if (fg('platform_editor_table_initial_load_fix')) {
126
- this.handleRef = (node: HTMLElement | null) => this._handleTableRef(node);
127
- }
115
+ this.handleRef = (node: HTMLElement | null) => this._handleTableRef(node);
128
116
  }
129
117
 
130
118
  getContentDOM() {
131
- let tableDOMStructure;
132
- if (fg('platform_editor_table_initial_load_fix')) {
133
- tableDOMStructure = tableNodeSpecWithFixedToDOM({
134
- allowColumnResizing: !!this.reactComponentProps.allowColumnResizing,
135
- tableResizingEnabled: !!this.reactComponentProps.allowTableResizing,
136
- getEditorContainerWidth: this.reactComponentProps.getEditorContainerWidth,
137
- }).toDOM(this.node);
138
- } else {
139
- tableDOMStructure = toDOM(this.node, this.reactComponentProps as Props);
140
- }
119
+ const tableDOMStructure = tableNodeSpecWithFixedToDOM({
120
+ allowColumnResizing: !!this.reactComponentProps.allowColumnResizing,
121
+ tableResizingEnabled: !!this.reactComponentProps.allowTableResizing,
122
+ getEditorContainerWidth: this.reactComponentProps.getEditorContainerWidth,
123
+ }).toDOM(this.node);
141
124
 
142
125
  const rendered = DOMSerializer.renderSpec(document, tableDOMStructure) as {
143
126
  dom: HTMLElement;
@@ -145,13 +128,9 @@ export default class TableView extends ReactNodeView<Props> {
145
128
  };
146
129
 
147
130
  if (rendered.dom) {
148
- if (fg('platform_editor_table_initial_load_fix')) {
149
- const tableElement = rendered.dom.querySelector('table');
150
- this.table = tableElement ? tableElement : rendered.dom;
151
- this.renderedDOM = rendered.dom;
152
- } else {
153
- this.table = rendered.dom;
154
- }
131
+ const tableElement = rendered.dom.querySelector('table');
132
+ this.table = tableElement ? tableElement : rendered.dom;
133
+ this.renderedDOM = rendered.dom;
155
134
 
156
135
  if (
157
136
  !this.options?.isTableScalingEnabled ||