@atlaskit/editor-plugin-table 15.4.9 → 15.4.10
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 +8 -0
- package/dist/cjs/nodeviews/TableRowNativeStickyWithFallback.js +27 -23
- package/dist/es2019/nodeviews/TableRowNativeStickyWithFallback.js +24 -20
- package/dist/esm/nodeviews/TableRowNativeStickyWithFallback.js +27 -23
- package/dist/types/nodeviews/TableRowNativeStickyWithFallback.d.ts +4 -4
- package/dist/types-ts4.5/nodeviews/TableRowNativeStickyWithFallback.d.ts +4 -4
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 15.4.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`5a25eff5f9f2d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/5a25eff5f9f2d) -
|
|
8
|
+
[ux] Correctly disable legacy sticky table header when no overflow
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
3
11
|
## 15.4.9
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -47,7 +47,7 @@ var TableRowNativeStickyWithFallback = exports.default = /*#__PURE__*/function (
|
|
|
47
47
|
_this.nodeVisibilityObserverCleanupFn && _this.nodeVisibilityObserverCleanupFn();
|
|
48
48
|
var tree = (0, _dom2.getTree)(_this.dom);
|
|
49
49
|
if (tree) {
|
|
50
|
-
_this.
|
|
50
|
+
_this.makeRowHeaderNotLegacySticky(tree.table, true);
|
|
51
51
|
}
|
|
52
52
|
_this.emitOff(false);
|
|
53
53
|
}
|
|
@@ -85,13 +85,13 @@ var TableRowNativeStickyWithFallback = exports.default = /*#__PURE__*/function (
|
|
|
85
85
|
// This prevents mouse wheel scrolling on the scroll-parent div when user's mouse is hovering the header row.
|
|
86
86
|
// This fix sets pointer-events: none on the header row briefly to avoid this behaviour
|
|
87
87
|
(0, _defineProperty2.default)(_this, "headerRowMouseScroll", (0, _throttle.default)(function () {
|
|
88
|
-
if (_this.
|
|
88
|
+
if (_this.isLegacySticky) {
|
|
89
89
|
_this.dom.classList.add('no-pointer-events');
|
|
90
90
|
_this.headerRowMouseScrollEnd();
|
|
91
91
|
}
|
|
92
92
|
}, HEADER_ROW_SCROLL_THROTTLE_TIMEOUT));
|
|
93
93
|
_this.isHeaderRow = (0, _nodes.supportedHeaderRow)(node);
|
|
94
|
-
_this.
|
|
94
|
+
_this.isLegacySticky = false;
|
|
95
95
|
var _getPluginState = (0, _pluginFactory.getPluginState)(view.state),
|
|
96
96
|
pluginConfig = _getPluginState.pluginConfig;
|
|
97
97
|
_this.isStickyHeaderEnabled = !!pluginConfig.stickyHeaders;
|
|
@@ -181,7 +181,7 @@ var TableRowNativeStickyWithFallback = exports.default = /*#__PURE__*/function (
|
|
|
181
181
|
this.nodeVisibilityObserverCleanupFn && this.nodeVisibilityObserverCleanupFn();
|
|
182
182
|
var tree = (0, _dom2.getTree)(this.dom);
|
|
183
183
|
if (tree) {
|
|
184
|
-
this.
|
|
184
|
+
this.makeRowHeaderNotLegacySticky(tree.table, true);
|
|
185
185
|
}
|
|
186
186
|
this.emitOff(true);
|
|
187
187
|
}
|
|
@@ -303,8 +303,8 @@ var TableRowNativeStickyWithFallback = exports.default = /*#__PURE__*/function (
|
|
|
303
303
|
observer.root.classList.remove(_types.TableCssClassName.TABLE_NODE_WRAPPER_NO_OVERFLOW);
|
|
304
304
|
_this2.dom.classList.remove(_types.TableCssClassName.NATIVE_STICKY);
|
|
305
305
|
_this2.isNativeSticky = false;
|
|
306
|
-
_this2.refreshStickyState();
|
|
307
306
|
}
|
|
307
|
+
_this2.refreshLegacyStickyState();
|
|
308
308
|
});
|
|
309
309
|
}, options);
|
|
310
310
|
}
|
|
@@ -516,29 +516,33 @@ var TableRowNativeStickyWithFallback = exports.default = /*#__PURE__*/function (
|
|
|
516
516
|
// Keep the other sentinels rootBounds in sync with this latest one
|
|
517
517
|
_this6.sentinelData[targetKey === 'top' ? 'bottom' : targetKey].rootBounds = rootBounds !== null && rootBounds !== void 0 ? rootBounds : entry.rootBounds;
|
|
518
518
|
});
|
|
519
|
-
_this6.
|
|
519
|
+
_this6.refreshLegacyStickyState();
|
|
520
520
|
}, {
|
|
521
521
|
threshold: 0,
|
|
522
522
|
root: this.editorScrollableElement
|
|
523
523
|
});
|
|
524
524
|
}
|
|
525
525
|
}, {
|
|
526
|
-
key: "
|
|
527
|
-
value: function
|
|
526
|
+
key: "refreshLegacyStickyState",
|
|
527
|
+
value: function refreshLegacyStickyState() {
|
|
528
528
|
var tree = (0, _dom2.getTree)(this.dom);
|
|
529
529
|
if (!tree) {
|
|
530
530
|
return;
|
|
531
531
|
}
|
|
532
532
|
var table = tree.table;
|
|
533
|
+
if (this.isNativeSticky) {
|
|
534
|
+
this.makeRowHeaderNotLegacySticky(table);
|
|
535
|
+
return;
|
|
536
|
+
}
|
|
533
537
|
var shouldStick = this.shouldSticky();
|
|
534
|
-
if (this.
|
|
535
|
-
if (shouldStick
|
|
538
|
+
if (this.isLegacySticky !== shouldStick) {
|
|
539
|
+
if (shouldStick) {
|
|
536
540
|
var _this$sentinelData$to;
|
|
537
541
|
// The rootRect is kept in sync across sentinels so it doesn't matter which one we use.
|
|
538
542
|
var rootRect = (_this$sentinelData$to = this.sentinelData.top.rootBounds) !== null && _this$sentinelData$to !== void 0 ? _this$sentinelData$to : this.sentinelData.bottom.rootBounds;
|
|
539
|
-
this.
|
|
543
|
+
this.makeHeaderRowLegacySticky(tree, rootRect === null || rootRect === void 0 ? void 0 : rootRect.top);
|
|
540
544
|
} else {
|
|
541
|
-
this.
|
|
545
|
+
this.makeRowHeaderNotLegacySticky(table);
|
|
542
546
|
}
|
|
543
547
|
}
|
|
544
548
|
}
|
|
@@ -639,7 +643,7 @@ var TableRowNativeStickyWithFallback = exports.default = /*#__PURE__*/function (
|
|
|
639
643
|
|
|
640
644
|
// If current table selected and header row is toggled off, turn off sticky header
|
|
641
645
|
if (isCurrentTableSelected && !state.isHeaderRowEnabled && tree) {
|
|
642
|
-
this.
|
|
646
|
+
this.makeRowHeaderNotLegacySticky(tree.table);
|
|
643
647
|
}
|
|
644
648
|
this.focused = isCurrentTableSelected;
|
|
645
649
|
var wrapper = tree.wrapper;
|
|
@@ -688,7 +692,7 @@ var TableRowNativeStickyWithFallback = exports.default = /*#__PURE__*/function (
|
|
|
688
692
|
key: "refireIntersectionObservers",
|
|
689
693
|
value: function refireIntersectionObservers() {
|
|
690
694
|
var _this7 = this;
|
|
691
|
-
if (this.
|
|
695
|
+
if (this.isLegacySticky) {
|
|
692
696
|
[this.sentinels.top, this.sentinels.bottom].forEach(function (el) {
|
|
693
697
|
if (el && _this7.intersectionObserver) {
|
|
694
698
|
_this7.intersectionObserver.unobserve(el);
|
|
@@ -698,12 +702,12 @@ var TableRowNativeStickyWithFallback = exports.default = /*#__PURE__*/function (
|
|
|
698
702
|
}
|
|
699
703
|
}
|
|
700
704
|
}, {
|
|
701
|
-
key: "
|
|
702
|
-
value: function
|
|
705
|
+
key: "makeHeaderRowLegacySticky",
|
|
706
|
+
value: function makeHeaderRowLegacySticky(tree, scrollTop) {
|
|
703
707
|
var _tbody$firstChild,
|
|
704
708
|
_this8 = this;
|
|
705
709
|
// If header row height is more than 50% of viewport height don't do this
|
|
706
|
-
if (this.
|
|
710
|
+
if (this.isLegacySticky || this.stickyRowHeight && this.stickyRowHeight > window.innerHeight / 2 || this.isInNestedTable) {
|
|
707
711
|
return;
|
|
708
712
|
}
|
|
709
713
|
var table = tree.table,
|
|
@@ -720,12 +724,12 @@ var TableRowNativeStickyWithFallback = exports.default = /*#__PURE__*/function (
|
|
|
720
724
|
scrollTop = (0, _dom2.getTop)(this.editorScrollableElement);
|
|
721
725
|
}
|
|
722
726
|
var domTop = currentTableTop > 0 ? scrollTop : scrollTop + currentTableTop;
|
|
723
|
-
if (!this.
|
|
727
|
+
if (!this.isLegacySticky) {
|
|
724
728
|
var _this$editorScrollabl;
|
|
725
729
|
(0, _dom.syncStickyRowToTable)(table);
|
|
726
730
|
this.dom.classList.add('sticky');
|
|
727
731
|
table.classList.add(_types.TableCssClassName.TABLE_STICKY);
|
|
728
|
-
this.
|
|
732
|
+
this.isLegacySticky = true;
|
|
729
733
|
|
|
730
734
|
/**
|
|
731
735
|
* The logic below is not desirable, but acts as a fail safe for scenarios where the sticky header
|
|
@@ -749,16 +753,16 @@ var TableRowNativeStickyWithFallback = exports.default = /*#__PURE__*/function (
|
|
|
749
753
|
this.emitOn(domTop, this.colControlsOffset);
|
|
750
754
|
}
|
|
751
755
|
}, {
|
|
752
|
-
key: "
|
|
753
|
-
value: function
|
|
756
|
+
key: "makeRowHeaderNotLegacySticky",
|
|
757
|
+
value: function makeRowHeaderNotLegacySticky(table) {
|
|
754
758
|
var isEditorDestroyed = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
755
|
-
if (!this.
|
|
759
|
+
if (!this.isLegacySticky || !table || !this.dom) {
|
|
756
760
|
return;
|
|
757
761
|
}
|
|
758
762
|
this.dom.style.removeProperty('width');
|
|
759
763
|
this.dom.classList.remove('sticky');
|
|
760
764
|
table.classList.remove(_types.TableCssClassName.TABLE_STICKY);
|
|
761
|
-
this.
|
|
765
|
+
this.isLegacySticky = false;
|
|
762
766
|
this.dom.style.top = '';
|
|
763
767
|
table.style.removeProperty('margin-top');
|
|
764
768
|
this.emitOff(isEditorDestroyed);
|
|
@@ -31,7 +31,7 @@ export default class TableRowNativeStickyWithFallback extends TableNodeView {
|
|
|
31
31
|
this.nodeVisibilityObserverCleanupFn && this.nodeVisibilityObserverCleanupFn();
|
|
32
32
|
const tree = getTree(this.dom);
|
|
33
33
|
if (tree) {
|
|
34
|
-
this.
|
|
34
|
+
this.makeRowHeaderNotLegacySticky(tree.table, true);
|
|
35
35
|
}
|
|
36
36
|
this.emitOff(false);
|
|
37
37
|
}
|
|
@@ -69,13 +69,13 @@ export default class TableRowNativeStickyWithFallback extends TableNodeView {
|
|
|
69
69
|
// This prevents mouse wheel scrolling on the scroll-parent div when user's mouse is hovering the header row.
|
|
70
70
|
// This fix sets pointer-events: none on the header row briefly to avoid this behaviour
|
|
71
71
|
_defineProperty(this, "headerRowMouseScroll", throttle(() => {
|
|
72
|
-
if (this.
|
|
72
|
+
if (this.isLegacySticky) {
|
|
73
73
|
this.dom.classList.add('no-pointer-events');
|
|
74
74
|
this.headerRowMouseScrollEnd();
|
|
75
75
|
}
|
|
76
76
|
}, HEADER_ROW_SCROLL_THROTTLE_TIMEOUT));
|
|
77
77
|
this.isHeaderRow = supportedHeaderRow(node);
|
|
78
|
-
this.
|
|
78
|
+
this.isLegacySticky = false;
|
|
79
79
|
const {
|
|
80
80
|
pluginConfig
|
|
81
81
|
} = getPluginState(view.state);
|
|
@@ -159,7 +159,7 @@ export default class TableRowNativeStickyWithFallback extends TableNodeView {
|
|
|
159
159
|
this.nodeVisibilityObserverCleanupFn && this.nodeVisibilityObserverCleanupFn();
|
|
160
160
|
const tree = getTree(this.dom);
|
|
161
161
|
if (tree) {
|
|
162
|
-
this.
|
|
162
|
+
this.makeRowHeaderNotLegacySticky(tree.table, true);
|
|
163
163
|
}
|
|
164
164
|
this.emitOff(true);
|
|
165
165
|
}
|
|
@@ -272,8 +272,8 @@ export default class TableRowNativeStickyWithFallback extends TableNodeView {
|
|
|
272
272
|
observer.root.classList.remove(ClassName.TABLE_NODE_WRAPPER_NO_OVERFLOW);
|
|
273
273
|
this.dom.classList.remove(ClassName.NATIVE_STICKY);
|
|
274
274
|
this.isNativeSticky = false;
|
|
275
|
-
this.refreshStickyState();
|
|
276
275
|
}
|
|
276
|
+
this.refreshLegacyStickyState();
|
|
277
277
|
});
|
|
278
278
|
}, options);
|
|
279
279
|
}
|
|
@@ -473,13 +473,13 @@ export default class TableRowNativeStickyWithFallback extends TableNodeView {
|
|
|
473
473
|
// Keep the other sentinels rootBounds in sync with this latest one
|
|
474
474
|
this.sentinelData[targetKey === 'top' ? 'bottom' : targetKey].rootBounds = rootBounds !== null && rootBounds !== void 0 ? rootBounds : entry.rootBounds;
|
|
475
475
|
});
|
|
476
|
-
this.
|
|
476
|
+
this.refreshLegacyStickyState();
|
|
477
477
|
}, {
|
|
478
478
|
threshold: 0,
|
|
479
479
|
root: this.editorScrollableElement
|
|
480
480
|
});
|
|
481
481
|
}
|
|
482
|
-
|
|
482
|
+
refreshLegacyStickyState() {
|
|
483
483
|
const tree = getTree(this.dom);
|
|
484
484
|
if (!tree) {
|
|
485
485
|
return;
|
|
@@ -487,15 +487,19 @@ export default class TableRowNativeStickyWithFallback extends TableNodeView {
|
|
|
487
487
|
const {
|
|
488
488
|
table
|
|
489
489
|
} = tree;
|
|
490
|
+
if (this.isNativeSticky) {
|
|
491
|
+
this.makeRowHeaderNotLegacySticky(table);
|
|
492
|
+
return;
|
|
493
|
+
}
|
|
490
494
|
const shouldStick = this.shouldSticky();
|
|
491
|
-
if (this.
|
|
492
|
-
if (shouldStick
|
|
495
|
+
if (this.isLegacySticky !== shouldStick) {
|
|
496
|
+
if (shouldStick) {
|
|
493
497
|
var _this$sentinelData$to;
|
|
494
498
|
// The rootRect is kept in sync across sentinels so it doesn't matter which one we use.
|
|
495
499
|
const rootRect = (_this$sentinelData$to = this.sentinelData.top.rootBounds) !== null && _this$sentinelData$to !== void 0 ? _this$sentinelData$to : this.sentinelData.bottom.rootBounds;
|
|
496
|
-
this.
|
|
500
|
+
this.makeHeaderRowLegacySticky(tree, rootRect === null || rootRect === void 0 ? void 0 : rootRect.top);
|
|
497
501
|
} else {
|
|
498
|
-
this.
|
|
502
|
+
this.makeRowHeaderNotLegacySticky(table);
|
|
499
503
|
}
|
|
500
504
|
}
|
|
501
505
|
}
|
|
@@ -592,7 +596,7 @@ export default class TableRowNativeStickyWithFallback extends TableNodeView {
|
|
|
592
596
|
|
|
593
597
|
// If current table selected and header row is toggled off, turn off sticky header
|
|
594
598
|
if (isCurrentTableSelected && !state.isHeaderRowEnabled && tree) {
|
|
595
|
-
this.
|
|
599
|
+
this.makeRowHeaderNotLegacySticky(tree.table);
|
|
596
600
|
}
|
|
597
601
|
this.focused = isCurrentTableSelected;
|
|
598
602
|
const {
|
|
@@ -638,7 +642,7 @@ export default class TableRowNativeStickyWithFallback extends TableNodeView {
|
|
|
638
642
|
* Useful when the header may have detached from the table.
|
|
639
643
|
*/
|
|
640
644
|
refireIntersectionObservers() {
|
|
641
|
-
if (this.
|
|
645
|
+
if (this.isLegacySticky) {
|
|
642
646
|
[this.sentinels.top, this.sentinels.bottom].forEach(el => {
|
|
643
647
|
if (el && this.intersectionObserver) {
|
|
644
648
|
this.intersectionObserver.unobserve(el);
|
|
@@ -647,10 +651,10 @@ export default class TableRowNativeStickyWithFallback extends TableNodeView {
|
|
|
647
651
|
});
|
|
648
652
|
}
|
|
649
653
|
}
|
|
650
|
-
|
|
654
|
+
makeHeaderRowLegacySticky(tree, scrollTop) {
|
|
651
655
|
var _tbody$firstChild;
|
|
652
656
|
// If header row height is more than 50% of viewport height don't do this
|
|
653
|
-
if (this.
|
|
657
|
+
if (this.isLegacySticky || this.stickyRowHeight && this.stickyRowHeight > window.innerHeight / 2 || this.isInNestedTable) {
|
|
654
658
|
return;
|
|
655
659
|
}
|
|
656
660
|
const {
|
|
@@ -669,12 +673,12 @@ export default class TableRowNativeStickyWithFallback extends TableNodeView {
|
|
|
669
673
|
scrollTop = getTop(this.editorScrollableElement);
|
|
670
674
|
}
|
|
671
675
|
const domTop = currentTableTop > 0 ? scrollTop : scrollTop + currentTableTop;
|
|
672
|
-
if (!this.
|
|
676
|
+
if (!this.isLegacySticky) {
|
|
673
677
|
var _this$editorScrollabl4;
|
|
674
678
|
syncStickyRowToTable(table);
|
|
675
679
|
this.dom.classList.add('sticky');
|
|
676
680
|
table.classList.add(ClassName.TABLE_STICKY);
|
|
677
|
-
this.
|
|
681
|
+
this.isLegacySticky = true;
|
|
678
682
|
|
|
679
683
|
/**
|
|
680
684
|
* The logic below is not desirable, but acts as a fail safe for scenarios where the sticky header
|
|
@@ -697,14 +701,14 @@ export default class TableRowNativeStickyWithFallback extends TableNodeView {
|
|
|
697
701
|
this.dom.scrollLeft = wrapper.scrollLeft;
|
|
698
702
|
this.emitOn(domTop, this.colControlsOffset);
|
|
699
703
|
}
|
|
700
|
-
|
|
701
|
-
if (!this.
|
|
704
|
+
makeRowHeaderNotLegacySticky(table, isEditorDestroyed = false) {
|
|
705
|
+
if (!this.isLegacySticky || !table || !this.dom) {
|
|
702
706
|
return;
|
|
703
707
|
}
|
|
704
708
|
this.dom.style.removeProperty('width');
|
|
705
709
|
this.dom.classList.remove('sticky');
|
|
706
710
|
table.classList.remove(ClassName.TABLE_STICKY);
|
|
707
|
-
this.
|
|
711
|
+
this.isLegacySticky = false;
|
|
708
712
|
this.dom.style.top = '';
|
|
709
713
|
table.style.removeProperty('margin-top');
|
|
710
714
|
this.emitOff(isEditorDestroyed);
|
|
@@ -40,7 +40,7 @@ var TableRowNativeStickyWithFallback = /*#__PURE__*/function (_ref) {
|
|
|
40
40
|
_this.nodeVisibilityObserverCleanupFn && _this.nodeVisibilityObserverCleanupFn();
|
|
41
41
|
var tree = getTree(_this.dom);
|
|
42
42
|
if (tree) {
|
|
43
|
-
_this.
|
|
43
|
+
_this.makeRowHeaderNotLegacySticky(tree.table, true);
|
|
44
44
|
}
|
|
45
45
|
_this.emitOff(false);
|
|
46
46
|
}
|
|
@@ -78,13 +78,13 @@ var TableRowNativeStickyWithFallback = /*#__PURE__*/function (_ref) {
|
|
|
78
78
|
// This prevents mouse wheel scrolling on the scroll-parent div when user's mouse is hovering the header row.
|
|
79
79
|
// This fix sets pointer-events: none on the header row briefly to avoid this behaviour
|
|
80
80
|
_defineProperty(_this, "headerRowMouseScroll", throttle(function () {
|
|
81
|
-
if (_this.
|
|
81
|
+
if (_this.isLegacySticky) {
|
|
82
82
|
_this.dom.classList.add('no-pointer-events');
|
|
83
83
|
_this.headerRowMouseScrollEnd();
|
|
84
84
|
}
|
|
85
85
|
}, HEADER_ROW_SCROLL_THROTTLE_TIMEOUT));
|
|
86
86
|
_this.isHeaderRow = supportedHeaderRow(node);
|
|
87
|
-
_this.
|
|
87
|
+
_this.isLegacySticky = false;
|
|
88
88
|
var _getPluginState = getPluginState(view.state),
|
|
89
89
|
pluginConfig = _getPluginState.pluginConfig;
|
|
90
90
|
_this.isStickyHeaderEnabled = !!pluginConfig.stickyHeaders;
|
|
@@ -174,7 +174,7 @@ var TableRowNativeStickyWithFallback = /*#__PURE__*/function (_ref) {
|
|
|
174
174
|
this.nodeVisibilityObserverCleanupFn && this.nodeVisibilityObserverCleanupFn();
|
|
175
175
|
var tree = getTree(this.dom);
|
|
176
176
|
if (tree) {
|
|
177
|
-
this.
|
|
177
|
+
this.makeRowHeaderNotLegacySticky(tree.table, true);
|
|
178
178
|
}
|
|
179
179
|
this.emitOff(true);
|
|
180
180
|
}
|
|
@@ -296,8 +296,8 @@ var TableRowNativeStickyWithFallback = /*#__PURE__*/function (_ref) {
|
|
|
296
296
|
observer.root.classList.remove(ClassName.TABLE_NODE_WRAPPER_NO_OVERFLOW);
|
|
297
297
|
_this2.dom.classList.remove(ClassName.NATIVE_STICKY);
|
|
298
298
|
_this2.isNativeSticky = false;
|
|
299
|
-
_this2.refreshStickyState();
|
|
300
299
|
}
|
|
300
|
+
_this2.refreshLegacyStickyState();
|
|
301
301
|
});
|
|
302
302
|
}, options);
|
|
303
303
|
}
|
|
@@ -509,29 +509,33 @@ var TableRowNativeStickyWithFallback = /*#__PURE__*/function (_ref) {
|
|
|
509
509
|
// Keep the other sentinels rootBounds in sync with this latest one
|
|
510
510
|
_this6.sentinelData[targetKey === 'top' ? 'bottom' : targetKey].rootBounds = rootBounds !== null && rootBounds !== void 0 ? rootBounds : entry.rootBounds;
|
|
511
511
|
});
|
|
512
|
-
_this6.
|
|
512
|
+
_this6.refreshLegacyStickyState();
|
|
513
513
|
}, {
|
|
514
514
|
threshold: 0,
|
|
515
515
|
root: this.editorScrollableElement
|
|
516
516
|
});
|
|
517
517
|
}
|
|
518
518
|
}, {
|
|
519
|
-
key: "
|
|
520
|
-
value: function
|
|
519
|
+
key: "refreshLegacyStickyState",
|
|
520
|
+
value: function refreshLegacyStickyState() {
|
|
521
521
|
var tree = getTree(this.dom);
|
|
522
522
|
if (!tree) {
|
|
523
523
|
return;
|
|
524
524
|
}
|
|
525
525
|
var table = tree.table;
|
|
526
|
+
if (this.isNativeSticky) {
|
|
527
|
+
this.makeRowHeaderNotLegacySticky(table);
|
|
528
|
+
return;
|
|
529
|
+
}
|
|
526
530
|
var shouldStick = this.shouldSticky();
|
|
527
|
-
if (this.
|
|
528
|
-
if (shouldStick
|
|
531
|
+
if (this.isLegacySticky !== shouldStick) {
|
|
532
|
+
if (shouldStick) {
|
|
529
533
|
var _this$sentinelData$to;
|
|
530
534
|
// The rootRect is kept in sync across sentinels so it doesn't matter which one we use.
|
|
531
535
|
var rootRect = (_this$sentinelData$to = this.sentinelData.top.rootBounds) !== null && _this$sentinelData$to !== void 0 ? _this$sentinelData$to : this.sentinelData.bottom.rootBounds;
|
|
532
|
-
this.
|
|
536
|
+
this.makeHeaderRowLegacySticky(tree, rootRect === null || rootRect === void 0 ? void 0 : rootRect.top);
|
|
533
537
|
} else {
|
|
534
|
-
this.
|
|
538
|
+
this.makeRowHeaderNotLegacySticky(table);
|
|
535
539
|
}
|
|
536
540
|
}
|
|
537
541
|
}
|
|
@@ -632,7 +636,7 @@ var TableRowNativeStickyWithFallback = /*#__PURE__*/function (_ref) {
|
|
|
632
636
|
|
|
633
637
|
// If current table selected and header row is toggled off, turn off sticky header
|
|
634
638
|
if (isCurrentTableSelected && !state.isHeaderRowEnabled && tree) {
|
|
635
|
-
this.
|
|
639
|
+
this.makeRowHeaderNotLegacySticky(tree.table);
|
|
636
640
|
}
|
|
637
641
|
this.focused = isCurrentTableSelected;
|
|
638
642
|
var wrapper = tree.wrapper;
|
|
@@ -681,7 +685,7 @@ var TableRowNativeStickyWithFallback = /*#__PURE__*/function (_ref) {
|
|
|
681
685
|
key: "refireIntersectionObservers",
|
|
682
686
|
value: function refireIntersectionObservers() {
|
|
683
687
|
var _this7 = this;
|
|
684
|
-
if (this.
|
|
688
|
+
if (this.isLegacySticky) {
|
|
685
689
|
[this.sentinels.top, this.sentinels.bottom].forEach(function (el) {
|
|
686
690
|
if (el && _this7.intersectionObserver) {
|
|
687
691
|
_this7.intersectionObserver.unobserve(el);
|
|
@@ -691,12 +695,12 @@ var TableRowNativeStickyWithFallback = /*#__PURE__*/function (_ref) {
|
|
|
691
695
|
}
|
|
692
696
|
}
|
|
693
697
|
}, {
|
|
694
|
-
key: "
|
|
695
|
-
value: function
|
|
698
|
+
key: "makeHeaderRowLegacySticky",
|
|
699
|
+
value: function makeHeaderRowLegacySticky(tree, scrollTop) {
|
|
696
700
|
var _tbody$firstChild,
|
|
697
701
|
_this8 = this;
|
|
698
702
|
// If header row height is more than 50% of viewport height don't do this
|
|
699
|
-
if (this.
|
|
703
|
+
if (this.isLegacySticky || this.stickyRowHeight && this.stickyRowHeight > window.innerHeight / 2 || this.isInNestedTable) {
|
|
700
704
|
return;
|
|
701
705
|
}
|
|
702
706
|
var table = tree.table,
|
|
@@ -713,12 +717,12 @@ var TableRowNativeStickyWithFallback = /*#__PURE__*/function (_ref) {
|
|
|
713
717
|
scrollTop = getTop(this.editorScrollableElement);
|
|
714
718
|
}
|
|
715
719
|
var domTop = currentTableTop > 0 ? scrollTop : scrollTop + currentTableTop;
|
|
716
|
-
if (!this.
|
|
720
|
+
if (!this.isLegacySticky) {
|
|
717
721
|
var _this$editorScrollabl;
|
|
718
722
|
syncStickyRowToTable(table);
|
|
719
723
|
this.dom.classList.add('sticky');
|
|
720
724
|
table.classList.add(ClassName.TABLE_STICKY);
|
|
721
|
-
this.
|
|
725
|
+
this.isLegacySticky = true;
|
|
722
726
|
|
|
723
727
|
/**
|
|
724
728
|
* The logic below is not desirable, but acts as a fail safe for scenarios where the sticky header
|
|
@@ -742,16 +746,16 @@ var TableRowNativeStickyWithFallback = /*#__PURE__*/function (_ref) {
|
|
|
742
746
|
this.emitOn(domTop, this.colControlsOffset);
|
|
743
747
|
}
|
|
744
748
|
}, {
|
|
745
|
-
key: "
|
|
746
|
-
value: function
|
|
749
|
+
key: "makeRowHeaderNotLegacySticky",
|
|
750
|
+
value: function makeRowHeaderNotLegacySticky(table) {
|
|
747
751
|
var isEditorDestroyed = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
748
|
-
if (!this.
|
|
752
|
+
if (!this.isLegacySticky || !table || !this.dom) {
|
|
749
753
|
return;
|
|
750
754
|
}
|
|
751
755
|
this.dom.style.removeProperty('width');
|
|
752
756
|
this.dom.classList.remove('sticky');
|
|
753
757
|
table.classList.remove(ClassName.TABLE_STICKY);
|
|
754
|
-
this.
|
|
758
|
+
this.isLegacySticky = false;
|
|
755
759
|
this.dom.style.top = '';
|
|
756
760
|
table.style.removeProperty('margin-top');
|
|
757
761
|
this.emitOff(isEditorDestroyed);
|
|
@@ -18,7 +18,7 @@ export default class TableRowNativeStickyWithFallback extends TableNodeView<HTML
|
|
|
18
18
|
private colControlsOffset;
|
|
19
19
|
private focused;
|
|
20
20
|
private topPosEditorElement;
|
|
21
|
-
private
|
|
21
|
+
private isLegacySticky;
|
|
22
22
|
private intersectionObserver?;
|
|
23
23
|
private resizeObserver?;
|
|
24
24
|
private tableContainerObserver?;
|
|
@@ -58,7 +58,7 @@ export default class TableRowNativeStickyWithFallback extends TableNodeView<HTML
|
|
|
58
58
|
private initObservers;
|
|
59
59
|
private createResizeObserver;
|
|
60
60
|
private createIntersectionObserver;
|
|
61
|
-
private
|
|
61
|
+
private refreshLegacyStickyState;
|
|
62
62
|
private shouldSticky;
|
|
63
63
|
private isHeaderSticky;
|
|
64
64
|
private onTablePluginState;
|
|
@@ -68,8 +68,8 @@ export default class TableRowNativeStickyWithFallback extends TableNodeView<HTML
|
|
|
68
68
|
* Useful when the header may have detached from the table.
|
|
69
69
|
*/
|
|
70
70
|
private refireIntersectionObservers;
|
|
71
|
-
private
|
|
72
|
-
private
|
|
71
|
+
private makeHeaderRowLegacySticky;
|
|
72
|
+
private makeRowHeaderNotLegacySticky;
|
|
73
73
|
private getWrapperoffset;
|
|
74
74
|
private getWrapperRefTop;
|
|
75
75
|
private getScrolledTableTop;
|
|
@@ -18,7 +18,7 @@ export default class TableRowNativeStickyWithFallback extends TableNodeView<HTML
|
|
|
18
18
|
private colControlsOffset;
|
|
19
19
|
private focused;
|
|
20
20
|
private topPosEditorElement;
|
|
21
|
-
private
|
|
21
|
+
private isLegacySticky;
|
|
22
22
|
private intersectionObserver?;
|
|
23
23
|
private resizeObserver?;
|
|
24
24
|
private tableContainerObserver?;
|
|
@@ -58,7 +58,7 @@ export default class TableRowNativeStickyWithFallback extends TableNodeView<HTML
|
|
|
58
58
|
private initObservers;
|
|
59
59
|
private createResizeObserver;
|
|
60
60
|
private createIntersectionObserver;
|
|
61
|
-
private
|
|
61
|
+
private refreshLegacyStickyState;
|
|
62
62
|
private shouldSticky;
|
|
63
63
|
private isHeaderSticky;
|
|
64
64
|
private onTablePluginState;
|
|
@@ -68,8 +68,8 @@ export default class TableRowNativeStickyWithFallback extends TableNodeView<HTML
|
|
|
68
68
|
* Useful when the header may have detached from the table.
|
|
69
69
|
*/
|
|
70
70
|
private refireIntersectionObservers;
|
|
71
|
-
private
|
|
72
|
-
private
|
|
71
|
+
private makeHeaderRowLegacySticky;
|
|
72
|
+
private makeRowHeaderNotLegacySticky;
|
|
73
73
|
private getWrapperoffset;
|
|
74
74
|
private getWrapperRefTop;
|
|
75
75
|
private getScrolledTableTop;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "15.4.
|
|
3
|
+
"version": "15.4.10",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.1.0",
|
|
59
59
|
"@atlaskit/primitives": "^16.4.0",
|
|
60
60
|
"@atlaskit/theme": "^21.0.0",
|
|
61
|
-
"@atlaskit/tmp-editor-statsig": "^14.
|
|
61
|
+
"@atlaskit/tmp-editor-statsig": "^14.2.0",
|
|
62
62
|
"@atlaskit/toggle": "^15.1.0",
|
|
63
63
|
"@atlaskit/tokens": "^8.4.0",
|
|
64
64
|
"@atlaskit/tooltip": "^20.10.0",
|