@seafile/comment-editor 0.0.1-alpha.30 → 0.0.1-alpha.32

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.
@@ -49,15 +49,8 @@ class Context {
49
49
  this.config = null;
50
50
  }
51
51
  init(settings, api) {
52
- this.initSettings(settings); // lazy init context class
52
+ this.initSettings(settings);
53
53
  this.api = api;
54
- // const server = this.getSetting('serviceUrl');
55
- // const token = this.getSetting('accessToken');
56
- // this.api = new SeafileAPI(server, token);
57
- // const isOpenSocket = this.getSetting('isOpenSocket');
58
- // if (isOpenSocket) {
59
- // this.sdocServerApi = new SDocServerApi(this.settings);
60
- // }
61
54
  }
62
55
  getSettings() {
63
56
  return this.settings;
@@ -1,11 +1,14 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
3
4
  var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.useComment = exports.CommentProvider = void 0;
8
9
  var _react = _interopRequireWildcard(require("react"));
10
+ var _context = _interopRequireDefault(require("../context"));
11
+ var _model = require("../model");
9
12
  require("../assets/css/layout.css");
10
13
  require("../assets/css/default.css");
11
14
  require("../assets/css/sdoc-editor-article.css");
@@ -24,20 +27,28 @@ const CommentProvider = _ref => {
24
27
  // sdoc or wiki or txt ...
25
28
  pluginEventBus,
26
29
  pluginEvent,
27
- collaborators,
28
- participants,
30
+ collaborators = [],
31
+ participants = [],
29
32
  addParticipants
30
33
  } = _ref;
34
+ const getCollaborators = (0, _react.useCallback)(() => {
35
+ const newCollaborators = collaborators.map(user => new _model.User(user));
36
+ return newCollaborators;
37
+ }, [collaborators]);
38
+ const getParticipants = (0, _react.useCallback)(() => {
39
+ const newParticipants = participants.map(user => new _model.User(user));
40
+ return newParticipants;
41
+ }, [participants]);
31
42
  return /*#__PURE__*/_react.default.createElement(CommentContext.Provider, {
32
43
  value: {
33
44
  type,
34
- userInfo,
45
+ userInfo: _context.default.getUserInfo(),
35
46
  className,
36
47
  pluginName,
37
48
  pluginEventBus,
38
49
  pluginEvent,
39
- collaborators,
40
- participants,
50
+ collaborators: getCollaborators(),
51
+ participants: getParticipants(),
41
52
  addParticipants
42
53
  }
43
54
  }, children);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/comment-editor",
3
- "version": "0.0.1-alpha.30",
3
+ "version": "0.0.1-alpha.32",
4
4
  "private": false,
5
5
  "description": "This is a comment editor",
6
6
  "main": "dist/index.js",