@seafile/sdoc-editor 2.0.171 → 2.0.173

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.
@@ -29,8 +29,8 @@ var CommentItemContent = function CommentItemContent(_ref) {
29
29
  updateComment = _ref.updateComment,
30
30
  updateCommentState = _ref.updateCommentState,
31
31
  onDeleteComment = _ref.onDeleteComment,
32
- t = _ref.t,
33
- targetId = _ref.targetId;
32
+ targetId = _ref.targetId,
33
+ t = _ref.t;
34
34
  var _useParticipantsConte = (0, _useParticipants.useParticipantsContext)(),
35
35
  addParticipants = _useParticipantsConte.addParticipants,
36
36
  participants = _useParticipantsConte.participants;
@@ -116,7 +116,7 @@ var CommentItemWrapper = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref
116
116
  }(), [comment.detail, dispatch]);
117
117
  var updateCommentState = (0, _react.useCallback)(/*#__PURE__*/function () {
118
118
  var _ref4 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/(0, _regenerator2["default"])().m(function _callee3(commentId, newComment) {
119
- var time, user, reply, res, returnReply, newReply, elementId, resolvedComment, _resolvedComment$deta, unresolvedComment, _unresolvedComment$de;
119
+ var time, user, reply, elementId, resolvedComment, _resolvedComment$deta, unresolvedComment, _unresolvedComment$de, res, returnReply, newReply;
120
120
  return (0, _regenerator2["default"])().w(function (_context3) {
121
121
  while (1) switch (_context3.n) {
122
122
  case 0:
@@ -127,18 +127,7 @@ var CommentItemWrapper = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref
127
127
  reply: newComment.resolved,
128
128
  updated_at: time,
129
129
  author: user.username
130
- }; // When updating comment status, add a new reply
131
- _context3.n = 1;
132
- return _context7["default"].insertReply(commentId, reply);
133
- case 1:
134
- res = _context3.v;
135
- returnReply = res.data.reply;
136
- newReply = (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, reply), {}, {
137
- id: returnReply.id,
138
- reply: returnReply.reply,
139
- user_name: returnReply.user_name,
140
- avatar_url: returnReply.avatar_url
141
- });
130
+ };
142
131
  elementId = (0, _helper.getPrimaryElementId)(comment.detail);
143
132
  if (newComment.resolved === true) {
144
133
  resolvedComment = commentsDetail ? Object.values(commentsDetail).find(function (comments) {
@@ -161,25 +150,38 @@ var CommentItemWrapper = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref
161
150
  (0, _helper.updateCommentedElementsAttrs)(unresolvedComment.detail.element_id_list, editor, (_unresolvedComment$de = unresolvedComment.detail) === null || _unresolvedComment$de === void 0 ? void 0 : _unresolvedComment$de.text_comment_id, !newComment.resolved);
162
151
  }
163
152
  }
153
+
154
+ // Modify comment status
155
+ _context3.n = 1;
156
+ return _context7["default"].updateComment(commentId, newComment);
157
+ case 1:
164
158
  dispatch({
165
- type: 'INSERT_REPLY',
159
+ type: 'UPDATE_COMMENT_STATE',
166
160
  payload: {
167
161
  element_id: elementId,
168
162
  comment_id: commentId,
169
- reply: newReply
163
+ comment: newComment
170
164
  }
171
165
  });
172
166
 
173
- // Modify comment status
167
+ // When updating comment status, add a new reply
174
168
  _context3.n = 2;
175
- return _context7["default"].updateComment(commentId, newComment);
169
+ return _context7["default"].insertReply(commentId, reply);
176
170
  case 2:
171
+ res = _context3.v;
172
+ returnReply = res.data.reply;
173
+ newReply = (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, reply), {}, {
174
+ id: returnReply.id,
175
+ reply: returnReply.reply,
176
+ user_name: returnReply.user_name,
177
+ avatar_url: returnReply.avatar_url
178
+ });
177
179
  dispatch({
178
- type: 'UPDATE_COMMENT_STATE',
180
+ type: 'INSERT_REPLY',
179
181
  payload: {
180
182
  element_id: elementId,
181
183
  comment_id: commentId,
182
- comment: newComment
184
+ reply: newReply
183
185
  }
184
186
  });
185
187
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/sdoc-editor",
3
- "version": "2.0.171",
3
+ "version": "2.0.173",
4
4
  "main": "dist/index.js",
5
5
  "scripts": {
6
6
  "test": "jest",
@@ -71,5 +71,5 @@
71
71
  "publishConfig": {
72
72
  "access": "public"
73
73
  },
74
- "gitHead": "eb6f48e69f80043974e17b540f2a6f0f72fa7e16"
74
+ "gitHead": "411fba296f5c6959f61a9153b636c92808d3d43a"
75
75
  }