@seafile/sdoc-editor 3.0.241 → 3.0.243
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/dist/comment/components/comment-context-menu/index.js +2 -0
- package/dist/extension/commons/insert-element-dialog/index.js +2 -2
- package/dist/extension/plugins/video/constants/index.js +6 -2
- package/dist/extension/toolbar/context-toolbar/index.js +5 -0
- package/dist/utils/dom-utils.js +9 -1
- package/package.json +2 -2
|
@@ -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();
|
|
@@ -105,8 +105,8 @@ var InsertElementDialog = function InsertElementDialog(_ref) {
|
|
|
105
105
|
}, []);
|
|
106
106
|
var onVideoFileChanged = (0, _react.useCallback)(function (event) {
|
|
107
107
|
var files = event.target.files;
|
|
108
|
-
// Show warning for 3s and no further insertion if video file
|
|
109
|
-
if (files[0].size > _index3.
|
|
108
|
+
// Show warning for 3s and no further insertion if the video file exceeds the configured limit.
|
|
109
|
+
if (files[0].size > (0, _index3.getSeadocVideoSizeLimit)(_context["default"].getSetting('seadocVideoSizeLimit'))) {
|
|
110
110
|
handleDisplayAlert();
|
|
111
111
|
event.target.value = null;
|
|
112
112
|
return;
|
|
@@ -3,8 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
7
|
-
var
|
|
6
|
+
exports.getSeadocVideoSizeLimit = exports.SEADOC_VIDEO_SIZE_LIMIT = exports.ONE_MB = exports.ONE_KB = exports.ONE_GB = void 0;
|
|
7
|
+
var SEADOC_VIDEO_SIZE_LIMIT = exports.SEADOC_VIDEO_SIZE_LIMIT = 5 * 1024 * 1024;
|
|
8
|
+
var getSeadocVideoSizeLimit = exports.getSeadocVideoSizeLimit = function getSeadocVideoSizeLimit(sizeLimit) {
|
|
9
|
+
var parsedSizeLimit = Number(sizeLimit);
|
|
10
|
+
return Number.isFinite(parsedSizeLimit) && parsedSizeLimit > 0 ? parsedSizeLimit : SEADOC_VIDEO_SIZE_LIMIT;
|
|
11
|
+
};
|
|
8
12
|
var ONE_GB = exports.ONE_GB = 1000 * 1000 * 1000;
|
|
9
13
|
var ONE_MB = exports.ONE_MB = 1000 * 1000;
|
|
10
14
|
var ONE_KB = exports.ONE_KB = 1000;
|
|
@@ -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.243",
|
|
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": "e7130251c03d8260518c262a4d7cb6bb248f4793"
|
|
75
75
|
}
|