@seafile/seafile-editor 1.0.118-beta → 1.0.118-beta2
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.
|
@@ -38,15 +38,18 @@ const ArticleInfo = _ref => {
|
|
|
38
38
|
}
|
|
39
39
|
}, []);
|
|
40
40
|
const resizeWidthEnd = (0, _react.useCallback)(width => {
|
|
41
|
-
const
|
|
42
|
-
window.localStorage.setItem('sf-editor
|
|
43
|
-
...
|
|
44
|
-
width
|
|
41
|
+
const settings = JSON.parse(window.localStorage.getItem('sf-editor') || '{}');
|
|
42
|
+
window.localStorage.setItem('sf-editor', JSON.stringify({
|
|
43
|
+
...settings,
|
|
44
|
+
panelWidth: width
|
|
45
45
|
}));
|
|
46
46
|
}, []);
|
|
47
47
|
(0, _react.useEffect)(() => {
|
|
48
|
-
const
|
|
49
|
-
const
|
|
48
|
+
const settings = JSON.parse(window.localStorage.getItem('sf-editor', '{}')) || {};
|
|
49
|
+
const {
|
|
50
|
+
panelWidth
|
|
51
|
+
} = settings;
|
|
52
|
+
const width = Math.max(MIN_PANEL_WIDTH, Math.min(parseInt(panelWidth, 10) || MIN_PANEL_WIDTH, MAX_PANEL_WIDTH));
|
|
50
53
|
setWidth(width);
|
|
51
54
|
}, []);
|
|
52
55
|
const handleFileDetails = (0, _react.useCallback)(fileDetails => {
|
|
@@ -59,7 +59,7 @@ const Outline = _ref => {
|
|
|
59
59
|
setOutlineSetting(nextState);
|
|
60
60
|
setIsShown(nextState);
|
|
61
61
|
const eventBus = _eventBus.default.getInstance();
|
|
62
|
-
eventBus.dispatch(_eventTypes.INTERNAL_EVENTS.OUTLINE_STATE_CHANGED
|
|
62
|
+
eventBus.dispatch(_eventTypes.INTERNAL_EVENTS.OUTLINE_STATE_CHANGED);
|
|
63
63
|
}, []);
|
|
64
64
|
const toggleShow = (0, _react.useCallback)(() => {
|
|
65
65
|
const nextState = !isShown;
|
|
@@ -77,8 +77,10 @@ const Outline = _ref => {
|
|
|
77
77
|
}, [scrollRef]);
|
|
78
78
|
(0, _react.useEffect)(() => {
|
|
79
79
|
const outlineState = getOutlineSetting();
|
|
80
|
+
console.log(outlineState);
|
|
80
81
|
updateOutlineState(outlineState);
|
|
81
|
-
|
|
82
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
83
|
+
}, []);
|
|
82
84
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
83
85
|
className: (0, _classnames.default)('sf-editor-outline-wrapper', {
|
|
84
86
|
'active': isShown
|
|
@@ -18,7 +18,7 @@ var _core = require("../../extension/core");
|
|
|
18
18
|
var _useScrollContext = require("../../hooks/use-scroll-context");
|
|
19
19
|
var _useInsertImage = _interopRequireDefault(require("../../hooks/use-insert-image"));
|
|
20
20
|
var _common = require("../../utils/common");
|
|
21
|
-
var _outline =
|
|
21
|
+
var _outline = _interopRequireWildcard(require("../../containers/outline"));
|
|
22
22
|
var _eventTypes = require("../../constants/event-types");
|
|
23
23
|
require("./style.css");
|
|
24
24
|
const isMacOS = (0, _common.isMac)();
|
|
@@ -46,11 +46,12 @@ function SlateEditor(_ref) {
|
|
|
46
46
|
const decorate = (0, _extension.useHighlight)(editor);
|
|
47
47
|
|
|
48
48
|
// Adjust article container margin-left value according to isShown of the outline and width of window
|
|
49
|
-
const handleWindowResize = (0, _react.useCallback)(
|
|
49
|
+
const handleWindowResize = (0, _react.useCallback)(() => {
|
|
50
50
|
const rect = scrollRef.current.getBoundingClientRect();
|
|
51
51
|
const articleElement = document.querySelector('.article');
|
|
52
52
|
const articleRect = articleElement ? articleElement.getBoundingClientRect() : null;
|
|
53
|
-
|
|
53
|
+
const isOutlineShow = (0, _outline.getOutlineSetting)();
|
|
54
|
+
if (isOutlineShow && articleRect && (rect.width - articleRect.width) / 2 < 280) {
|
|
54
55
|
setContainerStyle({
|
|
55
56
|
marginLeft: 280
|
|
56
57
|
});
|