@seafile/comment-editor 0.0.1-alpha.30 → 0.0.1-alpha.31
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.
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.useComment = exports.CommentProvider = void 0;
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _model = require("../model");
|
|
9
10
|
require("../assets/css/layout.css");
|
|
10
11
|
require("../assets/css/default.css");
|
|
11
12
|
require("../assets/css/sdoc-editor-article.css");
|
|
@@ -24,10 +25,18 @@ const CommentProvider = _ref => {
|
|
|
24
25
|
// sdoc or wiki or txt ...
|
|
25
26
|
pluginEventBus,
|
|
26
27
|
pluginEvent,
|
|
27
|
-
collaborators,
|
|
28
|
-
participants,
|
|
28
|
+
collaborators = [],
|
|
29
|
+
participants = [],
|
|
29
30
|
addParticipants
|
|
30
31
|
} = _ref;
|
|
32
|
+
const getCollaborators = (0, _react.useCallback)(() => {
|
|
33
|
+
const newCollaborators = collaborators.map(user => new _model.User(user));
|
|
34
|
+
return newCollaborators;
|
|
35
|
+
}, [collaborators]);
|
|
36
|
+
const getParticipants = (0, _react.useCallback)(() => {
|
|
37
|
+
const newParticipants = participants.map(user => new _model.User(user));
|
|
38
|
+
return newParticipants;
|
|
39
|
+
}, [participants]);
|
|
31
40
|
return /*#__PURE__*/_react.default.createElement(CommentContext.Provider, {
|
|
32
41
|
value: {
|
|
33
42
|
type,
|
|
@@ -36,8 +45,8 @@ const CommentProvider = _ref => {
|
|
|
36
45
|
pluginName,
|
|
37
46
|
pluginEventBus,
|
|
38
47
|
pluginEvent,
|
|
39
|
-
collaborators,
|
|
40
|
-
participants,
|
|
48
|
+
collaborators: getCollaborators(),
|
|
49
|
+
participants: getParticipants(),
|
|
41
50
|
addParticipants
|
|
42
51
|
}
|
|
43
52
|
}, children);
|