@seafile/comment-editor 0.0.1-alpha.1 → 0.0.1-alpha.2

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.
@@ -22,12 +22,14 @@ var _eventBus = _interopRequireDefault(require("../utils/event-bus"));
22
22
  const CommentContext = /*#__PURE__*/_react.default.createContext(null);
23
23
  const CommentProvider = _ref => {
24
24
  let {
25
- editor,
26
25
  children,
27
- onCloseCommentPanel,
26
+ editor,
27
+ pluginName = '',
28
+ className = '',
29
+ pluginEventBus,
30
+ pluginEvent,
28
31
  api,
29
- pluginName,
30
- className
32
+ onCloseCommentPanel
31
33
  } = _ref;
32
34
  const {
33
35
  t
@@ -186,6 +188,8 @@ const CommentProvider = _ref => {
186
188
  pluginName,
187
189
  className,
188
190
  api,
191
+ pluginEventBus,
192
+ pluginEvent,
189
193
  commentsInfo,
190
194
  commentType,
191
195
  commentList,
@@ -22,7 +22,9 @@ const CommentLayout = _ref => {
22
22
  } = _ref;
23
23
  const {
24
24
  className,
25
- pluginName
25
+ pluginName,
26
+ pluginEventBus,
27
+ pluginEvent
26
28
  } = (0, _useComment.useComment)();
27
29
  const [width, setWidth] = (0, _react.useState)(MIN_PANEL_WIDTH);
28
30
  const panelWrapperStyle = (0, _react.useMemo)(() => {
@@ -50,6 +52,16 @@ const CommentLayout = _ref => {
50
52
  const eventBus = _eventBus.default.getInstance();
51
53
  eventBus.dispatch(_constants.INTERNAL_EVENT.RESIZE_ARTICLE);
52
54
  }, []);
55
+ (0, _react.useEffect)(() => {
56
+ const isShowGlobalComments = pluginName === 'sdoc' ? true : false;
57
+ const settings = _localStorageUtils.default.getItem(_constants.SDOC_STORAGE) || {};
58
+ _localStorageUtils.default.setItem(_constants.SDOC_STORAGE, {
59
+ ...settings,
60
+ isShowGlobalComments
61
+ });
62
+ const eventBus = pluginEventBus.getInstance();
63
+ eventBus.dispatch(pluginEvent.RESIZE_ARTICLE);
64
+ }, [pluginEvent.RESIZE_ARTICLE, pluginEventBus, pluginName]);
53
65
  (0, _react.useEffect)(() => {
54
66
  const settings = _localStorageUtils.default.getItem(_constants.SDOC_STORAGE) || {};
55
67
  const {
@@ -13,22 +13,24 @@ var _errorBoundary = _interopRequireDefault(require("../components/error-boundar
13
13
  const SeafileCommentEditor = _ref => {
14
14
  let {
15
15
  editor,
16
- className = '',
17
16
  pluginName = '',
17
+ className = '',
18
+ pluginEventBus,
19
+ pluginEvent,
18
20
  api,
19
21
  onCloseCommentPanel
20
22
  } = _ref;
21
23
  _basicSdk.context.init();
22
24
  return /*#__PURE__*/_react.default.createElement(_errorBoundary.default, null, /*#__PURE__*/_react.default.createElement(_basicSdk.CommentProvider, {
25
+ editor: editor,
23
26
  pluginName: pluginName,
24
27
  className: className,
25
- editor: editor,
28
+ pluginEventBus: pluginEventBus,
29
+ pluginEvent: pluginEvent,
26
30
  api: api,
27
31
  onCloseCommentPanel: onCloseCommentPanel
28
32
  }, /*#__PURE__*/_react.default.createElement(_basicSdk.CommentLayout, {
29
- editor: editor,
30
- className: className,
31
- pluginName: pluginName
33
+ editor: editor
32
34
  })));
33
35
  };
34
36
  var _default = exports.default = (0, _reactI18next.withTranslation)('sdoc-editor')(SeafileCommentEditor);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/comment-editor",
3
- "version": "0.0.1-alpha.1",
3
+ "version": "0.0.1-alpha.2",
4
4
  "private": false,
5
5
  "description": "This is a comment editor",
6
6
  "main": "dist/index.js",