@seafile/seafile-editor 1.0.119 → 1.0.120-beta

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.
@@ -11,7 +11,8 @@ const INTERNAL_EVENTS = exports.INTERNAL_EVENTS = {
11
11
  ON_OPEN_FORMULA_DIALOG: 'on_open_formula_dialog',
12
12
  ON_SELECT_ALL_CELL: 'on_select_all_cell',
13
13
  ON_TOGGLE_IMAGE_POPOVER: 'on_toggle_image_popover',
14
- OUTLINE_STATE_CHANGED: 'outline_state_changed'
14
+ OUTLINE_STATE_CHANGED: 'outline_state_changed',
15
+ RESIZE_ARTICLE: 'resize_article'
15
16
  };
16
17
  const EXTERNAL_EVENTS = exports.EXTERNAL_EVENTS = {
17
18
  ON_HELP_INFO_TOGGLE: 'on_help_info_toggle',
@@ -43,6 +43,8 @@ const ArticleInfo = _ref => {
43
43
  ...settings,
44
44
  panelWidth: width
45
45
  }));
46
+ const eventBus = _eventBus.default.getInstance();
47
+ eventBus.dispatch(_eventTypes.INTERNAL_EVENTS.RESIZE_ARTICLE);
46
48
  }, []);
47
49
  (0, _react.useEffect)(() => {
48
50
  const settings = JSON.parse(window.localStorage.getItem('sf-editor', '{}')) || {};
@@ -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
@@ -26,6 +26,8 @@ function EditorHelp(_ref) {
26
26
  const updateHelpInfoState = (0, _react.useCallback)(state => {
27
27
  setIsShowHelpInfo(state);
28
28
  setIsShowArticleInfo(false);
29
+ const eventBus = _eventBus.default.getInstance();
30
+ eventBus.dispatch(_eventTypes.INTERNAL_EVENTS.RESIZE_ARTICLE);
29
31
  }, []);
30
32
  (0, _react.useEffect)(() => {
31
33
  const eventBus = _eventBus.default.getInstance();
@@ -59,16 +59,16 @@ function SlateEditor(_ref) {
59
59
  setContainerStyle({});
60
60
  }
61
61
  }, []);
62
- (0, _react.useEffect)(() => {
63
- const eventBus = _eventBus.default.getInstance();
64
- const unsubscribeOutline = eventBus.subscribe(_eventTypes.INTERNAL_EVENTS.OUTLINE_STATE_CHANGED, handleWindowResize);
65
- return unsubscribeOutline;
66
- }, [handleWindowResize]);
67
62
  (0, _react.useEffect)(() => {
68
63
  handleWindowResize();
69
64
  window.addEventListener('resize', handleWindowResize);
65
+ const eventBus = _eventBus.default.getInstance();
66
+ const unsubscribeOutline = eventBus.subscribe(_eventTypes.INTERNAL_EVENTS.OUTLINE_STATE_CHANGED, handleWindowResize);
67
+ const unsubscribeResizeArticle = eventBus.subscribe(_eventTypes.INTERNAL_EVENTS.RESIZE_ARTICLE, handleWindowResize);
70
68
  return () => {
71
69
  window.removeEventListener('resize', handleWindowResize);
70
+ unsubscribeOutline();
71
+ unsubscribeResizeArticle();
72
72
  };
73
73
  // eslint-disable-next-line react-hooks/exhaustive-deps
74
74
  }, []);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/seafile-editor",
3
- "version": "1.0.119",
3
+ "version": "1.0.120beta",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {