@seafile/sdoc-editor 2.0.54 → 2.0.55
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.
|
@@ -17,6 +17,7 @@ var _chartEditDialog = _interopRequireDefault(require("./chart-edit-dialog"));
|
|
|
17
17
|
var _context = _interopRequireDefault(require("../../../../context"));
|
|
18
18
|
var _useScrollContext = require("../../../hooks/use-scroll-context");
|
|
19
19
|
var _helpers = require("./helpers");
|
|
20
|
+
var _utils = require("../../utils");
|
|
20
21
|
var _constants = require("../../constants");
|
|
21
22
|
require("./render-elem.css");
|
|
22
23
|
const Chart = _ref => {
|
|
@@ -50,11 +51,15 @@ const Chart = _ref => {
|
|
|
50
51
|
top,
|
|
51
52
|
left
|
|
52
53
|
} = chartRef.current.getBoundingClientRect();
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
const curTop = top - 42; // top = top distance - menu height
|
|
55
|
+
const curLeft = left - 3;
|
|
56
|
+
const newMenuPosition = (0, _utils.checkOverflow)(editor, {
|
|
57
|
+
top: curTop,
|
|
58
|
+
left: curLeft
|
|
56
59
|
});
|
|
60
|
+
setMenuPosition(newMenuPosition);
|
|
57
61
|
}
|
|
62
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
58
63
|
}, []);
|
|
59
64
|
const onScroll = (0, _react.useCallback)(e => {
|
|
60
65
|
setPosition();
|
|
@@ -18,6 +18,7 @@ var _recordList = _interopRequireDefault(require("./record-list"));
|
|
|
18
18
|
var _opMenu = _interopRequireDefault(require("../op-menu"));
|
|
19
19
|
var _useScrollContext = require("../../../../hooks/use-scroll-context");
|
|
20
20
|
var _helpers = require("../../seatable-column/helpers");
|
|
21
|
+
var _utils = require("../../../utils");
|
|
21
22
|
var _helpers2 = require("../helpers");
|
|
22
23
|
require("./index.css");
|
|
23
24
|
function SeaTableTable(_ref) {
|
|
@@ -197,17 +198,13 @@ function SeaTableTable(_ref) {
|
|
|
197
198
|
left
|
|
198
199
|
} = seaTableRef.current.getBoundingClientRect();
|
|
199
200
|
const menuTop = top - 42; // top = top distance - menu height
|
|
200
|
-
const newMenuPosition = {
|
|
201
|
+
const newMenuPosition = (0, _utils.checkOverflow)(editor, {
|
|
201
202
|
top: menuTop,
|
|
202
|
-
left
|
|
203
|
-
};
|
|
204
|
-
// 201 is distance with browser top
|
|
205
|
-
if (menuTop < 201) {
|
|
206
|
-
newMenuPosition['display'] = 'none';
|
|
207
|
-
}
|
|
203
|
+
left
|
|
204
|
+
});
|
|
208
205
|
setMenuPosition(newMenuPosition);
|
|
209
206
|
}
|
|
210
|
-
}, [isShowMenu, readOnly]);
|
|
207
|
+
}, [editor, isShowMenu, readOnly]);
|
|
211
208
|
(0, _react.useEffect)(() => {
|
|
212
209
|
if (readOnly) return;
|
|
213
210
|
let observerRefValue = null;
|
|
@@ -4,8 +4,9 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.onHandleOverflowScroll = exports.isSameDomain = exports.isOverflowPortByDirection = exports.isImage = exports.IMAGE_TYPES = void 0;
|
|
7
|
+
exports.onHandleOverflowScroll = exports.isSameDomain = exports.isOverflowPortByDirection = exports.isImage = exports.checkOverflow = exports.IMAGE_TYPES = void 0;
|
|
8
8
|
var _isUrl = _interopRequireDefault(require("is-url"));
|
|
9
|
+
var _constants = require("../../constants");
|
|
9
10
|
const IMAGE_TYPES = exports.IMAGE_TYPES = ['png', 'jpg', 'gif'];
|
|
10
11
|
const isImage = url => {
|
|
11
12
|
if (!url) return false;
|
|
@@ -68,4 +69,13 @@ const onHandleOverflowScroll = (currentSelectItem, downDownWrapperRef) => {
|
|
|
68
69
|
});
|
|
69
70
|
}
|
|
70
71
|
};
|
|
71
|
-
exports.onHandleOverflowScroll = onHandleOverflowScroll;
|
|
72
|
+
exports.onHandleOverflowScroll = onHandleOverflowScroll;
|
|
73
|
+
const checkOverflow = (editor, position) => {
|
|
74
|
+
if (editor.editorType === _constants.DOCUMENT_PLUGIN_EDITOR) {
|
|
75
|
+
if (position.top < 201 || position.top + 42 > window.innerHeight) {
|
|
76
|
+
position['display'] = 'none';
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return position;
|
|
80
|
+
};
|
|
81
|
+
exports.checkOverflow = checkOverflow;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seafile/sdoc-editor",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.55",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "This is a sdoc editor",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"remark-parse": "11.0.0",
|
|
40
40
|
"remark-rehype": "11.0.0",
|
|
41
41
|
"remark-stringify": "11.0.0",
|
|
42
|
-
"sea-chart": "2.0.
|
|
42
|
+
"sea-chart": "2.0.11",
|
|
43
43
|
"slugid": "3.2.0",
|
|
44
44
|
"socket.io-client": "4.8.1",
|
|
45
45
|
"type-of": "2.0.1",
|