@seafile/sdoc-editor 2.0.105 → 2.0.107
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.
|
@@ -77,30 +77,6 @@ var WikiEditor = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
77
77
|
};
|
|
78
78
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
79
79
|
}, []);
|
|
80
|
-
|
|
81
|
-
// useMount: focus editor
|
|
82
|
-
(0, _react.useEffect)(function () {
|
|
83
|
-
var timer = setTimeout(function () {
|
|
84
|
-
var _validEditor$children = (0, _slicedToArray2["default"])(validEditor.children, 1),
|
|
85
|
-
firstNode = _validEditor$children[0];
|
|
86
|
-
if (firstNode) {
|
|
87
|
-
var _firstNode$children = (0, _slicedToArray2["default"])(firstNode.children, 1),
|
|
88
|
-
firstNodeFirstChild = _firstNode$children[0];
|
|
89
|
-
if (firstNodeFirstChild) {
|
|
90
|
-
var endOfFirstNode = _slate.Editor.end(validEditor, [0, 0]);
|
|
91
|
-
var range = {
|
|
92
|
-
anchor: endOfFirstNode,
|
|
93
|
-
focus: endOfFirstNode
|
|
94
|
-
};
|
|
95
|
-
(0, _core.focusEditor)(validEditor, range);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}, 300);
|
|
99
|
-
return function () {
|
|
100
|
-
clearTimeout(timer);
|
|
101
|
-
};
|
|
102
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
103
|
-
}, []);
|
|
104
80
|
(0, _react.useEffect)(function () {
|
|
105
81
|
if (scrollRef) {
|
|
106
82
|
scrollRef.current.id = 'sdoc-scroll-container';
|
|
@@ -18,6 +18,20 @@ var _mouseEvent = require("../../../utils/mouse-event");
|
|
|
18
18
|
var _constants = require("../../constants");
|
|
19
19
|
var _colorItem = _interopRequireDefault(require("./color-item"));
|
|
20
20
|
require("./index.css");
|
|
21
|
+
var modifiers = [{
|
|
22
|
+
name: 'preventOverflow',
|
|
23
|
+
options: {
|
|
24
|
+
boundary: 'viewport',
|
|
25
|
+
altBoundary: true,
|
|
26
|
+
padding: 16
|
|
27
|
+
}
|
|
28
|
+
}, {
|
|
29
|
+
name: 'flip',
|
|
30
|
+
options: {
|
|
31
|
+
fallbackPlacements: ['top', 'bottom', 'left'],
|
|
32
|
+
padding: 16
|
|
33
|
+
}
|
|
34
|
+
}];
|
|
21
35
|
var ColorMenu = function ColorMenu(_ref) {
|
|
22
36
|
var _ref$isRichEditor = _ref.isRichEditor,
|
|
23
37
|
isRichEditor = _ref$isRichEditor === void 0 ? true : _ref$isRichEditor,
|
|
@@ -204,6 +218,7 @@ var ColorMenu = function ColorMenu(_ref) {
|
|
|
204
218
|
className: "sdoc-more-colors-popover",
|
|
205
219
|
trigger: "hover",
|
|
206
220
|
placement: "right",
|
|
221
|
+
modifiers: modifiers,
|
|
207
222
|
hideArrow: true,
|
|
208
223
|
fade: false,
|
|
209
224
|
toggle: moreColorsPopoverToggle,
|
|
@@ -31,6 +31,10 @@ var ContextToolbar = function ContextToolbar() {
|
|
|
31
31
|
var top = rect.top - 42 - 12; // top = Current top - Element height - Shaded part
|
|
32
32
|
el.style.top = "".concat(top, "px");
|
|
33
33
|
el.style.left = "".concat(rect.left, "px");
|
|
34
|
+
// 475 is content menu max width
|
|
35
|
+
if (475 + rect.left > window.innerWidth) {
|
|
36
|
+
el.style.left = "".concat(window.innerWidth - 475 - 25, "px");
|
|
37
|
+
}
|
|
34
38
|
if (editor.topOffset && top < editor.topOffset) {
|
|
35
39
|
// context menu is in top unseen position
|
|
36
40
|
el.style.display = 'none';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seafile/sdoc-editor",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.107",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "jest",
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
"publishConfig": {
|
|
71
71
|
"access": "public"
|
|
72
72
|
},
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "76d3cdfdbc4a22923af493d58eeca2c2546108e0"
|
|
74
74
|
}
|