@seafile/sdoc-editor 0.1.132 → 0.1.133
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.
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
2
3
|
import { withTranslation } from 'react-i18next';
|
|
3
4
|
import { useSlateStatic } from '@seafile/slate-react';
|
|
4
5
|
import EventBus from '../../../utils/event-bus';
|
|
@@ -16,6 +17,10 @@ var SideMenu = function SideMenu(_ref) {
|
|
|
16
17
|
onReset = _ref.onReset,
|
|
17
18
|
t = _ref.t;
|
|
18
19
|
var sideMenuRef = useRef(null);
|
|
20
|
+
var _useState = useState(''),
|
|
21
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
22
|
+
menuStyle = _useState2[0],
|
|
23
|
+
setMenuStyle = _useState2[1];
|
|
19
24
|
var editor = useSlateStatic();
|
|
20
25
|
useEffect(function () {
|
|
21
26
|
var eventBus = EventBus.getInstance();
|
|
@@ -36,7 +41,7 @@ var SideMenu = function SideMenu(_ref) {
|
|
|
36
41
|
onDeleteNode(editor, slateNode);
|
|
37
42
|
onReset();
|
|
38
43
|
}, [editor, onReset, slateNode]);
|
|
39
|
-
|
|
44
|
+
useEffect(function () {
|
|
40
45
|
var top = menuPosition.top;
|
|
41
46
|
if (sideMenuRef.current) {
|
|
42
47
|
var overflowY = menuPosition.top + sideMenuRef.current.offsetHeight - document.body.clientHeight;
|
|
@@ -44,7 +49,7 @@ var SideMenu = function SideMenu(_ref) {
|
|
|
44
49
|
top = menuPosition.top - overflowY - 10;
|
|
45
50
|
}
|
|
46
51
|
}
|
|
47
|
-
|
|
52
|
+
setMenuStyle("top: ".concat(top, "px; left: ").concat(menuPosition.left, "px"));
|
|
48
53
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
49
54
|
}, [menuPosition, sideMenuRef.current]);
|
|
50
55
|
return /*#__PURE__*/React.createElement(ElementPopover, {
|