@seafile/sdoc-editor 1.0.97-beta → 1.0.97

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.
@@ -45,8 +45,7 @@ const INTERNAL_EVENT = exports.INTERNAL_EVENT = {
45
45
  TABLE_HIDE_DRAG_HANDLER: 'table_show_drag_handler',
46
46
  ON_PRINT: 'on_print',
47
47
  COMMENT_EDITOR_POST_COMMENT: 'comment_editor_post_comment',
48
- CLOSE_FILE_INSET_DIALOG: 'close_file_insert_dialog',
49
- RESIZE_ARTICLE: 'resize_article'
48
+ CLOSE_FILE_INSET_DIALOG: 'close_file_insert_dialog'
50
49
  };
51
50
  const REVISION_DIFF_KEY = exports.REVISION_DIFF_KEY = 'diff';
52
51
  const REVISION_DIFF_VALUE = exports.REVISION_DIFF_VALUE = '1';
@@ -53,11 +53,7 @@ function ArticleContainer(_ref) {
53
53
  (0, _react.useEffect)(() => {
54
54
  const eventBus = _eventBus.default.getInstance();
55
55
  const unsubscribeOutline = eventBus.subscribe(_constants.INTERNAL_EVENT.OUTLINE_STATE_CHANGED, handleWindowResize);
56
- const unsubscribeResizeArticle = eventBus.subscribe(_constants.INTERNAL_EVENT.RESIZE_ARTICLE, handleWindowResize);
57
- return () => {
58
- unsubscribeOutline();
59
- unsubscribeResizeArticle();
60
- };
56
+ return unsubscribeOutline;
61
57
  }, [handleWindowResize]);
62
58
  (0, _react.useEffect)(() => {
63
59
  if (editor.editorType === _constants.WIKI_EDITOR) return;
@@ -10,7 +10,6 @@ var _react = _interopRequireWildcard(require("react"));
10
10
  var _hooks = require("../../hooks");
11
11
  var _resizeWidth = _interopRequireDefault(require("./resize-width"));
12
12
  var _constants = require("../constants");
13
- var _eventBus = _interopRequireDefault(require("../utils/event-bus"));
14
13
  require("./index.css");
15
14
  const MIN_PANEL_WIDTH = 360;
16
15
  const MAX_PANEL_WIDTH = 620;
@@ -41,26 +40,17 @@ const RightPanel = _ref => {
41
40
  setWidth(width);
42
41
  }, []);
43
42
  const resizeWidthEnd = (0, _react.useCallback)(width => {
44
- const settings = JSON.parse(window.localStorage.getItem('sdoc') || '{}');
45
- window.localStorage.setItem('sdoc', JSON.stringify({
46
- ...settings,
47
- panelWidth: width
48
- }));
49
- const eventBus = _eventBus.default.getInstance();
50
- eventBus.dispatch(_constants.INTERNAL_EVENT.RESIZE_ARTICLE);
43
+ window.localStorage.setItem('sdoc-panel-width', width);
51
44
  }, []);
52
45
  (0, _react.useEffect)(() => {
53
- const settings = JSON.parse(window.localStorage.getItem('sdoc', '{}')) || {};
54
- const {
55
- panelWidth
56
- } = settings;
57
- const width = Math.max(MIN_PANEL_WIDTH, Math.min(parseInt(panelWidth, 10) || MIN_PANEL_WIDTH, MAX_PANEL_WIDTH));
46
+ let width = parseInt(window.localStorage.getItem('sdoc-panel-width', '0')) || MIN_PANEL_WIDTH;
47
+ if (width < MIN_PANEL_WIDTH) {
48
+ width = MIN_PANEL_WIDTH;
49
+ } else if (width > MAX_PANEL_WIDTH) {
50
+ width = MAX_PANEL_WIDTH;
51
+ }
58
52
  setWidth(width);
59
53
  }, []);
60
- (0, _react.useEffect)(() => {
61
- const eventBus = _eventBus.default.getInstance();
62
- eventBus.dispatch(_constants.INTERNAL_EVENT.RESIZE_ARTICLE);
63
- }, [displayPluginName]);
64
54
  if (!displayPluginName) return null;
65
55
  const plugin = plugins.find(p => p.name === displayPluginName);
66
56
  if (!plugin) return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/sdoc-editor",
3
- "version": "1.0.97beta",
3
+ "version": "1.0.97",
4
4
  "private": false,
5
5
  "description": "This is a sdoc editor",
6
6
  "main": "dist/index.js",