@atlaskit/editor-plugin-table 15.4.8 → 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 +16 -0
- package/dist/cjs/nodeviews/TableRowNativeStickyWithFallback.js +27 -23
- package/dist/cjs/ui/FloatingContextualMenu/ContextualMenu.js +25 -40
- package/dist/cjs/ui/FloatingContextualMenu/index.js +1 -2
- package/dist/cjs/ui/FloatingDragMenu/DragMenu.js +21 -34
- package/dist/es2019/nodeviews/TableRowNativeStickyWithFallback.js +24 -20
- package/dist/es2019/ui/FloatingContextualMenu/ContextualMenu.js +25 -40
- package/dist/es2019/ui/FloatingContextualMenu/index.js +1 -2
- package/dist/es2019/ui/FloatingDragMenu/DragMenu.js +21 -34
- package/dist/esm/nodeviews/TableRowNativeStickyWithFallback.js +27 -23
- package/dist/esm/ui/FloatingContextualMenu/ContextualMenu.js +25 -40
- package/dist/esm/ui/FloatingContextualMenu/index.js +1 -2
- package/dist/esm/ui/FloatingDragMenu/DragMenu.js +21 -34
- package/dist/types/nodeviews/TableRowNativeStickyWithFallback.d.ts +4 -4
- package/dist/types-ts4.5/nodeviews/TableRowNativeStickyWithFallback.d.ts +4 -4
- package/package.json +2 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
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
|
+
|
|
11
|
+
## 15.4.9
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [`9fa355db69f2c`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/9fa355db69f2c) -
|
|
16
|
+
[ux] Cleans up FG platform_editor_fix_table_menus_jira
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
|
|
3
19
|
## 15.4.8
|
|
4
20
|
|
|
5
21
|
### 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);
|
|
@@ -39,7 +39,6 @@ var _tableRowAddBelow = _interopRequireDefault(require("@atlaskit/icon/core/tabl
|
|
|
39
39
|
var _tableRowDelete = _interopRequireDefault(require("@atlaskit/icon/core/table-row-delete"));
|
|
40
40
|
var _crossCircle = _interopRequireDefault(require("@atlaskit/icon/glyph/cross-circle"));
|
|
41
41
|
var _remove = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/remove"));
|
|
42
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
43
42
|
var _primitives = require("@atlaskit/primitives");
|
|
44
43
|
var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
|
|
45
44
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
@@ -88,47 +87,35 @@ var ContextualMenu = exports.ContextualMenu = /*#__PURE__*/function (_Component)
|
|
|
88
87
|
});
|
|
89
88
|
(0, _defineProperty2.default)(_this, "dropdownMenuRef", /*#__PURE__*/_react.default.createRef());
|
|
90
89
|
(0, _defineProperty2.default)(_this, "handleSubMenuRef", function (ref) {
|
|
91
|
-
var parent = (0, _utils.closestElement)(
|
|
92
90
|
// Ignored via go/ees005
|
|
93
91
|
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
94
|
-
_this.props.editorView.dom
|
|
95
|
-
|
|
96
|
-
parent = (0, _utils.closestElement)(
|
|
97
|
-
// Ignored via go/ees005
|
|
98
|
-
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
99
|
-
_this.props.editorView.dom, '.ak-editor-content-area');
|
|
100
|
-
}
|
|
92
|
+
var dom = _this.props.editorView.dom;
|
|
93
|
+
var parent = (0, _utils.closestElement)(dom, '.fabric-editor-popup-scroll-parent') || (0, _utils.closestElement)(dom, '.ak-editor-content-area');
|
|
101
94
|
if (!(parent && ref)) {
|
|
102
95
|
return;
|
|
103
96
|
}
|
|
104
97
|
var boundariesRect = parent.getBoundingClientRect();
|
|
105
98
|
var rect = ref.getBoundingClientRect();
|
|
106
|
-
if (
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
}
|
|
99
|
+
if (!!_this.props.mountPoint) {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
var offsetParent = ref === null || ref === void 0 ? void 0 : ref.offsetParent;
|
|
103
|
+
if (!offsetParent) {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
var offsetParentRect = offsetParent.getBoundingClientRect();
|
|
107
|
+
var rightOverflow = offsetParentRect.right + rect.width - boundariesRect.right;
|
|
108
|
+
var leftOverflow = boundariesRect.left - (offsetParentRect.left - rect.width);
|
|
109
|
+
if (rightOverflow > leftOverflow) {
|
|
110
|
+
ref.style.left = "-".concat(rect.width, "px");
|
|
111
|
+
}
|
|
120
112
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
} else {
|
|
130
|
-
if (rect.left + rect.width > boundariesRect.width) {
|
|
131
|
-
ref.style.left = "-".concat(rect.width, "px");
|
|
113
|
+
// if it overflows regardless of side, let it overlap with the parent menu
|
|
114
|
+
if (leftOverflow > 0 && rightOverflow > 0) {
|
|
115
|
+
if (rightOverflow < leftOverflow) {
|
|
116
|
+
ref.style.left = "".concat(offsetParentRect.width - rightOverflow, "px");
|
|
117
|
+
} else {
|
|
118
|
+
ref.style.left = "-".concat(rect.width - leftOverflow, "px");
|
|
132
119
|
}
|
|
133
120
|
}
|
|
134
121
|
});
|
|
@@ -765,7 +752,6 @@ var ContextualMenu = exports.ContextualMenu = /*#__PURE__*/function (_Component)
|
|
|
765
752
|
var _this2 = this;
|
|
766
753
|
var _this$props13 = this.props,
|
|
767
754
|
isOpen = _this$props13.isOpen,
|
|
768
|
-
mountPoint = _this$props13.mountPoint,
|
|
769
755
|
offset = _this$props13.offset,
|
|
770
756
|
boundariesElement = _this$props13.boundariesElement,
|
|
771
757
|
editorView = _this$props13.editorView,
|
|
@@ -783,11 +769,10 @@ var ContextualMenu = exports.ContextualMenu = /*#__PURE__*/function (_Component)
|
|
|
783
769
|
,
|
|
784
770
|
onMouseLeave: _this2.closeSubmenu,
|
|
785
771
|
ref: _this2.dropdownMenuRef
|
|
786
|
-
}, (0, _react2.jsx)(_uiMenu.DropdownMenu
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
,
|
|
772
|
+
}, (0, _react2.jsx)(_uiMenu.DropdownMenu
|
|
773
|
+
//This needs be removed when the a11y is completely handled
|
|
774
|
+
//Disabling key navigation now as it works only partially
|
|
775
|
+
, {
|
|
791
776
|
arrowKeyNavigationProviderOptions: {
|
|
792
777
|
type: _uiMenu.ArrowKeyNavigationType.MENU,
|
|
793
778
|
disableArrowKeyNavigation: !isCellMenuOpenByKeyboard || _this2.state.isSubmenuOpen
|
|
@@ -10,7 +10,6 @@ var _ui = require("@atlaskit/editor-common/ui");
|
|
|
10
10
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
11
11
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
12
12
|
var _utils2 = require("@atlaskit/editor-tables/utils");
|
|
13
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
14
13
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
15
14
|
var _expVal = require("@atlaskit/tmp-editor-statsig/expVal");
|
|
16
15
|
var _pluginFactory = require("../../pm-plugins/plugin-factory");
|
|
@@ -113,7 +112,7 @@ var FloatingContextualMenu = function FloatingContextualMenu(_ref) {
|
|
|
113
112
|
,
|
|
114
113
|
allowBackgroundColor: pluginConfig.allowBackgroundColor,
|
|
115
114
|
selectionRect: selectionRect,
|
|
116
|
-
mountPoint:
|
|
115
|
+
mountPoint: mountPoint,
|
|
117
116
|
boundariesElement: boundariesElement,
|
|
118
117
|
editorAnalyticsAPI: editorAnalyticsAPI,
|
|
119
118
|
getEditorContainerWidth: getEditorContainerWidth,
|
|
@@ -23,7 +23,6 @@ var _shortcut = require("@atlaskit/editor-shared-styles/shortcut");
|
|
|
23
23
|
var _tableMap = require("@atlaskit/editor-tables/table-map");
|
|
24
24
|
var _utils2 = require("@atlaskit/editor-tables/utils");
|
|
25
25
|
var _paintBucketEditorBackgroundColor = _interopRequireDefault(require("@atlaskit/icon/core/migration/paint-bucket--editor-background-color"));
|
|
26
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
27
26
|
var _primitives = require("@atlaskit/primitives");
|
|
28
27
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
29
28
|
var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
|
|
@@ -242,47 +241,35 @@ var DragMenu = /*#__PURE__*/_react.default.memo(function (_ref) {
|
|
|
242
241
|
menuCallback = _convertToDropdownIte.menuCallback;
|
|
243
242
|
var isToolbarAIFCEnabled = Boolean(api === null || api === void 0 ? void 0 : api.toolbar);
|
|
244
243
|
var handleSubMenuRef = function handleSubMenuRef(ref) {
|
|
245
|
-
var parent = (0, _utils.closestElement)(
|
|
246
244
|
// Ignored via go/ees005
|
|
247
245
|
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
248
|
-
editorView.dom
|
|
249
|
-
|
|
250
|
-
parent = (0, _utils.closestElement)(
|
|
251
|
-
// Ignored via go/ees005
|
|
252
|
-
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
253
|
-
editorView.dom, '.ak-editor-content-area');
|
|
254
|
-
}
|
|
246
|
+
var dom = editorView.dom;
|
|
247
|
+
var parent = (0, _utils.closestElement)(dom, '.fabric-editor-popup-scroll-parent') || (0, _utils.closestElement)(dom, '.ak-editor-content-area');
|
|
255
248
|
if (!(parent && ref)) {
|
|
256
249
|
return;
|
|
257
250
|
}
|
|
258
251
|
var boundariesRect = parent.getBoundingClientRect();
|
|
259
252
|
var rect = ref.getBoundingClientRect();
|
|
260
|
-
if (
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
}
|
|
253
|
+
if (!!mountPoint) {
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
var offsetParent = ref === null || ref === void 0 ? void 0 : ref.offsetParent;
|
|
257
|
+
if (!offsetParent) {
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
var offsetParentRect = offsetParent.getBoundingClientRect();
|
|
261
|
+
var rightOverflow = offsetParentRect.right + rect.width - boundariesRect.right;
|
|
262
|
+
var leftOverflow = boundariesRect.left - (offsetParentRect.left - rect.width);
|
|
263
|
+
if (rightOverflow > leftOverflow) {
|
|
264
|
+
ref.style.left = "-".concat(rect.width, "px");
|
|
265
|
+
}
|
|
274
266
|
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
} else {
|
|
284
|
-
if (rect.left + rect.width > boundariesRect.width) {
|
|
285
|
-
ref.style.left = "-".concat(rect.width, "px");
|
|
267
|
+
// if it overflows regardless of side, let it overlap with the parent menu
|
|
268
|
+
if (leftOverflow > 0 && rightOverflow > 0) {
|
|
269
|
+
if (rightOverflow < leftOverflow) {
|
|
270
|
+
ref.style.left = "".concat(offsetParentRect.width - rightOverflow, "px");
|
|
271
|
+
} else {
|
|
272
|
+
ref.style.left = "-".concat(rect.width - leftOverflow, "px");
|
|
286
273
|
}
|
|
287
274
|
}
|
|
288
275
|
};
|
|
@@ -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);
|
|
@@ -31,7 +31,6 @@ import TableRowAddBelowIcon from '@atlaskit/icon/core/table-row-add-below';
|
|
|
31
31
|
import TableRowDeleteIcon from '@atlaskit/icon/core/table-row-delete';
|
|
32
32
|
import CrossCircleIcon from '@atlaskit/icon/glyph/cross-circle';
|
|
33
33
|
import RemoveIcon from '@atlaskit/icon/glyph/editor/remove';
|
|
34
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
35
34
|
// eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
|
|
36
35
|
import { Box, xcss } from '@atlaskit/primitives';
|
|
37
36
|
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
@@ -67,47 +66,35 @@ export class ContextualMenu extends Component {
|
|
|
67
66
|
});
|
|
68
67
|
_defineProperty(this, "dropdownMenuRef", /*#__PURE__*/React.createRef());
|
|
69
68
|
_defineProperty(this, "handleSubMenuRef", ref => {
|
|
70
|
-
let parent = closestElement(
|
|
71
69
|
// Ignored via go/ees005
|
|
72
70
|
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
73
|
-
this.props.editorView.dom
|
|
74
|
-
|
|
75
|
-
parent = closestElement(
|
|
76
|
-
// Ignored via go/ees005
|
|
77
|
-
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
78
|
-
this.props.editorView.dom, '.ak-editor-content-area');
|
|
79
|
-
}
|
|
71
|
+
const dom = this.props.editorView.dom;
|
|
72
|
+
const parent = closestElement(dom, '.fabric-editor-popup-scroll-parent') || closestElement(dom, '.ak-editor-content-area');
|
|
80
73
|
if (!(parent && ref)) {
|
|
81
74
|
return;
|
|
82
75
|
}
|
|
83
76
|
const boundariesRect = parent.getBoundingClientRect();
|
|
84
77
|
const rect = ref.getBoundingClientRect();
|
|
85
|
-
if (
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
78
|
+
if (!!this.props.mountPoint) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
const offsetParent = ref === null || ref === void 0 ? void 0 : ref.offsetParent;
|
|
82
|
+
if (!offsetParent) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
const offsetParentRect = offsetParent.getBoundingClientRect();
|
|
86
|
+
const rightOverflow = offsetParentRect.right + rect.width - boundariesRect.right;
|
|
87
|
+
const leftOverflow = boundariesRect.left - (offsetParentRect.left - rect.width);
|
|
88
|
+
if (rightOverflow > leftOverflow) {
|
|
89
|
+
ref.style.left = `-${rect.width}px`;
|
|
90
|
+
}
|
|
99
91
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
} else {
|
|
109
|
-
if (rect.left + rect.width > boundariesRect.width) {
|
|
110
|
-
ref.style.left = `-${rect.width}px`;
|
|
92
|
+
// if it overflows regardless of side, let it overlap with the parent menu
|
|
93
|
+
if (leftOverflow > 0 && rightOverflow > 0) {
|
|
94
|
+
if (rightOverflow < leftOverflow) {
|
|
95
|
+
ref.style.left = `${offsetParentRect.width - rightOverflow}px`;
|
|
96
|
+
} else {
|
|
97
|
+
ref.style.left = `-${rect.width - leftOverflow}px`;
|
|
111
98
|
}
|
|
112
99
|
}
|
|
113
100
|
});
|
|
@@ -820,7 +807,6 @@ export class ContextualMenu extends Component {
|
|
|
820
807
|
render() {
|
|
821
808
|
const {
|
|
822
809
|
isOpen,
|
|
823
|
-
mountPoint,
|
|
824
810
|
offset,
|
|
825
811
|
boundariesElement,
|
|
826
812
|
editorView,
|
|
@@ -839,11 +825,10 @@ export class ContextualMenu extends Component {
|
|
|
839
825
|
,
|
|
840
826
|
onMouseLeave: this.closeSubmenu,
|
|
841
827
|
ref: this.dropdownMenuRef
|
|
842
|
-
}, jsx(DropdownMenu
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
,
|
|
828
|
+
}, jsx(DropdownMenu
|
|
829
|
+
//This needs be removed when the a11y is completely handled
|
|
830
|
+
//Disabling key navigation now as it works only partially
|
|
831
|
+
, {
|
|
847
832
|
arrowKeyNavigationProviderOptions: {
|
|
848
833
|
type: ArrowKeyNavigationType.MENU,
|
|
849
834
|
disableArrowKeyNavigation: !isCellMenuOpenByKeyboard || this.state.isSubmenuOpen
|
|
@@ -8,7 +8,6 @@ import { Popup } from '@atlaskit/editor-common/ui';
|
|
|
8
8
|
import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
9
9
|
import { akEditorFloatingDialogZIndex, akEditorFloatingOverlapPanelZIndex } from '@atlaskit/editor-shared-styles';
|
|
10
10
|
import { findCellRectClosestToPos, getSelectionRect, isSelectionType } from '@atlaskit/editor-tables/utils';
|
|
11
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
12
11
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
13
12
|
import { expValNoExposure } from '@atlaskit/tmp-editor-statsig/expVal';
|
|
14
13
|
import { getPluginState } from '../../pm-plugins/plugin-factory';
|
|
@@ -109,7 +108,7 @@ const FloatingContextualMenu = ({
|
|
|
109
108
|
,
|
|
110
109
|
allowBackgroundColor: pluginConfig.allowBackgroundColor,
|
|
111
110
|
selectionRect: selectionRect,
|
|
112
|
-
mountPoint:
|
|
111
|
+
mountPoint: mountPoint,
|
|
113
112
|
boundariesElement: boundariesElement,
|
|
114
113
|
editorAnalyticsAPI: editorAnalyticsAPI,
|
|
115
114
|
getEditorContainerWidth: getEditorContainerWidth,
|
|
@@ -21,7 +21,6 @@ import { shortcutStyle } from '@atlaskit/editor-shared-styles/shortcut';
|
|
|
21
21
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
22
22
|
import { findCellRectClosestToPos, getSelectionRect, isSelectionType } from '@atlaskit/editor-tables/utils';
|
|
23
23
|
import PaintBucketIcon from '@atlaskit/icon/core/migration/paint-bucket--editor-background-color';
|
|
24
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
25
24
|
// eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
|
|
26
25
|
import { Box, xcss } from '@atlaskit/primitives';
|
|
27
26
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
@@ -232,47 +231,35 @@ const DragMenu = /*#__PURE__*/React.memo(({
|
|
|
232
231
|
} = convertToDropdownItems(dragMenuConfig, formatMessage, selectionRect);
|
|
233
232
|
const isToolbarAIFCEnabled = Boolean(api === null || api === void 0 ? void 0 : api.toolbar);
|
|
234
233
|
const handleSubMenuRef = ref => {
|
|
235
|
-
let parent = closestElement(
|
|
236
234
|
// Ignored via go/ees005
|
|
237
235
|
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
238
|
-
editorView.dom
|
|
239
|
-
|
|
240
|
-
parent = closestElement(
|
|
241
|
-
// Ignored via go/ees005
|
|
242
|
-
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
243
|
-
editorView.dom, '.ak-editor-content-area');
|
|
244
|
-
}
|
|
236
|
+
const dom = editorView.dom;
|
|
237
|
+
const parent = closestElement(dom, '.fabric-editor-popup-scroll-parent') || closestElement(dom, '.ak-editor-content-area');
|
|
245
238
|
if (!(parent && ref)) {
|
|
246
239
|
return;
|
|
247
240
|
}
|
|
248
241
|
const boundariesRect = parent.getBoundingClientRect();
|
|
249
242
|
const rect = ref.getBoundingClientRect();
|
|
250
|
-
if (
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
}
|
|
243
|
+
if (!!mountPoint) {
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
const offsetParent = ref === null || ref === void 0 ? void 0 : ref.offsetParent;
|
|
247
|
+
if (!offsetParent) {
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
const offsetParentRect = offsetParent.getBoundingClientRect();
|
|
251
|
+
const rightOverflow = offsetParentRect.right + rect.width - boundariesRect.right;
|
|
252
|
+
const leftOverflow = boundariesRect.left - (offsetParentRect.left - rect.width);
|
|
253
|
+
if (rightOverflow > leftOverflow) {
|
|
254
|
+
ref.style.left = `-${rect.width}px`;
|
|
255
|
+
}
|
|
264
256
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
} else {
|
|
274
|
-
if (rect.left + rect.width > boundariesRect.width) {
|
|
275
|
-
ref.style.left = `-${rect.width}px`;
|
|
257
|
+
// if it overflows regardless of side, let it overlap with the parent menu
|
|
258
|
+
if (leftOverflow > 0 && rightOverflow > 0) {
|
|
259
|
+
if (rightOverflow < leftOverflow) {
|
|
260
|
+
ref.style.left = `${offsetParentRect.width - rightOverflow}px`;
|
|
261
|
+
} else {
|
|
262
|
+
ref.style.left = `-${rect.width - leftOverflow}px`;
|
|
276
263
|
}
|
|
277
264
|
}
|
|
278
265
|
};
|
|
@@ -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);
|
|
@@ -41,7 +41,6 @@ import TableRowAddBelowIcon from '@atlaskit/icon/core/table-row-add-below';
|
|
|
41
41
|
import TableRowDeleteIcon from '@atlaskit/icon/core/table-row-delete';
|
|
42
42
|
import CrossCircleIcon from '@atlaskit/icon/glyph/cross-circle';
|
|
43
43
|
import RemoveIcon from '@atlaskit/icon/glyph/editor/remove';
|
|
44
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
45
44
|
// eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
|
|
46
45
|
import { Box, xcss } from '@atlaskit/primitives';
|
|
47
46
|
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
@@ -82,47 +81,35 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
82
81
|
});
|
|
83
82
|
_defineProperty(_this, "dropdownMenuRef", /*#__PURE__*/React.createRef());
|
|
84
83
|
_defineProperty(_this, "handleSubMenuRef", function (ref) {
|
|
85
|
-
var parent = closestElement(
|
|
86
84
|
// Ignored via go/ees005
|
|
87
85
|
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
88
|
-
_this.props.editorView.dom
|
|
89
|
-
|
|
90
|
-
parent = closestElement(
|
|
91
|
-
// Ignored via go/ees005
|
|
92
|
-
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
93
|
-
_this.props.editorView.dom, '.ak-editor-content-area');
|
|
94
|
-
}
|
|
86
|
+
var dom = _this.props.editorView.dom;
|
|
87
|
+
var parent = closestElement(dom, '.fabric-editor-popup-scroll-parent') || closestElement(dom, '.ak-editor-content-area');
|
|
95
88
|
if (!(parent && ref)) {
|
|
96
89
|
return;
|
|
97
90
|
}
|
|
98
91
|
var boundariesRect = parent.getBoundingClientRect();
|
|
99
92
|
var rect = ref.getBoundingClientRect();
|
|
100
|
-
if (
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}
|
|
93
|
+
if (!!_this.props.mountPoint) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
var offsetParent = ref === null || ref === void 0 ? void 0 : ref.offsetParent;
|
|
97
|
+
if (!offsetParent) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
var offsetParentRect = offsetParent.getBoundingClientRect();
|
|
101
|
+
var rightOverflow = offsetParentRect.right + rect.width - boundariesRect.right;
|
|
102
|
+
var leftOverflow = boundariesRect.left - (offsetParentRect.left - rect.width);
|
|
103
|
+
if (rightOverflow > leftOverflow) {
|
|
104
|
+
ref.style.left = "-".concat(rect.width, "px");
|
|
105
|
+
}
|
|
114
106
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
} else {
|
|
124
|
-
if (rect.left + rect.width > boundariesRect.width) {
|
|
125
|
-
ref.style.left = "-".concat(rect.width, "px");
|
|
107
|
+
// if it overflows regardless of side, let it overlap with the parent menu
|
|
108
|
+
if (leftOverflow > 0 && rightOverflow > 0) {
|
|
109
|
+
if (rightOverflow < leftOverflow) {
|
|
110
|
+
ref.style.left = "".concat(offsetParentRect.width - rightOverflow, "px");
|
|
111
|
+
} else {
|
|
112
|
+
ref.style.left = "-".concat(rect.width - leftOverflow, "px");
|
|
126
113
|
}
|
|
127
114
|
}
|
|
128
115
|
});
|
|
@@ -759,7 +746,6 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
759
746
|
var _this2 = this;
|
|
760
747
|
var _this$props13 = this.props,
|
|
761
748
|
isOpen = _this$props13.isOpen,
|
|
762
|
-
mountPoint = _this$props13.mountPoint,
|
|
763
749
|
offset = _this$props13.offset,
|
|
764
750
|
boundariesElement = _this$props13.boundariesElement,
|
|
765
751
|
editorView = _this$props13.editorView,
|
|
@@ -777,11 +763,10 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
777
763
|
,
|
|
778
764
|
onMouseLeave: _this2.closeSubmenu,
|
|
779
765
|
ref: _this2.dropdownMenuRef
|
|
780
|
-
}, jsx(DropdownMenu
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
,
|
|
766
|
+
}, jsx(DropdownMenu
|
|
767
|
+
//This needs be removed when the a11y is completely handled
|
|
768
|
+
//Disabling key navigation now as it works only partially
|
|
769
|
+
, {
|
|
785
770
|
arrowKeyNavigationProviderOptions: {
|
|
786
771
|
type: ArrowKeyNavigationType.MENU,
|
|
787
772
|
disableArrowKeyNavigation: !isCellMenuOpenByKeyboard || _this2.state.isSubmenuOpen
|
|
@@ -8,7 +8,6 @@ import { Popup } from '@atlaskit/editor-common/ui';
|
|
|
8
8
|
import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
9
9
|
import { akEditorFloatingDialogZIndex, akEditorFloatingOverlapPanelZIndex } from '@atlaskit/editor-shared-styles';
|
|
10
10
|
import { findCellRectClosestToPos, getSelectionRect, isSelectionType } from '@atlaskit/editor-tables/utils';
|
|
11
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
12
11
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
13
12
|
import { expValNoExposure } from '@atlaskit/tmp-editor-statsig/expVal';
|
|
14
13
|
import { getPluginState } from '../../pm-plugins/plugin-factory';
|
|
@@ -105,7 +104,7 @@ var FloatingContextualMenu = function FloatingContextualMenu(_ref) {
|
|
|
105
104
|
,
|
|
106
105
|
allowBackgroundColor: pluginConfig.allowBackgroundColor,
|
|
107
106
|
selectionRect: selectionRect,
|
|
108
|
-
mountPoint:
|
|
107
|
+
mountPoint: mountPoint,
|
|
109
108
|
boundariesElement: boundariesElement,
|
|
110
109
|
editorAnalyticsAPI: editorAnalyticsAPI,
|
|
111
110
|
getEditorContainerWidth: getEditorContainerWidth,
|
|
@@ -23,7 +23,6 @@ import { shortcutStyle } from '@atlaskit/editor-shared-styles/shortcut';
|
|
|
23
23
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
24
24
|
import { findCellRectClosestToPos, getSelectionRect, isSelectionType } from '@atlaskit/editor-tables/utils';
|
|
25
25
|
import PaintBucketIcon from '@atlaskit/icon/core/migration/paint-bucket--editor-background-color';
|
|
26
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
27
26
|
// eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
|
|
28
27
|
import { Box, xcss } from '@atlaskit/primitives';
|
|
29
28
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
@@ -231,47 +230,35 @@ var DragMenu = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
231
230
|
menuCallback = _convertToDropdownIte.menuCallback;
|
|
232
231
|
var isToolbarAIFCEnabled = Boolean(api === null || api === void 0 ? void 0 : api.toolbar);
|
|
233
232
|
var handleSubMenuRef = function handleSubMenuRef(ref) {
|
|
234
|
-
var parent = closestElement(
|
|
235
233
|
// Ignored via go/ees005
|
|
236
234
|
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
237
|
-
editorView.dom
|
|
238
|
-
|
|
239
|
-
parent = closestElement(
|
|
240
|
-
// Ignored via go/ees005
|
|
241
|
-
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
242
|
-
editorView.dom, '.ak-editor-content-area');
|
|
243
|
-
}
|
|
235
|
+
var dom = editorView.dom;
|
|
236
|
+
var parent = closestElement(dom, '.fabric-editor-popup-scroll-parent') || closestElement(dom, '.ak-editor-content-area');
|
|
244
237
|
if (!(parent && ref)) {
|
|
245
238
|
return;
|
|
246
239
|
}
|
|
247
240
|
var boundariesRect = parent.getBoundingClientRect();
|
|
248
241
|
var rect = ref.getBoundingClientRect();
|
|
249
|
-
if (
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
}
|
|
242
|
+
if (!!mountPoint) {
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
var offsetParent = ref === null || ref === void 0 ? void 0 : ref.offsetParent;
|
|
246
|
+
if (!offsetParent) {
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
var offsetParentRect = offsetParent.getBoundingClientRect();
|
|
250
|
+
var rightOverflow = offsetParentRect.right + rect.width - boundariesRect.right;
|
|
251
|
+
var leftOverflow = boundariesRect.left - (offsetParentRect.left - rect.width);
|
|
252
|
+
if (rightOverflow > leftOverflow) {
|
|
253
|
+
ref.style.left = "-".concat(rect.width, "px");
|
|
254
|
+
}
|
|
263
255
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
} else {
|
|
273
|
-
if (rect.left + rect.width > boundariesRect.width) {
|
|
274
|
-
ref.style.left = "-".concat(rect.width, "px");
|
|
256
|
+
// if it overflows regardless of side, let it overlap with the parent menu
|
|
257
|
+
if (leftOverflow > 0 && rightOverflow > 0) {
|
|
258
|
+
if (rightOverflow < leftOverflow) {
|
|
259
|
+
ref.style.left = "".concat(offsetParentRect.width - rightOverflow, "px");
|
|
260
|
+
} else {
|
|
261
|
+
ref.style.left = "-".concat(rect.width - leftOverflow, "px");
|
|
275
262
|
}
|
|
276
263
|
}
|
|
277
264
|
};
|
|
@@ -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",
|
|
@@ -135,9 +135,6 @@
|
|
|
135
135
|
"platform_editor_fix_confirm_table_removal": {
|
|
136
136
|
"type": "boolean"
|
|
137
137
|
},
|
|
138
|
-
"platform_editor_fix_table_menus_jira": {
|
|
139
|
-
"type": "boolean"
|
|
140
|
-
},
|
|
141
138
|
"platform_editor_content_mode_button_mvp": {
|
|
142
139
|
"type": "boolean"
|
|
143
140
|
},
|