@seafile/seafile-editor 1.0.119-beta1 → 1.0.119-beta3
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.
|
@@ -35,6 +35,8 @@ const ArticleInfo = _ref => {
|
|
|
35
35
|
const resizeWidth = (0, _react.useCallback)(width => {
|
|
36
36
|
if (width >= MIN_PANEL_WIDTH && width <= MAX_PANEL_WIDTH) {
|
|
37
37
|
setWidth(width);
|
|
38
|
+
const eventBus = _eventBus.default.getInstance();
|
|
39
|
+
eventBus.dispatch(_eventTypes.INTERNAL_EVENTS.RESIZE_ARTICLE);
|
|
38
40
|
}
|
|
39
41
|
}, []);
|
|
40
42
|
const resizeWidthEnd = (0, _react.useCallback)(width => {
|
|
@@ -63,6 +65,10 @@ const ArticleInfo = _ref => {
|
|
|
63
65
|
};
|
|
64
66
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
65
67
|
}, []);
|
|
68
|
+
(0, _react.useEffect)(() => {
|
|
69
|
+
const eventBus = _eventBus.default.getInstance();
|
|
70
|
+
eventBus.dispatch(_eventTypes.INTERNAL_EVENTS.RESIZE_ARTICLE);
|
|
71
|
+
}, [isVisible, fileDetails]);
|
|
66
72
|
const {
|
|
67
73
|
component: fileDetailsComponent,
|
|
68
74
|
props: fileDetailsProps
|
|
@@ -22,8 +22,6 @@ function EditorHelp(_ref) {
|
|
|
22
22
|
const updateArticleInfoState = (0, _react.useCallback)(() => {
|
|
23
23
|
setIsShowArticleInfo(prevState => !prevState);
|
|
24
24
|
setIsShowHelpInfo(false);
|
|
25
|
-
const eventBus = _eventBus.default.getInstance();
|
|
26
|
-
eventBus.dispatch(_eventTypes.INTERNAL_EVENTS.RESIZE_ARTICLE);
|
|
27
25
|
}, []);
|
|
28
26
|
const updateHelpInfoState = (0, _react.useCallback)(state => {
|
|
29
27
|
setIsShowHelpInfo(state);
|
|
@@ -47,6 +47,7 @@ function SlateEditor(_ref) {
|
|
|
47
47
|
|
|
48
48
|
// Adjust article container margin-left value according to isShown of the outline and width of window
|
|
49
49
|
const handleWindowResize = (0, _react.useCallback)(() => {
|
|
50
|
+
console.log('handleWindowResize');
|
|
50
51
|
const rect = scrollRef.current.getBoundingClientRect();
|
|
51
52
|
const articleElement = document.querySelector('.article');
|
|
52
53
|
const articleRect = articleElement ? articleElement.getBoundingClientRect() : null;
|
|
@@ -60,20 +61,16 @@ function SlateEditor(_ref) {
|
|
|
60
61
|
}
|
|
61
62
|
}, []);
|
|
62
63
|
(0, _react.useEffect)(() => {
|
|
64
|
+
handleWindowResize();
|
|
65
|
+
window.addEventListener('resize', handleWindowResize);
|
|
63
66
|
const eventBus = _eventBus.default.getInstance();
|
|
64
67
|
const unsubscribeOutline = eventBus.subscribe(_eventTypes.INTERNAL_EVENTS.OUTLINE_STATE_CHANGED, handleWindowResize);
|
|
65
68
|
const unsubscribeResizeArticle = eventBus.subscribe(_eventTypes.INTERNAL_EVENTS.RESIZE_ARTICLE, handleWindowResize);
|
|
66
69
|
return () => {
|
|
70
|
+
window.removeEventListener('resize', handleWindowResize);
|
|
67
71
|
unsubscribeOutline();
|
|
68
72
|
unsubscribeResizeArticle();
|
|
69
73
|
};
|
|
70
|
-
}, [handleWindowResize]);
|
|
71
|
-
(0, _react.useEffect)(() => {
|
|
72
|
-
handleWindowResize();
|
|
73
|
-
window.addEventListener('resize', handleWindowResize);
|
|
74
|
-
return () => {
|
|
75
|
-
window.removeEventListener('resize', handleWindowResize);
|
|
76
|
-
};
|
|
77
74
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
78
75
|
}, []);
|
|
79
76
|
const onChange = (0, _react.useCallback)(value => {
|