@atlaskit/editor-plugin-table 38.0.6 → 38.0.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 +24 -0
- package/dist/cjs/nodeviews/TableComponentWithSharedState.js +8 -2
- package/dist/cjs/nodeviews/TableRow.js +47 -14
- package/dist/cjs/nodeviews/TableRowNativeStickyWithFallback.js +54 -19
- package/dist/es2019/nodeviews/TableComponentWithSharedState.js +8 -2
- package/dist/es2019/nodeviews/TableRow.js +45 -18
- package/dist/es2019/nodeviews/TableRowNativeStickyWithFallback.js +52 -23
- package/dist/esm/nodeviews/TableComponentWithSharedState.js +8 -2
- package/dist/esm/nodeviews/TableRow.js +47 -14
- package/dist/esm/nodeviews/TableRowNativeStickyWithFallback.js +54 -19
- package/dist/types/nodeviews/TableRow.d.ts +3 -0
- package/dist/types/nodeviews/TableRowNativeStickyWithFallback.d.ts +3 -0
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 38.0.9
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`752e644c309ef`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/752e644c309ef) -
|
|
8
|
+
Avoid re-rendering every table when the selection changes by selecting only selection state that
|
|
9
|
+
is relevant to each table, behind the `platform_editor_reduce_memory_leaks` experiment.
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 38.0.8
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
18
|
+
## 38.0.7
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- [`52195baa604db`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/52195baa604db) -
|
|
23
|
+
Fix table row node views leaking event listeners on destroy, behind the
|
|
24
|
+
`platform_editor_reduce_memory_leaks` experiment.
|
|
25
|
+
- Updated dependencies
|
|
26
|
+
|
|
3
27
|
## 38.0.6
|
|
4
28
|
|
|
5
29
|
### Patch Changes
|
|
@@ -8,10 +8,16 @@ exports.TableComponentWithSharedState = void 0;
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _useSharedPluginStateWithSelector = require("@atlaskit/editor-common/useSharedPluginStateWithSelector");
|
|
10
10
|
var _editorTables = require("@atlaskit/editor-tables");
|
|
11
|
+
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
11
12
|
var _TableComponent = _interopRequireDefault(require("./TableComponent"));
|
|
12
13
|
// Ignored via go/ees005
|
|
13
14
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14
15
|
|
|
16
|
+
var getSelectionWithinTable = function getSelectionWithinTable(selection, tableNode) {
|
|
17
|
+
var found = selection && (0, _editorTables.findTable)(selection);
|
|
18
|
+
return found && found.node === tableNode ? selection : undefined;
|
|
19
|
+
};
|
|
20
|
+
|
|
15
21
|
/**
|
|
16
22
|
* Use useSharedPluginState to control re-renders from plugin dependencies
|
|
17
23
|
*/
|
|
@@ -31,7 +37,7 @@ var TableComponentWithSharedState = exports.TableComponentWithSharedState = func
|
|
|
31
37
|
allowTableResizing = _ref.allowTableResizing,
|
|
32
38
|
allowFixedColumnWidthOption = _ref.allowFixedColumnWidthOption;
|
|
33
39
|
var _useSharedPluginState = (0, _useSharedPluginStateWithSelector.useSharedPluginStateWithSelector)(api, ['table', 'width', 'media', 'selection', 'editorViewMode', 'interaction', 'limitedMode'], function (states) {
|
|
34
|
-
var _states$tableState, _states$tableState2, _states$tableState3, _states$tableState4, _states$tableState5, _states$tableState6, _states$tableState7, _states$tableState8, _states$tableState9, _states$tableState0, _states$tableState1, _states$mediaState, _states$selectionStat, _states$editorViewMod, _states$widthState, _states$widthState2, _states$interactionSt, _states$limitedModeSt;
|
|
40
|
+
var _states$tableState, _states$tableState2, _states$tableState3, _states$tableState4, _states$tableState5, _states$tableState6, _states$tableState7, _states$tableState8, _states$tableState9, _states$tableState0, _states$tableState1, _states$mediaState, _states$selectionStat, _states$selectionStat2, _states$editorViewMod, _states$widthState, _states$widthState2, _states$interactionSt, _states$limitedModeSt;
|
|
35
41
|
return {
|
|
36
42
|
// tableState
|
|
37
43
|
isTableResizing: (_states$tableState = states.tableState) === null || _states$tableState === void 0 ? void 0 : _states$tableState.isTableResizing,
|
|
@@ -49,7 +55,7 @@ var TableComponentWithSharedState = exports.TableComponentWithSharedState = func
|
|
|
49
55
|
// mediaState
|
|
50
56
|
isFullscreen: (_states$mediaState = states.mediaState) === null || _states$mediaState === void 0 ? void 0 : _states$mediaState.isFullscreen,
|
|
51
57
|
// selectionState
|
|
52
|
-
selection: (_states$selectionStat = states.selectionState) === null || _states$selectionStat === void 0 ? void 0 : _states$selectionStat.selection,
|
|
58
|
+
selection: (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_reduce_memory_leaks') ? getSelectionWithinTable((_states$selectionStat = states.selectionState) === null || _states$selectionStat === void 0 ? void 0 : _states$selectionStat.selection, getNode()) : (_states$selectionStat2 = states.selectionState) === null || _states$selectionStat2 === void 0 ? void 0 : _states$selectionStat2.selection,
|
|
53
59
|
// editorViewModeState
|
|
54
60
|
mode: (_states$editorViewMod = states.editorViewModeState) === null || _states$editorViewMod === void 0 ? void 0 : _states$editorViewMod.mode,
|
|
55
61
|
// widthState
|
|
@@ -89,6 +89,15 @@ var TableRow = exports.default = /*#__PURE__*/function (_TableNodeView) {
|
|
|
89
89
|
_this.headerRowMouseScrollEnd();
|
|
90
90
|
}
|
|
91
91
|
}, HEADER_ROW_SCROLL_THROTTLE_TIMEOUT));
|
|
92
|
+
(0, _defineProperty2.default)(_this, "onWidthPluginEvent", function () {
|
|
93
|
+
return _this.updateStickyHeaderWidth();
|
|
94
|
+
});
|
|
95
|
+
(0, _defineProperty2.default)(_this, "onTablePluginEvent", function (state) {
|
|
96
|
+
return _this.onTablePluginState(state);
|
|
97
|
+
});
|
|
98
|
+
(0, _defineProperty2.default)(_this, "onScrollEnd", function () {
|
|
99
|
+
return _this.refireIntersectionObservers();
|
|
100
|
+
});
|
|
92
101
|
_this.isSticky = false;
|
|
93
102
|
var _getPluginState = (0, _pluginFactory.getPluginState)(view.state),
|
|
94
103
|
pluginConfig = _getPluginState.pluginConfig;
|
|
@@ -215,13 +224,20 @@ var TableRow = exports.default = /*#__PURE__*/function (_TableNodeView) {
|
|
|
215
224
|
value: function destroy() {
|
|
216
225
|
if (this.isStickyHeaderEnabled) {
|
|
217
226
|
this.unsubscribe();
|
|
218
|
-
|
|
227
|
+
if (!(0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_reduce_memory_leaks')) {
|
|
228
|
+
this.nodeVisibilityObserverCleanupFn && this.nodeVisibilityObserverCleanupFn();
|
|
229
|
+
}
|
|
219
230
|
var tree = (0, _dom2.getTree)(this.dom);
|
|
220
231
|
if (tree) {
|
|
221
232
|
this.makeRowHeaderNotSticky(tree.table, true);
|
|
222
233
|
}
|
|
223
234
|
this.emitOff(true);
|
|
224
235
|
}
|
|
236
|
+
if ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_reduce_memory_leaks')) {
|
|
237
|
+
var _this$nodeVisibilityO;
|
|
238
|
+
(_this$nodeVisibilityO = this.nodeVisibilityObserverCleanupFn) === null || _this$nodeVisibilityO === void 0 || _this$nodeVisibilityO.call(this);
|
|
239
|
+
this.nodeVisibilityObserverCleanupFn = undefined;
|
|
240
|
+
}
|
|
225
241
|
if ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_dynamic_limited_mode')) {
|
|
226
242
|
var _this$limitedModeUnsu2;
|
|
227
243
|
(_this$limitedModeUnsu2 = this.limitedModeUnsubscribe) === null || _this$limitedModeUnsu2 === void 0 || _this$limitedModeUnsu2.call(this);
|
|
@@ -269,21 +285,28 @@ var TableRow = exports.default = /*#__PURE__*/function (_TableNodeView) {
|
|
|
269
285
|
this.initObservers();
|
|
270
286
|
this.topPosEditorElement = (0, _dom2.getTop)(this.editorScrollableElement);
|
|
271
287
|
}
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
288
|
+
if ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_reduce_memory_leaks')) {
|
|
289
|
+
this.eventDispatcher.on('widthPlugin', this.onWidthPluginEvent);
|
|
290
|
+
// Ignored via go/ees005
|
|
291
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
292
|
+
this.eventDispatcher.on(_pluginKey.pluginKey.key, this.onTablePluginEvent);
|
|
293
|
+
} else {
|
|
294
|
+
this.eventDispatcher.on('widthPlugin', this.updateStickyHeaderWidth.bind(this));
|
|
295
|
+
// Ignored via go/ees005
|
|
296
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
297
|
+
this.eventDispatcher.on(_pluginKey.pluginKey.key, this.onTablePluginState.bind(this));
|
|
298
|
+
}
|
|
277
299
|
this.listening = true;
|
|
300
|
+
var scrollHandler = (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_reduce_memory_leaks') ? this.headerRowMouseScroll : this.headerRowMouseScroll.bind(this);
|
|
278
301
|
|
|
279
302
|
// Ignored via go/ees005
|
|
280
303
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
281
|
-
this.dom.addEventListener('wheel',
|
|
304
|
+
this.dom.addEventListener('wheel', scrollHandler, {
|
|
282
305
|
passive: true
|
|
283
306
|
});
|
|
284
307
|
// Ignored via go/ees005
|
|
285
308
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
286
|
-
this.dom.addEventListener('touchmove',
|
|
309
|
+
this.dom.addEventListener('touchmove', scrollHandler, {
|
|
287
310
|
passive: true
|
|
288
311
|
});
|
|
289
312
|
}
|
|
@@ -306,10 +329,20 @@ var TableRow = exports.default = /*#__PURE__*/function (_TableNodeView) {
|
|
|
306
329
|
if (this.resizeObserver) {
|
|
307
330
|
this.resizeObserver.disconnect();
|
|
308
331
|
}
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
332
|
+
if ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_reduce_memory_leaks')) {
|
|
333
|
+
var _this$editorScrollabl;
|
|
334
|
+
this.eventDispatcher.off('widthPlugin', this.onWidthPluginEvent);
|
|
335
|
+
// Ignored via go/ees005
|
|
336
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
337
|
+
this.eventDispatcher.off(_pluginKey.pluginKey.key, this.onTablePluginEvent);
|
|
338
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
339
|
+
(_this$editorScrollabl = this.editorScrollableElement) === null || _this$editorScrollabl === void 0 || _this$editorScrollabl.removeEventListener('scrollend', this.onScrollEnd);
|
|
340
|
+
} else {
|
|
341
|
+
this.eventDispatcher.off('widthPlugin', this.updateStickyHeaderWidth);
|
|
342
|
+
// Ignored via go/ees005
|
|
343
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
344
|
+
this.eventDispatcher.off(_pluginKey.pluginKey.key, this.onTablePluginState);
|
|
345
|
+
}
|
|
313
346
|
this.listening = false;
|
|
314
347
|
|
|
315
348
|
// Ignored via go/ees005
|
|
@@ -680,7 +713,7 @@ var TableRow = exports.default = /*#__PURE__*/function (_TableNodeView) {
|
|
|
680
713
|
}
|
|
681
714
|
var domTop = currentTableTop > 0 ? scrollTop : scrollTop + currentTableTop;
|
|
682
715
|
if (!this.isSticky) {
|
|
683
|
-
var _this$
|
|
716
|
+
var _this$editorScrollabl2;
|
|
684
717
|
(0, _dom.syncStickyRowToTable)(table);
|
|
685
718
|
this.dom.classList.add('sticky');
|
|
686
719
|
table.classList.add(_types.TableCssClassName.TABLE_STICKY);
|
|
@@ -693,7 +726,7 @@ var TableRow = exports.default = /*#__PURE__*/function (_TableNodeView) {
|
|
|
693
726
|
*/
|
|
694
727
|
// Ignored via go/ees005
|
|
695
728
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
696
|
-
(_this$
|
|
729
|
+
(_this$editorScrollabl2 = this.editorScrollableElement) === null || _this$editorScrollabl2 === void 0 || _this$editorScrollabl2.addEventListener('scrollend', (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_reduce_memory_leaks') ? this.onScrollEnd : this.refireIntersectionObservers, {
|
|
697
730
|
passive: true,
|
|
698
731
|
once: true
|
|
699
732
|
});
|
|
@@ -98,6 +98,15 @@ var TableRowNativeStickyWithFallback = exports.default = /*#__PURE__*/function (
|
|
|
98
98
|
_this.headerRowMouseScrollEnd();
|
|
99
99
|
}
|
|
100
100
|
}, HEADER_ROW_SCROLL_THROTTLE_TIMEOUT));
|
|
101
|
+
(0, _defineProperty2.default)(_this, "onWidthPluginEvent", function () {
|
|
102
|
+
return _this.updateStickyHeaderWidth();
|
|
103
|
+
});
|
|
104
|
+
(0, _defineProperty2.default)(_this, "onTablePluginEvent", function (state) {
|
|
105
|
+
return _this.onTablePluginState(state);
|
|
106
|
+
});
|
|
107
|
+
(0, _defineProperty2.default)(_this, "onScrollEnd", function () {
|
|
108
|
+
return _this.refireIntersectionObservers();
|
|
109
|
+
});
|
|
101
110
|
(0, _defineProperty2.default)(_this, "toggleDisableNativeSticky", function (headerHeight, viewportHeight) {
|
|
102
111
|
if (!_this.disableNativeSticky && headerHeight > viewportHeight * 0.5) {
|
|
103
112
|
_this.disableNativeSticky = true;
|
|
@@ -261,13 +270,22 @@ var TableRowNativeStickyWithFallback = exports.default = /*#__PURE__*/function (
|
|
|
261
270
|
this.overflowObserverEntries = undefined;
|
|
262
271
|
this.stickyStateObserver && this.stickyStateObserver.disconnect();
|
|
263
272
|
(_this$nodeVisibilityO = this.nodeVisibilityObserver) === null || _this$nodeVisibilityO === void 0 || _this$nodeVisibilityO.disconnect();
|
|
264
|
-
|
|
273
|
+
if (!(0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_reduce_memory_leaks')) {
|
|
274
|
+
this.nodeVisibilityObserverCleanupFn && this.nodeVisibilityObserverCleanupFn();
|
|
275
|
+
}
|
|
265
276
|
var tree = (0, _dom2.getTree)(this.dom);
|
|
266
277
|
if (tree) {
|
|
267
278
|
this.makeRowHeaderNotLegacySticky(tree.table, true);
|
|
268
279
|
}
|
|
269
280
|
this.emitOff(true);
|
|
270
281
|
}
|
|
282
|
+
if ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_reduce_memory_leaks')) {
|
|
283
|
+
var _this$nodeVisibilityO2, _this$onEditorContent2;
|
|
284
|
+
(_this$nodeVisibilityO2 = this.nodeVisibilityObserverCleanupFn) === null || _this$nodeVisibilityO2 === void 0 || _this$nodeVisibilityO2.call(this);
|
|
285
|
+
this.nodeVisibilityObserverCleanupFn = undefined;
|
|
286
|
+
(_this$onEditorContent2 = this.onEditorContentAreaHeightChange) === null || _this$onEditorContent2 === void 0 || _this$onEditorContent2.call(this);
|
|
287
|
+
this.onEditorContentAreaHeightChange = undefined;
|
|
288
|
+
}
|
|
271
289
|
if ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_dynamic_limited_mode')) {
|
|
272
290
|
var _this$limitedModeUnsu2;
|
|
273
291
|
(_this$limitedModeUnsu2 = this.limitedModeUnsubscribe) === null || _this$limitedModeUnsu2 === void 0 || _this$limitedModeUnsu2.call(this);
|
|
@@ -358,21 +376,28 @@ var TableRowNativeStickyWithFallback = exports.default = /*#__PURE__*/function (
|
|
|
358
376
|
once: true
|
|
359
377
|
});
|
|
360
378
|
}
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
379
|
+
if ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_reduce_memory_leaks')) {
|
|
380
|
+
this.eventDispatcher.on('widthPlugin', this.onWidthPluginEvent);
|
|
381
|
+
// Ignored via go/ees005
|
|
382
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
383
|
+
this.eventDispatcher.on(_pluginKey.pluginKey.key, this.onTablePluginEvent);
|
|
384
|
+
} else {
|
|
385
|
+
this.eventDispatcher.on('widthPlugin', this.updateStickyHeaderWidth.bind(this));
|
|
386
|
+
// Ignored via go/ees005
|
|
387
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
388
|
+
this.eventDispatcher.on(_pluginKey.pluginKey.key, this.onTablePluginState.bind(this));
|
|
389
|
+
}
|
|
366
390
|
this.listening = true;
|
|
391
|
+
var scrollHandler = (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_reduce_memory_leaks') ? this.headerRowMouseScroll : this.headerRowMouseScroll.bind(this);
|
|
367
392
|
|
|
368
393
|
// Ignored via go/ees005
|
|
369
394
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
370
|
-
this.dom.addEventListener('wheel',
|
|
395
|
+
this.dom.addEventListener('wheel', scrollHandler, {
|
|
371
396
|
passive: true
|
|
372
397
|
});
|
|
373
398
|
// Ignored via go/ees005
|
|
374
399
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
375
|
-
this.dom.addEventListener('touchmove',
|
|
400
|
+
this.dom.addEventListener('touchmove', scrollHandler, {
|
|
376
401
|
passive: true
|
|
377
402
|
});
|
|
378
403
|
}
|
|
@@ -400,10 +425,20 @@ var TableRowNativeStickyWithFallback = exports.default = /*#__PURE__*/function (
|
|
|
400
425
|
this.editorScrollableElement.removeEventListener('scroll', this.scrollListener);
|
|
401
426
|
this.scrollListener = undefined;
|
|
402
427
|
}
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
428
|
+
if ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_reduce_memory_leaks')) {
|
|
429
|
+
var _this$editorScrollabl;
|
|
430
|
+
this.eventDispatcher.off('widthPlugin', this.onWidthPluginEvent);
|
|
431
|
+
// Ignored via go/ees005
|
|
432
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
433
|
+
this.eventDispatcher.off(_pluginKey.pluginKey.key, this.onTablePluginEvent);
|
|
434
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
435
|
+
(_this$editorScrollabl = this.editorScrollableElement) === null || _this$editorScrollabl === void 0 || _this$editorScrollabl.removeEventListener('scrollend', this.onScrollEnd);
|
|
436
|
+
} else {
|
|
437
|
+
this.eventDispatcher.off('widthPlugin', this.updateStickyHeaderWidth);
|
|
438
|
+
// Ignored via go/ees005
|
|
439
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
440
|
+
this.eventDispatcher.off(_pluginKey.pluginKey.key, this.onTablePluginState);
|
|
441
|
+
}
|
|
407
442
|
this.listening = false;
|
|
408
443
|
|
|
409
444
|
// Ignored via go/ees005
|
|
@@ -527,9 +562,9 @@ var TableRowNativeStickyWithFallback = exports.default = /*#__PURE__*/function (
|
|
|
527
562
|
this.initNodeVisibilityObserver();
|
|
528
563
|
var closestTable = this.dom.closest('table');
|
|
529
564
|
if (closestTable) {
|
|
530
|
-
var _this$overflowObserve, _this$
|
|
565
|
+
var _this$overflowObserve, _this$nodeVisibilityO3;
|
|
531
566
|
(_this$overflowObserve = this.overflowObserver) === null || _this$overflowObserve === void 0 || _this$overflowObserve.observe(closestTable);
|
|
532
|
-
(_this$
|
|
567
|
+
(_this$nodeVisibilityO3 = this.nodeVisibilityObserver) === null || _this$nodeVisibilityO3 === void 0 || _this$nodeVisibilityO3.observe(closestTable);
|
|
533
568
|
}
|
|
534
569
|
this.initStickyStateObserver();
|
|
535
570
|
(_this$stickyStateObse = this.stickyStateObserver) === null || _this$stickyStateObse === void 0 || _this$stickyStateObse.observe(this.dom);
|
|
@@ -949,11 +984,11 @@ var TableRowNativeStickyWithFallback = exports.default = /*#__PURE__*/function (
|
|
|
949
984
|
var _this$stickyStateObse2, _this$stickyStateObse3;
|
|
950
985
|
var table = this.dom.closest('table');
|
|
951
986
|
if (table) {
|
|
952
|
-
var _this$overflowObserve2, _this$overflowObserve3, _this$
|
|
987
|
+
var _this$overflowObserve2, _this$overflowObserve3, _this$nodeVisibilityO4, _this$nodeVisibilityO5;
|
|
953
988
|
(_this$overflowObserve2 = this.overflowObserver) === null || _this$overflowObserve2 === void 0 || _this$overflowObserve2.unobserve(table);
|
|
954
989
|
(_this$overflowObserve3 = this.overflowObserver) === null || _this$overflowObserve3 === void 0 || _this$overflowObserve3.observe(table);
|
|
955
|
-
(_this$
|
|
956
|
-
(_this$
|
|
990
|
+
(_this$nodeVisibilityO4 = this.nodeVisibilityObserver) === null || _this$nodeVisibilityO4 === void 0 || _this$nodeVisibilityO4.unobserve(table);
|
|
991
|
+
(_this$nodeVisibilityO5 = this.nodeVisibilityObserver) === null || _this$nodeVisibilityO5 === void 0 || _this$nodeVisibilityO5.observe(table);
|
|
957
992
|
}
|
|
958
993
|
(_this$stickyStateObse2 = this.stickyStateObserver) === null || _this$stickyStateObse2 === void 0 || _this$stickyStateObse2.unobserve(this.dom);
|
|
959
994
|
(_this$stickyStateObse3 = this.stickyStateObserver) === null || _this$stickyStateObse3 === void 0 || _this$stickyStateObse3.observe(this.dom);
|
|
@@ -982,7 +1017,7 @@ var TableRowNativeStickyWithFallback = exports.default = /*#__PURE__*/function (
|
|
|
982
1017
|
}
|
|
983
1018
|
var domTop = currentTableTop > 0 ? scrollTop : scrollTop + currentTableTop;
|
|
984
1019
|
if (!this.isLegacySticky) {
|
|
985
|
-
var _this$
|
|
1020
|
+
var _this$editorScrollabl2;
|
|
986
1021
|
(0, _dom.syncStickyRowToTable)(table);
|
|
987
1022
|
this.dom.classList.add('sticky');
|
|
988
1023
|
table.classList.add(_types.TableCssClassName.TABLE_STICKY);
|
|
@@ -995,7 +1030,7 @@ var TableRowNativeStickyWithFallback = exports.default = /*#__PURE__*/function (
|
|
|
995
1030
|
*/
|
|
996
1031
|
// Ignored via go/ees005
|
|
997
1032
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
998
|
-
(_this$
|
|
1033
|
+
(_this$editorScrollabl2 = this.editorScrollableElement) === null || _this$editorScrollabl2 === void 0 || _this$editorScrollabl2.addEventListener('scrollend', (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_reduce_memory_leaks') ? this.onScrollEnd : this.refireIntersectionObservers, {
|
|
999
1034
|
passive: true,
|
|
1000
1035
|
once: true
|
|
1001
1036
|
});
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/useSharedPluginStateWithSelector';
|
|
3
3
|
import { findTable } from '@atlaskit/editor-tables';
|
|
4
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
4
5
|
import TableComponent from './TableComponent';
|
|
5
6
|
|
|
6
7
|
// Ignored via go/ees005
|
|
7
8
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
8
9
|
|
|
10
|
+
const getSelectionWithinTable = (selection, tableNode) => {
|
|
11
|
+
const found = selection && findTable(selection);
|
|
12
|
+
return found && found.node === tableNode ? selection : undefined;
|
|
13
|
+
};
|
|
14
|
+
|
|
9
15
|
/**
|
|
10
16
|
* Use useSharedPluginState to control re-renders from plugin dependencies
|
|
11
17
|
*/
|
|
@@ -44,7 +50,7 @@ export const TableComponentWithSharedState = ({
|
|
|
44
50
|
width,
|
|
45
51
|
limitedModeEnabled
|
|
46
52
|
} = useSharedPluginStateWithSelector(api, ['table', 'width', 'media', 'selection', 'editorViewMode', 'interaction', 'limitedMode'], states => {
|
|
47
|
-
var _states$tableState, _states$tableState2, _states$tableState3, _states$tableState4, _states$tableState5, _states$tableState6, _states$tableState7, _states$tableState8, _states$tableState9, _states$tableState0, _states$tableState1, _states$mediaState, _states$selectionStat, _states$editorViewMod, _states$widthState, _states$widthState2, _states$interactionSt, _states$limitedModeSt;
|
|
53
|
+
var _states$tableState, _states$tableState2, _states$tableState3, _states$tableState4, _states$tableState5, _states$tableState6, _states$tableState7, _states$tableState8, _states$tableState9, _states$tableState0, _states$tableState1, _states$mediaState, _states$selectionStat, _states$selectionStat2, _states$editorViewMod, _states$widthState, _states$widthState2, _states$interactionSt, _states$limitedModeSt;
|
|
48
54
|
return {
|
|
49
55
|
// tableState
|
|
50
56
|
isTableResizing: (_states$tableState = states.tableState) === null || _states$tableState === void 0 ? void 0 : _states$tableState.isTableResizing,
|
|
@@ -62,7 +68,7 @@ export const TableComponentWithSharedState = ({
|
|
|
62
68
|
// mediaState
|
|
63
69
|
isFullscreen: (_states$mediaState = states.mediaState) === null || _states$mediaState === void 0 ? void 0 : _states$mediaState.isFullscreen,
|
|
64
70
|
// selectionState
|
|
65
|
-
selection: (_states$selectionStat = states.selectionState) === null || _states$selectionStat === void 0 ? void 0 : _states$selectionStat.selection,
|
|
71
|
+
selection: isExperimentEnabled('platform_editor_reduce_memory_leaks') ? getSelectionWithinTable((_states$selectionStat = states.selectionState) === null || _states$selectionStat === void 0 ? void 0 : _states$selectionStat.selection, getNode()) : (_states$selectionStat2 = states.selectionState) === null || _states$selectionStat2 === void 0 ? void 0 : _states$selectionStat2.selection,
|
|
66
72
|
// editorViewModeState
|
|
67
73
|
mode: (_states$editorViewMod = states.editorViewModeState) === null || _states$editorViewMod === void 0 ? void 0 : _states$editorViewMod.mode,
|
|
68
74
|
// widthState
|
|
@@ -73,6 +73,9 @@ export default class TableRow extends TableNodeView {
|
|
|
73
73
|
this.headerRowMouseScrollEnd();
|
|
74
74
|
}
|
|
75
75
|
}, HEADER_ROW_SCROLL_THROTTLE_TIMEOUT));
|
|
76
|
+
_defineProperty(this, "onWidthPluginEvent", () => this.updateStickyHeaderWidth());
|
|
77
|
+
_defineProperty(this, "onTablePluginEvent", state => this.onTablePluginState(state));
|
|
78
|
+
_defineProperty(this, "onScrollEnd", () => this.refireIntersectionObservers());
|
|
76
79
|
this.isSticky = false;
|
|
77
80
|
const {
|
|
78
81
|
pluginConfig
|
|
@@ -194,13 +197,20 @@ export default class TableRow extends TableNodeView {
|
|
|
194
197
|
destroy() {
|
|
195
198
|
if (this.isStickyHeaderEnabled) {
|
|
196
199
|
this.unsubscribe();
|
|
197
|
-
|
|
200
|
+
if (!isExperimentEnabled('platform_editor_reduce_memory_leaks')) {
|
|
201
|
+
this.nodeVisibilityObserverCleanupFn && this.nodeVisibilityObserverCleanupFn();
|
|
202
|
+
}
|
|
198
203
|
const tree = getTree(this.dom);
|
|
199
204
|
if (tree) {
|
|
200
205
|
this.makeRowHeaderNotSticky(tree.table, true);
|
|
201
206
|
}
|
|
202
207
|
this.emitOff(true);
|
|
203
208
|
}
|
|
209
|
+
if (isExperimentEnabled('platform_editor_reduce_memory_leaks')) {
|
|
210
|
+
var _this$nodeVisibilityO;
|
|
211
|
+
(_this$nodeVisibilityO = this.nodeVisibilityObserverCleanupFn) === null || _this$nodeVisibilityO === void 0 ? void 0 : _this$nodeVisibilityO.call(this);
|
|
212
|
+
this.nodeVisibilityObserverCleanupFn = undefined;
|
|
213
|
+
}
|
|
204
214
|
if (isExperimentEnabled('platform_editor_dynamic_limited_mode')) {
|
|
205
215
|
var _this$limitedModeUnsu2;
|
|
206
216
|
(_this$limitedModeUnsu2 = this.limitedModeUnsubscribe) === null || _this$limitedModeUnsu2 === void 0 ? void 0 : _this$limitedModeUnsu2.call(this);
|
|
@@ -244,21 +254,28 @@ export default class TableRow extends TableNodeView {
|
|
|
244
254
|
this.initObservers();
|
|
245
255
|
this.topPosEditorElement = getTop(this.editorScrollableElement);
|
|
246
256
|
}
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
257
|
+
if (isExperimentEnabled('platform_editor_reduce_memory_leaks')) {
|
|
258
|
+
this.eventDispatcher.on('widthPlugin', this.onWidthPluginEvent);
|
|
259
|
+
// Ignored via go/ees005
|
|
260
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
261
|
+
this.eventDispatcher.on(tablePluginKey.key, this.onTablePluginEvent);
|
|
262
|
+
} else {
|
|
263
|
+
this.eventDispatcher.on('widthPlugin', this.updateStickyHeaderWidth.bind(this));
|
|
264
|
+
// Ignored via go/ees005
|
|
265
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
266
|
+
this.eventDispatcher.on(tablePluginKey.key, this.onTablePluginState.bind(this));
|
|
267
|
+
}
|
|
252
268
|
this.listening = true;
|
|
269
|
+
const scrollHandler = isExperimentEnabled('platform_editor_reduce_memory_leaks') ? this.headerRowMouseScroll : this.headerRowMouseScroll.bind(this);
|
|
253
270
|
|
|
254
271
|
// Ignored via go/ees005
|
|
255
272
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
256
|
-
this.dom.addEventListener('wheel',
|
|
273
|
+
this.dom.addEventListener('wheel', scrollHandler, {
|
|
257
274
|
passive: true
|
|
258
275
|
});
|
|
259
276
|
// Ignored via go/ees005
|
|
260
277
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
261
|
-
this.dom.addEventListener('touchmove',
|
|
278
|
+
this.dom.addEventListener('touchmove', scrollHandler, {
|
|
262
279
|
passive: true
|
|
263
280
|
});
|
|
264
281
|
}
|
|
@@ -279,10 +296,20 @@ export default class TableRow extends TableNodeView {
|
|
|
279
296
|
if (this.resizeObserver) {
|
|
280
297
|
this.resizeObserver.disconnect();
|
|
281
298
|
}
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
299
|
+
if (isExperimentEnabled('platform_editor_reduce_memory_leaks')) {
|
|
300
|
+
var _this$editorScrollabl;
|
|
301
|
+
this.eventDispatcher.off('widthPlugin', this.onWidthPluginEvent);
|
|
302
|
+
// Ignored via go/ees005
|
|
303
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
304
|
+
this.eventDispatcher.off(tablePluginKey.key, this.onTablePluginEvent);
|
|
305
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
306
|
+
(_this$editorScrollabl = this.editorScrollableElement) === null || _this$editorScrollabl === void 0 ? void 0 : _this$editorScrollabl.removeEventListener('scrollend', this.onScrollEnd);
|
|
307
|
+
} else {
|
|
308
|
+
this.eventDispatcher.off('widthPlugin', this.updateStickyHeaderWidth);
|
|
309
|
+
// Ignored via go/ees005
|
|
310
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
311
|
+
this.eventDispatcher.off(tablePluginKey.key, this.onTablePluginState);
|
|
312
|
+
}
|
|
286
313
|
this.listening = false;
|
|
287
314
|
|
|
288
315
|
// Ignored via go/ees005
|
|
@@ -396,12 +423,12 @@ export default class TableRow extends TableNodeView {
|
|
|
396
423
|
table
|
|
397
424
|
} = tree;
|
|
398
425
|
entries.forEach(entry => {
|
|
399
|
-
var _this$
|
|
426
|
+
var _this$editorScrollabl2;
|
|
400
427
|
// On resize of the parent scroll element we need to adjust the width
|
|
401
428
|
// of the sticky header
|
|
402
429
|
// Ignored via go/ees005
|
|
403
430
|
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
404
|
-
if (entry.target.className === ((_this$
|
|
431
|
+
if (entry.target.className === ((_this$editorScrollabl2 = this.editorScrollableElement) === null || _this$editorScrollabl2 === void 0 ? void 0 : _this$editorScrollabl2.className)) {
|
|
405
432
|
this.updateStickyHeaderWidth();
|
|
406
433
|
} else {
|
|
407
434
|
const newHeight = entry.contentRect ? entry.contentRect.height :
|
|
@@ -422,11 +449,11 @@ export default class TableRow extends TableNodeView {
|
|
|
422
449
|
}
|
|
423
450
|
createIntersectionObserver() {
|
|
424
451
|
this.intersectionObserver = new IntersectionObserver((entries, _) => {
|
|
425
|
-
var _this$
|
|
452
|
+
var _this$editorScrollabl3, _this$editorScrollabl4;
|
|
426
453
|
// IMPORTANT: please try and avoid using entry.rootBounds it's terribly inconsistent. For example; sometimes it may return
|
|
427
454
|
// 0 height. In safari it will multiply all values by the window scale factor, however chrome & firfox won't.
|
|
428
455
|
// This is why i just get the scroll view bounding rect here and use it, and fallback to the entry.rootBounds if needed.
|
|
429
|
-
const rootBounds = (_this$
|
|
456
|
+
const rootBounds = (_this$editorScrollabl3 = this.editorScrollableElement) === null || _this$editorScrollabl3 === void 0 ? void 0 : (_this$editorScrollabl4 = _this$editorScrollabl3.getBoundingClientRect) === null || _this$editorScrollabl4 === void 0 ? void 0 : _this$editorScrollabl4.call(_this$editorScrollabl3);
|
|
430
457
|
entries.forEach(entry => {
|
|
431
458
|
const {
|
|
432
459
|
target,
|
|
@@ -636,7 +663,7 @@ export default class TableRow extends TableNodeView {
|
|
|
636
663
|
}
|
|
637
664
|
const domTop = currentTableTop > 0 ? scrollTop : scrollTop + currentTableTop;
|
|
638
665
|
if (!this.isSticky) {
|
|
639
|
-
var _this$
|
|
666
|
+
var _this$editorScrollabl5;
|
|
640
667
|
syncStickyRowToTable(table);
|
|
641
668
|
this.dom.classList.add('sticky');
|
|
642
669
|
table.classList.add(ClassName.TABLE_STICKY);
|
|
@@ -649,7 +676,7 @@ export default class TableRow extends TableNodeView {
|
|
|
649
676
|
*/
|
|
650
677
|
// Ignored via go/ees005
|
|
651
678
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
652
|
-
(_this$
|
|
679
|
+
(_this$editorScrollabl5 = this.editorScrollableElement) === null || _this$editorScrollabl5 === void 0 ? void 0 : _this$editorScrollabl5.addEventListener('scrollend', isExperimentEnabled('platform_editor_reduce_memory_leaks') ? this.onScrollEnd : this.refireIntersectionObservers, {
|
|
653
680
|
passive: true,
|
|
654
681
|
once: true
|
|
655
682
|
});
|
|
@@ -82,6 +82,9 @@ export default class TableRowNativeStickyWithFallback extends TableNodeView {
|
|
|
82
82
|
this.headerRowMouseScrollEnd();
|
|
83
83
|
}
|
|
84
84
|
}, HEADER_ROW_SCROLL_THROTTLE_TIMEOUT));
|
|
85
|
+
_defineProperty(this, "onWidthPluginEvent", () => this.updateStickyHeaderWidth());
|
|
86
|
+
_defineProperty(this, "onTablePluginEvent", state => this.onTablePluginState(state));
|
|
87
|
+
_defineProperty(this, "onScrollEnd", () => this.refireIntersectionObservers());
|
|
85
88
|
_defineProperty(this, "toggleDisableNativeSticky", (headerHeight, viewportHeight) => {
|
|
86
89
|
if (!this.disableNativeSticky && headerHeight > viewportHeight * 0.5) {
|
|
87
90
|
this.disableNativeSticky = true;
|
|
@@ -241,13 +244,22 @@ export default class TableRowNativeStickyWithFallback extends TableNodeView {
|
|
|
241
244
|
this.overflowObserverEntries = undefined;
|
|
242
245
|
this.stickyStateObserver && this.stickyStateObserver.disconnect();
|
|
243
246
|
(_this$nodeVisibilityO = this.nodeVisibilityObserver) === null || _this$nodeVisibilityO === void 0 ? void 0 : _this$nodeVisibilityO.disconnect();
|
|
244
|
-
|
|
247
|
+
if (!isExperimentEnabled('platform_editor_reduce_memory_leaks')) {
|
|
248
|
+
this.nodeVisibilityObserverCleanupFn && this.nodeVisibilityObserverCleanupFn();
|
|
249
|
+
}
|
|
245
250
|
const tree = getTree(this.dom);
|
|
246
251
|
if (tree) {
|
|
247
252
|
this.makeRowHeaderNotLegacySticky(tree.table, true);
|
|
248
253
|
}
|
|
249
254
|
this.emitOff(true);
|
|
250
255
|
}
|
|
256
|
+
if (isExperimentEnabled('platform_editor_reduce_memory_leaks')) {
|
|
257
|
+
var _this$nodeVisibilityO2, _this$onEditorContent2;
|
|
258
|
+
(_this$nodeVisibilityO2 = this.nodeVisibilityObserverCleanupFn) === null || _this$nodeVisibilityO2 === void 0 ? void 0 : _this$nodeVisibilityO2.call(this);
|
|
259
|
+
this.nodeVisibilityObserverCleanupFn = undefined;
|
|
260
|
+
(_this$onEditorContent2 = this.onEditorContentAreaHeightChange) === null || _this$onEditorContent2 === void 0 ? void 0 : _this$onEditorContent2.call(this);
|
|
261
|
+
this.onEditorContentAreaHeightChange = undefined;
|
|
262
|
+
}
|
|
251
263
|
if (isExperimentEnabled('platform_editor_dynamic_limited_mode')) {
|
|
252
264
|
var _this$limitedModeUnsu2;
|
|
253
265
|
(_this$limitedModeUnsu2 = this.limitedModeUnsubscribe) === null || _this$limitedModeUnsu2 === void 0 ? void 0 : _this$limitedModeUnsu2.call(this);
|
|
@@ -333,21 +345,28 @@ export default class TableRowNativeStickyWithFallback extends TableNodeView {
|
|
|
333
345
|
once: true
|
|
334
346
|
});
|
|
335
347
|
}
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
348
|
+
if (isExperimentEnabled('platform_editor_reduce_memory_leaks')) {
|
|
349
|
+
this.eventDispatcher.on('widthPlugin', this.onWidthPluginEvent);
|
|
350
|
+
// Ignored via go/ees005
|
|
351
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
352
|
+
this.eventDispatcher.on(tablePluginKey.key, this.onTablePluginEvent);
|
|
353
|
+
} else {
|
|
354
|
+
this.eventDispatcher.on('widthPlugin', this.updateStickyHeaderWidth.bind(this));
|
|
355
|
+
// Ignored via go/ees005
|
|
356
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
357
|
+
this.eventDispatcher.on(tablePluginKey.key, this.onTablePluginState.bind(this));
|
|
358
|
+
}
|
|
341
359
|
this.listening = true;
|
|
360
|
+
const scrollHandler = isExperimentEnabled('platform_editor_reduce_memory_leaks') ? this.headerRowMouseScroll : this.headerRowMouseScroll.bind(this);
|
|
342
361
|
|
|
343
362
|
// Ignored via go/ees005
|
|
344
363
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
345
|
-
this.dom.addEventListener('wheel',
|
|
364
|
+
this.dom.addEventListener('wheel', scrollHandler, {
|
|
346
365
|
passive: true
|
|
347
366
|
});
|
|
348
367
|
// Ignored via go/ees005
|
|
349
368
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
350
|
-
this.dom.addEventListener('touchmove',
|
|
369
|
+
this.dom.addEventListener('touchmove', scrollHandler, {
|
|
351
370
|
passive: true
|
|
352
371
|
});
|
|
353
372
|
}
|
|
@@ -373,10 +392,20 @@ export default class TableRowNativeStickyWithFallback extends TableNodeView {
|
|
|
373
392
|
this.editorScrollableElement.removeEventListener('scroll', this.scrollListener);
|
|
374
393
|
this.scrollListener = undefined;
|
|
375
394
|
}
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
395
|
+
if (isExperimentEnabled('platform_editor_reduce_memory_leaks')) {
|
|
396
|
+
var _this$editorScrollabl;
|
|
397
|
+
this.eventDispatcher.off('widthPlugin', this.onWidthPluginEvent);
|
|
398
|
+
// Ignored via go/ees005
|
|
399
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
400
|
+
this.eventDispatcher.off(tablePluginKey.key, this.onTablePluginEvent);
|
|
401
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
402
|
+
(_this$editorScrollabl = this.editorScrollableElement) === null || _this$editorScrollabl === void 0 ? void 0 : _this$editorScrollabl.removeEventListener('scrollend', this.onScrollEnd);
|
|
403
|
+
} else {
|
|
404
|
+
this.eventDispatcher.off('widthPlugin', this.updateStickyHeaderWidth);
|
|
405
|
+
// Ignored via go/ees005
|
|
406
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
407
|
+
this.eventDispatcher.off(tablePluginKey.key, this.onTablePluginState);
|
|
408
|
+
}
|
|
380
409
|
this.listening = false;
|
|
381
410
|
|
|
382
411
|
// Ignored via go/ees005
|
|
@@ -491,9 +520,9 @@ export default class TableRowNativeStickyWithFallback extends TableNodeView {
|
|
|
491
520
|
this.initNodeVisibilityObserver();
|
|
492
521
|
const closestTable = this.dom.closest('table');
|
|
493
522
|
if (closestTable) {
|
|
494
|
-
var _this$overflowObserve2, _this$
|
|
523
|
+
var _this$overflowObserve2, _this$nodeVisibilityO3;
|
|
495
524
|
(_this$overflowObserve2 = this.overflowObserver) === null || _this$overflowObserve2 === void 0 ? void 0 : _this$overflowObserve2.observe(closestTable);
|
|
496
|
-
(_this$
|
|
525
|
+
(_this$nodeVisibilityO3 = this.nodeVisibilityObserver) === null || _this$nodeVisibilityO3 === void 0 ? void 0 : _this$nodeVisibilityO3.observe(closestTable);
|
|
497
526
|
}
|
|
498
527
|
this.initStickyStateObserver();
|
|
499
528
|
(_this$stickyStateObse = this.stickyStateObserver) === null || _this$stickyStateObse === void 0 ? void 0 : _this$stickyStateObse.observe(this.dom);
|
|
@@ -615,12 +644,12 @@ export default class TableRowNativeStickyWithFallback extends TableNodeView {
|
|
|
615
644
|
table
|
|
616
645
|
} = tree;
|
|
617
646
|
entries.forEach(entry => {
|
|
618
|
-
var _this$
|
|
647
|
+
var _this$editorScrollabl2;
|
|
619
648
|
// On resize of the parent scroll element we need to adjust the width
|
|
620
649
|
// of the sticky header
|
|
621
650
|
// Ignored via go/ees005
|
|
622
651
|
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
623
|
-
if (entry.target.className === ((_this$
|
|
652
|
+
if (entry.target.className === ((_this$editorScrollabl2 = this.editorScrollableElement) === null || _this$editorScrollabl2 === void 0 ? void 0 : _this$editorScrollabl2.className)) {
|
|
624
653
|
this.updateStickyHeaderWidth();
|
|
625
654
|
} else {
|
|
626
655
|
var _this$editorContentAr;
|
|
@@ -644,11 +673,11 @@ export default class TableRowNativeStickyWithFallback extends TableNodeView {
|
|
|
644
673
|
}
|
|
645
674
|
createIntersectionObserver() {
|
|
646
675
|
this.intersectionObserver = new IntersectionObserver((entries, _) => {
|
|
647
|
-
var _this$
|
|
676
|
+
var _this$editorScrollabl3, _this$editorScrollabl4;
|
|
648
677
|
// IMPORTANT: please try and avoid using entry.rootBounds it's terribly inconsistent. For example; sometimes it may return
|
|
649
678
|
// 0 height. In safari it will multiply all values by the window scale factor, however chrome & firfox won't.
|
|
650
679
|
// This is why i just get the scroll view bounding rect here and use it, and fallback to the entry.rootBounds if needed.
|
|
651
|
-
const rootBounds = (_this$
|
|
680
|
+
const rootBounds = (_this$editorScrollabl3 = this.editorScrollableElement) === null || _this$editorScrollabl3 === void 0 ? void 0 : (_this$editorScrollabl4 = _this$editorScrollabl3.getBoundingClientRect) === null || _this$editorScrollabl4 === void 0 ? void 0 : _this$editorScrollabl4.call(_this$editorScrollabl3);
|
|
652
681
|
entries.forEach(entry => {
|
|
653
682
|
const {
|
|
654
683
|
target,
|
|
@@ -886,11 +915,11 @@ export default class TableRowNativeStickyWithFallback extends TableNodeView {
|
|
|
886
915
|
var _this$stickyStateObse2, _this$stickyStateObse3;
|
|
887
916
|
const table = this.dom.closest('table');
|
|
888
917
|
if (table) {
|
|
889
|
-
var _this$overflowObserve3, _this$overflowObserve4, _this$
|
|
918
|
+
var _this$overflowObserve3, _this$overflowObserve4, _this$nodeVisibilityO4, _this$nodeVisibilityO5;
|
|
890
919
|
(_this$overflowObserve3 = this.overflowObserver) === null || _this$overflowObserve3 === void 0 ? void 0 : _this$overflowObserve3.unobserve(table);
|
|
891
920
|
(_this$overflowObserve4 = this.overflowObserver) === null || _this$overflowObserve4 === void 0 ? void 0 : _this$overflowObserve4.observe(table);
|
|
892
|
-
(_this$
|
|
893
|
-
(_this$
|
|
921
|
+
(_this$nodeVisibilityO4 = this.nodeVisibilityObserver) === null || _this$nodeVisibilityO4 === void 0 ? void 0 : _this$nodeVisibilityO4.unobserve(table);
|
|
922
|
+
(_this$nodeVisibilityO5 = this.nodeVisibilityObserver) === null || _this$nodeVisibilityO5 === void 0 ? void 0 : _this$nodeVisibilityO5.observe(table);
|
|
894
923
|
}
|
|
895
924
|
(_this$stickyStateObse2 = this.stickyStateObserver) === null || _this$stickyStateObse2 === void 0 ? void 0 : _this$stickyStateObse2.unobserve(this.dom);
|
|
896
925
|
(_this$stickyStateObse3 = this.stickyStateObserver) === null || _this$stickyStateObse3 === void 0 ? void 0 : _this$stickyStateObse3.observe(this.dom);
|
|
@@ -918,7 +947,7 @@ export default class TableRowNativeStickyWithFallback extends TableNodeView {
|
|
|
918
947
|
}
|
|
919
948
|
const domTop = currentTableTop > 0 ? scrollTop : scrollTop + currentTableTop;
|
|
920
949
|
if (!this.isLegacySticky) {
|
|
921
|
-
var _this$
|
|
950
|
+
var _this$editorScrollabl5;
|
|
922
951
|
syncStickyRowToTable(table);
|
|
923
952
|
this.dom.classList.add('sticky');
|
|
924
953
|
table.classList.add(ClassName.TABLE_STICKY);
|
|
@@ -931,7 +960,7 @@ export default class TableRowNativeStickyWithFallback extends TableNodeView {
|
|
|
931
960
|
*/
|
|
932
961
|
// Ignored via go/ees005
|
|
933
962
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
934
|
-
(_this$
|
|
963
|
+
(_this$editorScrollabl5 = this.editorScrollableElement) === null || _this$editorScrollabl5 === void 0 ? void 0 : _this$editorScrollabl5.addEventListener('scrollend', isExperimentEnabled('platform_editor_reduce_memory_leaks') ? this.onScrollEnd : this.refireIntersectionObservers, {
|
|
935
964
|
passive: true,
|
|
936
965
|
once: true
|
|
937
966
|
});
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/useSharedPluginStateWithSelector';
|
|
3
3
|
import { findTable } from '@atlaskit/editor-tables';
|
|
4
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
4
5
|
import TableComponent from './TableComponent';
|
|
5
6
|
|
|
6
7
|
// Ignored via go/ees005
|
|
7
8
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
8
9
|
|
|
10
|
+
var getSelectionWithinTable = function getSelectionWithinTable(selection, tableNode) {
|
|
11
|
+
var found = selection && findTable(selection);
|
|
12
|
+
return found && found.node === tableNode ? selection : undefined;
|
|
13
|
+
};
|
|
14
|
+
|
|
9
15
|
/**
|
|
10
16
|
* Use useSharedPluginState to control re-renders from plugin dependencies
|
|
11
17
|
*/
|
|
@@ -25,7 +31,7 @@ export var TableComponentWithSharedState = function TableComponentWithSharedStat
|
|
|
25
31
|
allowTableResizing = _ref.allowTableResizing,
|
|
26
32
|
allowFixedColumnWidthOption = _ref.allowFixedColumnWidthOption;
|
|
27
33
|
var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['table', 'width', 'media', 'selection', 'editorViewMode', 'interaction', 'limitedMode'], function (states) {
|
|
28
|
-
var _states$tableState, _states$tableState2, _states$tableState3, _states$tableState4, _states$tableState5, _states$tableState6, _states$tableState7, _states$tableState8, _states$tableState9, _states$tableState0, _states$tableState1, _states$mediaState, _states$selectionStat, _states$editorViewMod, _states$widthState, _states$widthState2, _states$interactionSt, _states$limitedModeSt;
|
|
34
|
+
var _states$tableState, _states$tableState2, _states$tableState3, _states$tableState4, _states$tableState5, _states$tableState6, _states$tableState7, _states$tableState8, _states$tableState9, _states$tableState0, _states$tableState1, _states$mediaState, _states$selectionStat, _states$selectionStat2, _states$editorViewMod, _states$widthState, _states$widthState2, _states$interactionSt, _states$limitedModeSt;
|
|
29
35
|
return {
|
|
30
36
|
// tableState
|
|
31
37
|
isTableResizing: (_states$tableState = states.tableState) === null || _states$tableState === void 0 ? void 0 : _states$tableState.isTableResizing,
|
|
@@ -43,7 +49,7 @@ export var TableComponentWithSharedState = function TableComponentWithSharedStat
|
|
|
43
49
|
// mediaState
|
|
44
50
|
isFullscreen: (_states$mediaState = states.mediaState) === null || _states$mediaState === void 0 ? void 0 : _states$mediaState.isFullscreen,
|
|
45
51
|
// selectionState
|
|
46
|
-
selection: (_states$selectionStat = states.selectionState) === null || _states$selectionStat === void 0 ? void 0 : _states$selectionStat.selection,
|
|
52
|
+
selection: isExperimentEnabled('platform_editor_reduce_memory_leaks') ? getSelectionWithinTable((_states$selectionStat = states.selectionState) === null || _states$selectionStat === void 0 ? void 0 : _states$selectionStat.selection, getNode()) : (_states$selectionStat2 = states.selectionState) === null || _states$selectionStat2 === void 0 ? void 0 : _states$selectionStat2.selection,
|
|
47
53
|
// editorViewModeState
|
|
48
54
|
mode: (_states$editorViewMod = states.editorViewModeState) === null || _states$editorViewMod === void 0 ? void 0 : _states$editorViewMod.mode,
|
|
49
55
|
// widthState
|
|
@@ -82,6 +82,15 @@ var TableRow = /*#__PURE__*/function (_TableNodeView) {
|
|
|
82
82
|
_this.headerRowMouseScrollEnd();
|
|
83
83
|
}
|
|
84
84
|
}, HEADER_ROW_SCROLL_THROTTLE_TIMEOUT));
|
|
85
|
+
_defineProperty(_this, "onWidthPluginEvent", function () {
|
|
86
|
+
return _this.updateStickyHeaderWidth();
|
|
87
|
+
});
|
|
88
|
+
_defineProperty(_this, "onTablePluginEvent", function (state) {
|
|
89
|
+
return _this.onTablePluginState(state);
|
|
90
|
+
});
|
|
91
|
+
_defineProperty(_this, "onScrollEnd", function () {
|
|
92
|
+
return _this.refireIntersectionObservers();
|
|
93
|
+
});
|
|
85
94
|
_this.isSticky = false;
|
|
86
95
|
var _getPluginState = getPluginState(view.state),
|
|
87
96
|
pluginConfig = _getPluginState.pluginConfig;
|
|
@@ -208,13 +217,20 @@ var TableRow = /*#__PURE__*/function (_TableNodeView) {
|
|
|
208
217
|
value: function destroy() {
|
|
209
218
|
if (this.isStickyHeaderEnabled) {
|
|
210
219
|
this.unsubscribe();
|
|
211
|
-
|
|
220
|
+
if (!isExperimentEnabled('platform_editor_reduce_memory_leaks')) {
|
|
221
|
+
this.nodeVisibilityObserverCleanupFn && this.nodeVisibilityObserverCleanupFn();
|
|
222
|
+
}
|
|
212
223
|
var tree = getTree(this.dom);
|
|
213
224
|
if (tree) {
|
|
214
225
|
this.makeRowHeaderNotSticky(tree.table, true);
|
|
215
226
|
}
|
|
216
227
|
this.emitOff(true);
|
|
217
228
|
}
|
|
229
|
+
if (isExperimentEnabled('platform_editor_reduce_memory_leaks')) {
|
|
230
|
+
var _this$nodeVisibilityO;
|
|
231
|
+
(_this$nodeVisibilityO = this.nodeVisibilityObserverCleanupFn) === null || _this$nodeVisibilityO === void 0 || _this$nodeVisibilityO.call(this);
|
|
232
|
+
this.nodeVisibilityObserverCleanupFn = undefined;
|
|
233
|
+
}
|
|
218
234
|
if (isExperimentEnabled('platform_editor_dynamic_limited_mode')) {
|
|
219
235
|
var _this$limitedModeUnsu2;
|
|
220
236
|
(_this$limitedModeUnsu2 = this.limitedModeUnsubscribe) === null || _this$limitedModeUnsu2 === void 0 || _this$limitedModeUnsu2.call(this);
|
|
@@ -262,21 +278,28 @@ var TableRow = /*#__PURE__*/function (_TableNodeView) {
|
|
|
262
278
|
this.initObservers();
|
|
263
279
|
this.topPosEditorElement = getTop(this.editorScrollableElement);
|
|
264
280
|
}
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
281
|
+
if (isExperimentEnabled('platform_editor_reduce_memory_leaks')) {
|
|
282
|
+
this.eventDispatcher.on('widthPlugin', this.onWidthPluginEvent);
|
|
283
|
+
// Ignored via go/ees005
|
|
284
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
285
|
+
this.eventDispatcher.on(tablePluginKey.key, this.onTablePluginEvent);
|
|
286
|
+
} else {
|
|
287
|
+
this.eventDispatcher.on('widthPlugin', this.updateStickyHeaderWidth.bind(this));
|
|
288
|
+
// Ignored via go/ees005
|
|
289
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
290
|
+
this.eventDispatcher.on(tablePluginKey.key, this.onTablePluginState.bind(this));
|
|
291
|
+
}
|
|
270
292
|
this.listening = true;
|
|
293
|
+
var scrollHandler = isExperimentEnabled('platform_editor_reduce_memory_leaks') ? this.headerRowMouseScroll : this.headerRowMouseScroll.bind(this);
|
|
271
294
|
|
|
272
295
|
// Ignored via go/ees005
|
|
273
296
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
274
|
-
this.dom.addEventListener('wheel',
|
|
297
|
+
this.dom.addEventListener('wheel', scrollHandler, {
|
|
275
298
|
passive: true
|
|
276
299
|
});
|
|
277
300
|
// Ignored via go/ees005
|
|
278
301
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
279
|
-
this.dom.addEventListener('touchmove',
|
|
302
|
+
this.dom.addEventListener('touchmove', scrollHandler, {
|
|
280
303
|
passive: true
|
|
281
304
|
});
|
|
282
305
|
}
|
|
@@ -299,10 +322,20 @@ var TableRow = /*#__PURE__*/function (_TableNodeView) {
|
|
|
299
322
|
if (this.resizeObserver) {
|
|
300
323
|
this.resizeObserver.disconnect();
|
|
301
324
|
}
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
325
|
+
if (isExperimentEnabled('platform_editor_reduce_memory_leaks')) {
|
|
326
|
+
var _this$editorScrollabl;
|
|
327
|
+
this.eventDispatcher.off('widthPlugin', this.onWidthPluginEvent);
|
|
328
|
+
// Ignored via go/ees005
|
|
329
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
330
|
+
this.eventDispatcher.off(tablePluginKey.key, this.onTablePluginEvent);
|
|
331
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
332
|
+
(_this$editorScrollabl = this.editorScrollableElement) === null || _this$editorScrollabl === void 0 || _this$editorScrollabl.removeEventListener('scrollend', this.onScrollEnd);
|
|
333
|
+
} else {
|
|
334
|
+
this.eventDispatcher.off('widthPlugin', this.updateStickyHeaderWidth);
|
|
335
|
+
// Ignored via go/ees005
|
|
336
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
337
|
+
this.eventDispatcher.off(tablePluginKey.key, this.onTablePluginState);
|
|
338
|
+
}
|
|
306
339
|
this.listening = false;
|
|
307
340
|
|
|
308
341
|
// Ignored via go/ees005
|
|
@@ -673,7 +706,7 @@ var TableRow = /*#__PURE__*/function (_TableNodeView) {
|
|
|
673
706
|
}
|
|
674
707
|
var domTop = currentTableTop > 0 ? scrollTop : scrollTop + currentTableTop;
|
|
675
708
|
if (!this.isSticky) {
|
|
676
|
-
var _this$
|
|
709
|
+
var _this$editorScrollabl2;
|
|
677
710
|
syncStickyRowToTable(table);
|
|
678
711
|
this.dom.classList.add('sticky');
|
|
679
712
|
table.classList.add(ClassName.TABLE_STICKY);
|
|
@@ -686,7 +719,7 @@ var TableRow = /*#__PURE__*/function (_TableNodeView) {
|
|
|
686
719
|
*/
|
|
687
720
|
// Ignored via go/ees005
|
|
688
721
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
689
|
-
(_this$
|
|
722
|
+
(_this$editorScrollabl2 = this.editorScrollableElement) === null || _this$editorScrollabl2 === void 0 || _this$editorScrollabl2.addEventListener('scrollend', isExperimentEnabled('platform_editor_reduce_memory_leaks') ? this.onScrollEnd : this.refireIntersectionObservers, {
|
|
690
723
|
passive: true,
|
|
691
724
|
once: true
|
|
692
725
|
});
|
|
@@ -91,6 +91,15 @@ var TableRowNativeStickyWithFallback = /*#__PURE__*/function (_TableNodeView) {
|
|
|
91
91
|
_this.headerRowMouseScrollEnd();
|
|
92
92
|
}
|
|
93
93
|
}, HEADER_ROW_SCROLL_THROTTLE_TIMEOUT));
|
|
94
|
+
_defineProperty(_this, "onWidthPluginEvent", function () {
|
|
95
|
+
return _this.updateStickyHeaderWidth();
|
|
96
|
+
});
|
|
97
|
+
_defineProperty(_this, "onTablePluginEvent", function (state) {
|
|
98
|
+
return _this.onTablePluginState(state);
|
|
99
|
+
});
|
|
100
|
+
_defineProperty(_this, "onScrollEnd", function () {
|
|
101
|
+
return _this.refireIntersectionObservers();
|
|
102
|
+
});
|
|
94
103
|
_defineProperty(_this, "toggleDisableNativeSticky", function (headerHeight, viewportHeight) {
|
|
95
104
|
if (!_this.disableNativeSticky && headerHeight > viewportHeight * 0.5) {
|
|
96
105
|
_this.disableNativeSticky = true;
|
|
@@ -254,13 +263,22 @@ var TableRowNativeStickyWithFallback = /*#__PURE__*/function (_TableNodeView) {
|
|
|
254
263
|
this.overflowObserverEntries = undefined;
|
|
255
264
|
this.stickyStateObserver && this.stickyStateObserver.disconnect();
|
|
256
265
|
(_this$nodeVisibilityO = this.nodeVisibilityObserver) === null || _this$nodeVisibilityO === void 0 || _this$nodeVisibilityO.disconnect();
|
|
257
|
-
|
|
266
|
+
if (!isExperimentEnabled('platform_editor_reduce_memory_leaks')) {
|
|
267
|
+
this.nodeVisibilityObserverCleanupFn && this.nodeVisibilityObserverCleanupFn();
|
|
268
|
+
}
|
|
258
269
|
var tree = getTree(this.dom);
|
|
259
270
|
if (tree) {
|
|
260
271
|
this.makeRowHeaderNotLegacySticky(tree.table, true);
|
|
261
272
|
}
|
|
262
273
|
this.emitOff(true);
|
|
263
274
|
}
|
|
275
|
+
if (isExperimentEnabled('platform_editor_reduce_memory_leaks')) {
|
|
276
|
+
var _this$nodeVisibilityO2, _this$onEditorContent2;
|
|
277
|
+
(_this$nodeVisibilityO2 = this.nodeVisibilityObserverCleanupFn) === null || _this$nodeVisibilityO2 === void 0 || _this$nodeVisibilityO2.call(this);
|
|
278
|
+
this.nodeVisibilityObserverCleanupFn = undefined;
|
|
279
|
+
(_this$onEditorContent2 = this.onEditorContentAreaHeightChange) === null || _this$onEditorContent2 === void 0 || _this$onEditorContent2.call(this);
|
|
280
|
+
this.onEditorContentAreaHeightChange = undefined;
|
|
281
|
+
}
|
|
264
282
|
if (isExperimentEnabled('platform_editor_dynamic_limited_mode')) {
|
|
265
283
|
var _this$limitedModeUnsu2;
|
|
266
284
|
(_this$limitedModeUnsu2 = this.limitedModeUnsubscribe) === null || _this$limitedModeUnsu2 === void 0 || _this$limitedModeUnsu2.call(this);
|
|
@@ -351,21 +369,28 @@ var TableRowNativeStickyWithFallback = /*#__PURE__*/function (_TableNodeView) {
|
|
|
351
369
|
once: true
|
|
352
370
|
});
|
|
353
371
|
}
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
372
|
+
if (isExperimentEnabled('platform_editor_reduce_memory_leaks')) {
|
|
373
|
+
this.eventDispatcher.on('widthPlugin', this.onWidthPluginEvent);
|
|
374
|
+
// Ignored via go/ees005
|
|
375
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
376
|
+
this.eventDispatcher.on(tablePluginKey.key, this.onTablePluginEvent);
|
|
377
|
+
} else {
|
|
378
|
+
this.eventDispatcher.on('widthPlugin', this.updateStickyHeaderWidth.bind(this));
|
|
379
|
+
// Ignored via go/ees005
|
|
380
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
381
|
+
this.eventDispatcher.on(tablePluginKey.key, this.onTablePluginState.bind(this));
|
|
382
|
+
}
|
|
359
383
|
this.listening = true;
|
|
384
|
+
var scrollHandler = isExperimentEnabled('platform_editor_reduce_memory_leaks') ? this.headerRowMouseScroll : this.headerRowMouseScroll.bind(this);
|
|
360
385
|
|
|
361
386
|
// Ignored via go/ees005
|
|
362
387
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
363
|
-
this.dom.addEventListener('wheel',
|
|
388
|
+
this.dom.addEventListener('wheel', scrollHandler, {
|
|
364
389
|
passive: true
|
|
365
390
|
});
|
|
366
391
|
// Ignored via go/ees005
|
|
367
392
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
368
|
-
this.dom.addEventListener('touchmove',
|
|
393
|
+
this.dom.addEventListener('touchmove', scrollHandler, {
|
|
369
394
|
passive: true
|
|
370
395
|
});
|
|
371
396
|
}
|
|
@@ -393,10 +418,20 @@ var TableRowNativeStickyWithFallback = /*#__PURE__*/function (_TableNodeView) {
|
|
|
393
418
|
this.editorScrollableElement.removeEventListener('scroll', this.scrollListener);
|
|
394
419
|
this.scrollListener = undefined;
|
|
395
420
|
}
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
421
|
+
if (isExperimentEnabled('platform_editor_reduce_memory_leaks')) {
|
|
422
|
+
var _this$editorScrollabl;
|
|
423
|
+
this.eventDispatcher.off('widthPlugin', this.onWidthPluginEvent);
|
|
424
|
+
// Ignored via go/ees005
|
|
425
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
426
|
+
this.eventDispatcher.off(tablePluginKey.key, this.onTablePluginEvent);
|
|
427
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
428
|
+
(_this$editorScrollabl = this.editorScrollableElement) === null || _this$editorScrollabl === void 0 || _this$editorScrollabl.removeEventListener('scrollend', this.onScrollEnd);
|
|
429
|
+
} else {
|
|
430
|
+
this.eventDispatcher.off('widthPlugin', this.updateStickyHeaderWidth);
|
|
431
|
+
// Ignored via go/ees005
|
|
432
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
433
|
+
this.eventDispatcher.off(tablePluginKey.key, this.onTablePluginState);
|
|
434
|
+
}
|
|
400
435
|
this.listening = false;
|
|
401
436
|
|
|
402
437
|
// Ignored via go/ees005
|
|
@@ -520,9 +555,9 @@ var TableRowNativeStickyWithFallback = /*#__PURE__*/function (_TableNodeView) {
|
|
|
520
555
|
this.initNodeVisibilityObserver();
|
|
521
556
|
var closestTable = this.dom.closest('table');
|
|
522
557
|
if (closestTable) {
|
|
523
|
-
var _this$overflowObserve, _this$
|
|
558
|
+
var _this$overflowObserve, _this$nodeVisibilityO3;
|
|
524
559
|
(_this$overflowObserve = this.overflowObserver) === null || _this$overflowObserve === void 0 || _this$overflowObserve.observe(closestTable);
|
|
525
|
-
(_this$
|
|
560
|
+
(_this$nodeVisibilityO3 = this.nodeVisibilityObserver) === null || _this$nodeVisibilityO3 === void 0 || _this$nodeVisibilityO3.observe(closestTable);
|
|
526
561
|
}
|
|
527
562
|
this.initStickyStateObserver();
|
|
528
563
|
(_this$stickyStateObse = this.stickyStateObserver) === null || _this$stickyStateObse === void 0 || _this$stickyStateObse.observe(this.dom);
|
|
@@ -942,11 +977,11 @@ var TableRowNativeStickyWithFallback = /*#__PURE__*/function (_TableNodeView) {
|
|
|
942
977
|
var _this$stickyStateObse2, _this$stickyStateObse3;
|
|
943
978
|
var table = this.dom.closest('table');
|
|
944
979
|
if (table) {
|
|
945
|
-
var _this$overflowObserve2, _this$overflowObserve3, _this$
|
|
980
|
+
var _this$overflowObserve2, _this$overflowObserve3, _this$nodeVisibilityO4, _this$nodeVisibilityO5;
|
|
946
981
|
(_this$overflowObserve2 = this.overflowObserver) === null || _this$overflowObserve2 === void 0 || _this$overflowObserve2.unobserve(table);
|
|
947
982
|
(_this$overflowObserve3 = this.overflowObserver) === null || _this$overflowObserve3 === void 0 || _this$overflowObserve3.observe(table);
|
|
948
|
-
(_this$
|
|
949
|
-
(_this$
|
|
983
|
+
(_this$nodeVisibilityO4 = this.nodeVisibilityObserver) === null || _this$nodeVisibilityO4 === void 0 || _this$nodeVisibilityO4.unobserve(table);
|
|
984
|
+
(_this$nodeVisibilityO5 = this.nodeVisibilityObserver) === null || _this$nodeVisibilityO5 === void 0 || _this$nodeVisibilityO5.observe(table);
|
|
950
985
|
}
|
|
951
986
|
(_this$stickyStateObse2 = this.stickyStateObserver) === null || _this$stickyStateObse2 === void 0 || _this$stickyStateObse2.unobserve(this.dom);
|
|
952
987
|
(_this$stickyStateObse3 = this.stickyStateObserver) === null || _this$stickyStateObse3 === void 0 || _this$stickyStateObse3.observe(this.dom);
|
|
@@ -975,7 +1010,7 @@ var TableRowNativeStickyWithFallback = /*#__PURE__*/function (_TableNodeView) {
|
|
|
975
1010
|
}
|
|
976
1011
|
var domTop = currentTableTop > 0 ? scrollTop : scrollTop + currentTableTop;
|
|
977
1012
|
if (!this.isLegacySticky) {
|
|
978
|
-
var _this$
|
|
1013
|
+
var _this$editorScrollabl2;
|
|
979
1014
|
syncStickyRowToTable(table);
|
|
980
1015
|
this.dom.classList.add('sticky');
|
|
981
1016
|
table.classList.add(ClassName.TABLE_STICKY);
|
|
@@ -988,7 +1023,7 @@ var TableRowNativeStickyWithFallback = /*#__PURE__*/function (_TableNodeView) {
|
|
|
988
1023
|
*/
|
|
989
1024
|
// Ignored via go/ees005
|
|
990
1025
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
991
|
-
(_this$
|
|
1026
|
+
(_this$editorScrollabl2 = this.editorScrollableElement) === null || _this$editorScrollabl2 === void 0 || _this$editorScrollabl2.addEventListener('scrollend', isExperimentEnabled('platform_editor_reduce_memory_leaks') ? this.onScrollEnd : this.refireIntersectionObservers, {
|
|
992
1027
|
passive: true,
|
|
993
1028
|
once: true
|
|
994
1029
|
});
|
|
@@ -43,6 +43,9 @@ export default class TableRow extends TableNodeView<HTMLTableRowElement> impleme
|
|
|
43
43
|
*/
|
|
44
44
|
private headerRowMouseScrollEnd;
|
|
45
45
|
private headerRowMouseScroll;
|
|
46
|
+
private onWidthPluginEvent;
|
|
47
|
+
private onTablePluginEvent;
|
|
48
|
+
private onScrollEnd;
|
|
46
49
|
private subscribe;
|
|
47
50
|
private unsubscribe;
|
|
48
51
|
private initObservers;
|
|
@@ -56,6 +56,9 @@ export default class TableRowNativeStickyWithFallback extends TableNodeView<HTML
|
|
|
56
56
|
*/
|
|
57
57
|
private headerRowMouseScrollEnd;
|
|
58
58
|
private headerRowMouseScroll;
|
|
59
|
+
private onWidthPluginEvent;
|
|
60
|
+
private onTablePluginEvent;
|
|
61
|
+
private onScrollEnd;
|
|
59
62
|
private subscribe;
|
|
60
63
|
private unsubscribe;
|
|
61
64
|
private initOverflowObserver;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "38.0.
|
|
3
|
+
"version": "38.0.9",
|
|
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": "^26.0.0",
|
|
30
30
|
"@atlaskit/editor-plugin-content-insertion": "^26.0.0",
|
|
31
31
|
"@atlaskit/editor-plugin-editor-viewmode": "^28.0.0",
|
|
32
|
-
"@atlaskit/editor-plugin-extension": "29.0.
|
|
32
|
+
"@atlaskit/editor-plugin-extension": "29.0.7",
|
|
33
33
|
"@atlaskit/editor-plugin-guideline": "^26.0.0",
|
|
34
34
|
"@atlaskit/editor-plugin-interaction": "^40.0.0",
|
|
35
35
|
"@atlaskit/editor-plugin-limited-mode": "^23.0.0",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^3.2.0",
|
|
54
54
|
"@atlaskit/pragmatic-drag-and-drop-hitbox": "^3.0.0",
|
|
55
55
|
"@atlaskit/primitives": "^22.5.0",
|
|
56
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
56
|
+
"@atlaskit/tmp-editor-statsig": "^234.0.0",
|
|
57
57
|
"@atlaskit/toggle": "^17.3.0",
|
|
58
58
|
"@atlaskit/tokens": "^20.4.0",
|
|
59
59
|
"@atlaskit/tooltip": "^24.4.0",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"uuid": "^11.1.1"
|
|
69
69
|
},
|
|
70
70
|
"peerDependencies": {
|
|
71
|
-
"@atlaskit/editor-common": "^130.
|
|
71
|
+
"@atlaskit/editor-common": "^130.5.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"
|