@seafile/sdoc-editor 3.0.241 → 3.0.242
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.
|
@@ -8,6 +8,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports["default"] = void 0;
|
|
9
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _constants = require("../../../constants");
|
|
11
|
+
var _domUtils = require("../../../utils/dom-utils");
|
|
11
12
|
var _eventBus = _interopRequireDefault(require("../../../utils/event-bus"));
|
|
12
13
|
var _menuItem = _interopRequireDefault(require("./menu-item"));
|
|
13
14
|
require("./index.css");
|
|
@@ -18,6 +19,7 @@ var CommentContextMenu = function CommentContextMenu(_ref) {
|
|
|
18
19
|
// Make context toolbar disappear
|
|
19
20
|
var contextToolBarDom = document.querySelector('.sdoc-context-toolbar');
|
|
20
21
|
if (contextToolBarDom) {
|
|
22
|
+
(0, _domUtils.hideToolbarTooltips)(contextToolBarDom);
|
|
21
23
|
contextToolBarDom.style.display = 'none';
|
|
22
24
|
}
|
|
23
25
|
var eventBus = _eventBus["default"].getInstance();
|
|
@@ -11,6 +11,7 @@ var _reactDom = require("react-dom");
|
|
|
11
11
|
var _slate = require("@seafile/slate");
|
|
12
12
|
var _slateReact = require("@seafile/slate-react");
|
|
13
13
|
var _useScrollContext = require("../../../hooks/use-scroll-context");
|
|
14
|
+
var _domUtils = require("../../../utils/dom-utils");
|
|
14
15
|
var _commons = require("../../commons");
|
|
15
16
|
var _constants = require("../../constants");
|
|
16
17
|
var _core = require("../../core");
|
|
@@ -42,9 +43,11 @@ var ContextToolbar = function ContextToolbar() {
|
|
|
42
43
|
}
|
|
43
44
|
if (editor.topOffset && top < editor.topOffset) {
|
|
44
45
|
// context menu is in top unseen position
|
|
46
|
+
(0, _domUtils.hideToolbarTooltips)(el);
|
|
45
47
|
el.style.display = 'none';
|
|
46
48
|
} else if (rect.top > window.innerHeight) {
|
|
47
49
|
// context menu is in bottom unseen position
|
|
50
|
+
(0, _domUtils.hideToolbarTooltips)(el);
|
|
48
51
|
el.style.display = 'none';
|
|
49
52
|
} else {
|
|
50
53
|
// context menu is in current screen
|
|
@@ -68,6 +71,7 @@ var ContextToolbar = function ContextToolbar() {
|
|
|
68
71
|
}
|
|
69
72
|
if (readOnly || !selection || !inFocus || _slate.Range.isCollapsed(selection) || _slate.Editor.string(editor, selection) === '' || (0, _core.getSelectedNodeByType)(editor, _constants.CODE_BLOCK)) {
|
|
70
73
|
scrollRef.current && scrollRef.current.removeEventListener('scroll', onScroll);
|
|
74
|
+
(0, _domUtils.hideToolbarTooltips)(el);
|
|
71
75
|
el.removeAttribute('style');
|
|
72
76
|
return;
|
|
73
77
|
}
|
|
@@ -93,6 +97,7 @@ var ContextToolbar = function ContextToolbar() {
|
|
|
93
97
|
var isMouseLeftDown = e.buttons === 1;
|
|
94
98
|
if (isMouseLeftDown) {
|
|
95
99
|
var el = ref.current;
|
|
100
|
+
(0, _domUtils.hideToolbarTooltips)(el);
|
|
96
101
|
el.removeAttribute('style');
|
|
97
102
|
}
|
|
98
103
|
}, []);
|
package/dist/utils/dom-utils.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.getSelectionRange = exports.getDomMarginTop = exports.getDomHeight = exports.getCursorPosition = void 0;
|
|
6
|
+
exports.hideToolbarTooltips = exports.getSelectionRange = exports.getDomMarginTop = exports.getDomHeight = exports.getCursorPosition = void 0;
|
|
7
7
|
var getDomHeight = exports.getDomHeight = function getDomHeight(dom) {
|
|
8
8
|
var styles = window.getComputedStyle(dom);
|
|
9
9
|
var rect = dom.getBoundingClientRect();
|
|
@@ -48,4 +48,12 @@ var getCursorPosition = exports.getCursorPosition = function getCursorPosition()
|
|
|
48
48
|
x: x,
|
|
49
49
|
y: y
|
|
50
50
|
};
|
|
51
|
+
};
|
|
52
|
+
var hideToolbarTooltips = exports.hideToolbarTooltips = function hideToolbarTooltips(toolbar) {
|
|
53
|
+
if (toolbar.style.display !== 'block') return;
|
|
54
|
+
|
|
55
|
+
// CSS hiding can skip mouseout; let Reactstrap close tips and cancel pending shows.
|
|
56
|
+
toolbar.querySelectorAll('button').forEach(function (button) {
|
|
57
|
+
button.dispatchEvent(new MouseEvent('mouseout'));
|
|
58
|
+
});
|
|
51
59
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seafile/sdoc-editor",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.242",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "jest",
|
|
@@ -71,5 +71,5 @@
|
|
|
71
71
|
"publishConfig": {
|
|
72
72
|
"access": "public"
|
|
73
73
|
},
|
|
74
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "0c2e7b8b0dd45275959494bd903a04f7efb12871"
|
|
75
75
|
}
|