@seafile/sdoc-editor 2.0.138 → 2.0.139-alpha.0
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.
- package/dist/comment/components/comment-item-content.js +21 -7
- package/dist/comment/components/comment-item-reply.js +22 -8
- package/dist/comment/components/comment-list.js +42 -13
- package/dist/comment/components/global-comment/global-comment-editor.js +25 -10
- package/dist/extension/plugins/file-link/hover-menu/index.css +4 -0
- package/dist/extension/plugins/image/hover-menu/index.css +4 -0
- package/dist/extension/plugins/sdoc-link/hover-menu/index.css +6 -2
- package/dist/layout/article-container.js +1 -1
- package/package.json +3 -3
- package/LICENSE.txt +0 -13
- package/dist/comment/components/comment-editor.js +0 -162
- package/dist/editor/sdoc-comment-editor.js +0 -209
|
@@ -13,12 +13,14 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm
|
|
|
13
13
|
var _react = _interopRequireWildcard(require("react"));
|
|
14
14
|
var _reactI18next = require("react-i18next");
|
|
15
15
|
var _reactstrap = require("reactstrap");
|
|
16
|
+
var _commentEditor = require("@seafile/comment-editor");
|
|
16
17
|
var _dayjs = _interopRequireDefault(require("dayjs"));
|
|
17
18
|
var _tooltip = _interopRequireDefault(require("../../components/tooltip"));
|
|
18
19
|
var _context2 = _interopRequireDefault(require("../../context"));
|
|
20
|
+
var _useCollaborators2 = require("../../hooks/use-collaborators");
|
|
19
21
|
var _mdToHtml = _interopRequireDefault(require("../../slate-convert/md-to-html"));
|
|
20
22
|
var _notificationHooks = require("../hooks/notification-hooks");
|
|
21
|
-
var
|
|
23
|
+
var _useParticipants = require("../hooks/use-participants");
|
|
22
24
|
var _commentImagePreviewer = _interopRequireDefault(require("./comment-image-previewer"));
|
|
23
25
|
var CommentItemContent = function CommentItemContent(_ref) {
|
|
24
26
|
var isActive = _ref.isActive,
|
|
@@ -29,6 +31,11 @@ var CommentItemContent = function CommentItemContent(_ref) {
|
|
|
29
31
|
onDeleteComment = _ref.onDeleteComment,
|
|
30
32
|
t = _ref.t,
|
|
31
33
|
targetId = _ref.targetId;
|
|
34
|
+
var _useParticipantsConte = (0, _useParticipants.useParticipantsContext)(),
|
|
35
|
+
addParticipants = _useParticipantsConte.addParticipants,
|
|
36
|
+
participants = _useParticipantsConte.participants;
|
|
37
|
+
var _useCollaborators = (0, _useCollaborators2.useCollaborators)(),
|
|
38
|
+
collaborators = _useCollaborators.collaborators;
|
|
32
39
|
var _useState = (0, _react.useState)(false),
|
|
33
40
|
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
34
41
|
isDropdownOpen = _useState2[0],
|
|
@@ -119,6 +126,18 @@ var CommentItemContent = function CommentItemContent(_ref) {
|
|
|
119
126
|
setImageUrl(event.target.src);
|
|
120
127
|
}
|
|
121
128
|
}, []);
|
|
129
|
+
var commentEditorProps = {
|
|
130
|
+
className: 'pb-3',
|
|
131
|
+
addParticipants: addParticipants,
|
|
132
|
+
participants: participants,
|
|
133
|
+
collaborators: collaborators,
|
|
134
|
+
content: comment.comment,
|
|
135
|
+
insertContent: updateContent,
|
|
136
|
+
hiddenComment: setIsEditing,
|
|
137
|
+
api: {
|
|
138
|
+
uploadLocalImage: _context2["default"].uploadLocalImage
|
|
139
|
+
}
|
|
140
|
+
};
|
|
122
141
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
123
142
|
className: "comment-item"
|
|
124
143
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
@@ -187,12 +206,7 @@ var CommentItemContent = function CommentItemContent(_ref) {
|
|
|
187
206
|
dangerouslySetInnerHTML: {
|
|
188
207
|
__html: editorContent
|
|
189
208
|
}
|
|
190
|
-
})), isEditing && /*#__PURE__*/_react["default"].createElement(_commentEditor["default"], {
|
|
191
|
-
className: "pb-3",
|
|
192
|
-
content: comment.comment,
|
|
193
|
-
updateContent: updateContent,
|
|
194
|
-
setIsEditing: setIsEditing
|
|
195
|
-
}), imageUrl && /*#__PURE__*/_react["default"].createElement(_commentImagePreviewer["default"], {
|
|
209
|
+
})), isEditing && /*#__PURE__*/_react["default"].createElement(_commentEditor.SeafileCommentEditor, commentEditorProps), imageUrl && /*#__PURE__*/_react["default"].createElement(_commentImagePreviewer["default"], {
|
|
196
210
|
imageUrl: imageUrl,
|
|
197
211
|
toggle: function toggle() {
|
|
198
212
|
return setImageUrl('');
|
|
@@ -12,11 +12,13 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm
|
|
|
12
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
13
|
var _reactI18next = require("react-i18next");
|
|
14
14
|
var _reactstrap = require("reactstrap");
|
|
15
|
+
var _commentEditor = require("@seafile/comment-editor");
|
|
15
16
|
var _dayjs = _interopRequireDefault(require("dayjs"));
|
|
16
17
|
var _context2 = _interopRequireDefault(require("../../context"));
|
|
18
|
+
var _useCollaborators2 = require("../../hooks/use-collaborators");
|
|
17
19
|
var _mdToHtml = _interopRequireDefault(require("../../slate-convert/md-to-html"));
|
|
20
|
+
var _useParticipants = require("../hooks/use-participants");
|
|
18
21
|
var _commentDeletePopover = _interopRequireDefault(require("./comment-delete-popover"));
|
|
19
|
-
var _commentEditor = _interopRequireDefault(require("./comment-editor"));
|
|
20
22
|
var _commentImagePreviewer = _interopRequireDefault(require("./comment-image-previewer"));
|
|
21
23
|
var CommentItemReply = function CommentItemReply(_ref) {
|
|
22
24
|
var isActive = _ref.isActive,
|
|
@@ -25,6 +27,11 @@ var CommentItemReply = function CommentItemReply(_ref) {
|
|
|
25
27
|
deleteReply = _ref.deleteReply,
|
|
26
28
|
updateReply = _ref.updateReply,
|
|
27
29
|
t = _ref.t;
|
|
30
|
+
var _useParticipantsConte = (0, _useParticipants.useParticipantsContext)(),
|
|
31
|
+
addParticipants = _useParticipantsConte.addParticipants,
|
|
32
|
+
participants = _useParticipantsConte.participants;
|
|
33
|
+
var _useCollaborators = (0, _useCollaborators2.useCollaborators)(),
|
|
34
|
+
collaborators = _useCollaborators.collaborators;
|
|
28
35
|
var _useState = (0, _react.useState)(false),
|
|
29
36
|
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
30
37
|
isDropdownOpen = _useState2[0],
|
|
@@ -101,6 +108,19 @@ var CommentItemReply = function CommentItemReply(_ref) {
|
|
|
101
108
|
setImageUrl(event.target.src);
|
|
102
109
|
}
|
|
103
110
|
}, []);
|
|
111
|
+
var commentEditorProps = {
|
|
112
|
+
type: 'reply',
|
|
113
|
+
className: 'pb-3',
|
|
114
|
+
addParticipants: addParticipants,
|
|
115
|
+
participants: participants,
|
|
116
|
+
collaborators: collaborators,
|
|
117
|
+
content: editorContent,
|
|
118
|
+
insertContent: updateContent,
|
|
119
|
+
hiddenComment: setIsEditing,
|
|
120
|
+
api: {
|
|
121
|
+
uploadLocalImage: _context2["default"].uploadLocalImage
|
|
122
|
+
}
|
|
123
|
+
};
|
|
104
124
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
105
125
|
className: "comment-item",
|
|
106
126
|
ref: itemRef
|
|
@@ -150,13 +170,7 @@ var CommentItemReply = function CommentItemReply(_ref) {
|
|
|
150
170
|
dangerouslySetInnerHTML: {
|
|
151
171
|
__html: editorContent
|
|
152
172
|
}
|
|
153
|
-
})), isEditing && /*#__PURE__*/_react["default"].createElement(_commentEditor["default"], {
|
|
154
|
-
className: "pb-3",
|
|
155
|
-
type: "reply",
|
|
156
|
-
content: editorContent,
|
|
157
|
-
updateContent: updateContent,
|
|
158
|
-
setIsEditing: setIsEditing
|
|
159
|
-
}), isShowDeletePopover && isActive && /*#__PURE__*/_react["default"].createElement(_commentDeletePopover["default"], {
|
|
173
|
+
})), isEditing && /*#__PURE__*/_react["default"].createElement(_commentEditor.SeafileCommentEditor, commentEditorProps), isShowDeletePopover && isActive && /*#__PURE__*/_react["default"].createElement(_commentDeletePopover["default"], {
|
|
160
174
|
parentDom: itemRef.current,
|
|
161
175
|
type: "reply",
|
|
162
176
|
deleteConfirm: _deleteReply,
|
|
@@ -14,14 +14,16 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm
|
|
|
14
14
|
var _react = _interopRequireWildcard(require("react"));
|
|
15
15
|
var _reactI18next = require("react-i18next");
|
|
16
16
|
var _reactstrap = require("reactstrap");
|
|
17
|
+
var _commentEditor = require("@seafile/comment-editor");
|
|
17
18
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
18
19
|
var _dayjs = _interopRequireDefault(require("dayjs"));
|
|
19
20
|
var _slugid = _interopRequireDefault(require("slugid"));
|
|
20
21
|
var _context2 = _interopRequireDefault(require("../../context"));
|
|
22
|
+
var _useCollaborators2 = require("../../hooks/use-collaborators");
|
|
21
23
|
var _useSelectionPosition = require("../../hooks/use-selection-position");
|
|
22
24
|
var _helper = require("../helper");
|
|
23
25
|
var _useCommentContext2 = require("../hooks/comment-hooks/use-comment-context");
|
|
24
|
-
var
|
|
26
|
+
var _useParticipants = require("../hooks/use-participants");
|
|
25
27
|
var _commentItemWrapper = _interopRequireDefault(require("./comment-item-wrapper"));
|
|
26
28
|
require("./comment-list.css");
|
|
27
29
|
var CommentList = function CommentList(_ref) {
|
|
@@ -42,6 +44,11 @@ var CommentList = function CommentList(_ref) {
|
|
|
42
44
|
var commentPopover = (0, _react.useRef)(null);
|
|
43
45
|
var commentDetailRef = (0, _react.useRef)(null);
|
|
44
46
|
var position = (0, _useSelectionPosition.useCommentListPosition)(activeElementIds, isContextComment, isClickedContextComment, commentedDom, commentDetail, closeComment, editor);
|
|
47
|
+
var _useParticipantsConte = (0, _useParticipants.useParticipantsContext)(),
|
|
48
|
+
addParticipants = _useParticipantsConte.addParticipants,
|
|
49
|
+
participants = _useParticipantsConte.participants;
|
|
50
|
+
var _useCollaborators = (0, _useCollaborators2.useCollaborators)(),
|
|
51
|
+
collaborators = _useCollaborators.collaborators;
|
|
45
52
|
var _useCommentContext = (0, _useCommentContext2.useCommentContext)(),
|
|
46
53
|
dispatch = _useCommentContext.dispatch;
|
|
47
54
|
var _useState = (0, _react.useState)(false),
|
|
@@ -202,12 +209,17 @@ var CommentList = function CommentList(_ref) {
|
|
|
202
209
|
style: {
|
|
203
210
|
paddingTop: isEmptyComment ? '16px' : ''
|
|
204
211
|
}
|
|
205
|
-
}, isEmptyComment && /*#__PURE__*/_react["default"].createElement(_commentEditor
|
|
212
|
+
}, isEmptyComment && /*#__PURE__*/_react["default"].createElement(_commentEditor.SeafileCommentEditor, {
|
|
213
|
+
addParticipants: addParticipants,
|
|
214
|
+
participants: participants,
|
|
215
|
+
collaborators: collaborators,
|
|
206
216
|
type: "comment",
|
|
207
217
|
insertContent: addNewComment,
|
|
208
218
|
hiddenComment: hiddenComment,
|
|
209
|
-
|
|
210
|
-
|
|
219
|
+
closePanel: closeComment,
|
|
220
|
+
api: {
|
|
221
|
+
uploadLocalImage: _context2["default"].uploadLocalImage
|
|
222
|
+
}
|
|
211
223
|
}), !isEmptyComment && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, !isActiveEditor && /*#__PURE__*/_react["default"].createElement(_reactstrap.Input, {
|
|
212
224
|
value: inputContent !== null && inputContent !== void 0 && inputContent.trim() ? '.....' : '',
|
|
213
225
|
readOnly: true,
|
|
@@ -215,29 +227,40 @@ var CommentList = function CommentList(_ref) {
|
|
|
215
227
|
onFocus: function onFocus() {
|
|
216
228
|
setActiveCommentKey(index);
|
|
217
229
|
}
|
|
218
|
-
}), isActiveEditor && /*#__PURE__*/_react["default"].createElement(_commentEditor
|
|
230
|
+
}), isActiveEditor && /*#__PURE__*/_react["default"].createElement(_commentEditor.SeafileCommentEditor, {
|
|
219
231
|
type: "reply",
|
|
220
232
|
placeholder: 'Enter_reply_shift_Enter_for_new_line_Enter_to_send',
|
|
221
|
-
|
|
233
|
+
addParticipants: addParticipants,
|
|
234
|
+
participants: participants,
|
|
235
|
+
collaborators: collaborators,
|
|
236
|
+
content: commentInputs[item.id] || '',
|
|
222
237
|
insertContent: function insertContent(value) {
|
|
223
238
|
return handleReplySubmit(value, item.id);
|
|
224
239
|
},
|
|
225
240
|
onContentChange: function onContentChange(content) {
|
|
226
241
|
return handleInputChange(item.id, content);
|
|
227
242
|
},
|
|
228
|
-
hiddenComment: hiddenComment
|
|
243
|
+
hiddenComment: hiddenComment,
|
|
244
|
+
api: {
|
|
245
|
+
uploadLocalImage: _context2["default"].uploadLocalImage
|
|
246
|
+
}
|
|
229
247
|
}))));
|
|
230
248
|
}), Object.values(commentDetail).length === 0 && /*#__PURE__*/_react["default"].createElement("div", {
|
|
231
249
|
className: "non-global-comment-input-wrapper",
|
|
232
250
|
style: {
|
|
233
251
|
paddingTop: isEmptyComment ? '16px' : ''
|
|
234
252
|
}
|
|
235
|
-
}, isEmptyComment && /*#__PURE__*/_react["default"].createElement(_commentEditor
|
|
253
|
+
}, isEmptyComment && /*#__PURE__*/_react["default"].createElement(_commentEditor.SeafileCommentEditor, {
|
|
236
254
|
type: "comment",
|
|
255
|
+
addParticipants: addParticipants,
|
|
256
|
+
participants: participants,
|
|
257
|
+
collaborators: collaborators,
|
|
237
258
|
insertContent: addNewComment,
|
|
238
259
|
hiddenComment: hiddenComment,
|
|
239
|
-
|
|
240
|
-
|
|
260
|
+
closePanel: closeComment,
|
|
261
|
+
api: {
|
|
262
|
+
uploadLocalImage: _context2["default"].uploadLocalImage
|
|
263
|
+
}
|
|
241
264
|
}), !isEmptyComment && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, !showEditor && /*#__PURE__*/_react["default"].createElement(_reactstrap.Input, {
|
|
242
265
|
value: inputContent !== null && inputContent !== void 0 && inputContent.trim() ? '.....' : '',
|
|
243
266
|
readOnly: true,
|
|
@@ -245,15 +268,21 @@ var CommentList = function CommentList(_ref) {
|
|
|
245
268
|
onFocus: function onFocus() {
|
|
246
269
|
setShowEditor(true);
|
|
247
270
|
}
|
|
248
|
-
}), showEditor && /*#__PURE__*/_react["default"].createElement(_commentEditor
|
|
271
|
+
}), showEditor && /*#__PURE__*/_react["default"].createElement(_commentEditor.SeafileCommentEditor, {
|
|
249
272
|
type: "reply",
|
|
250
273
|
placeholder: 'Enter_reply_shift_Enter_for_new_line_Enter_to_send',
|
|
251
|
-
|
|
274
|
+
addParticipants: addParticipants,
|
|
275
|
+
participants: participants,
|
|
276
|
+
collaborators: collaborators,
|
|
277
|
+
content: inputContent,
|
|
252
278
|
insertContent: replyComment,
|
|
253
279
|
onContentChange: function onContentChange(content) {
|
|
254
280
|
setInputContent(content);
|
|
255
281
|
},
|
|
256
|
-
hiddenComment: hiddenComment
|
|
282
|
+
hiddenComment: hiddenComment,
|
|
283
|
+
api: {
|
|
284
|
+
uploadLocalImage: _context2["default"].uploadLocalImage
|
|
285
|
+
}
|
|
257
286
|
}))));
|
|
258
287
|
};
|
|
259
288
|
var _default = exports["default"] = (0, _reactI18next.withTranslation)('sdoc-editor')(CommentList);
|
|
@@ -6,8 +6,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports["default"] = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _commentEditor = require("@seafile/comment-editor");
|
|
9
10
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
|
-
var
|
|
11
|
+
var _context = _interopRequireDefault(require("../../../context"));
|
|
12
|
+
var _useCollaborators2 = require("../../../hooks/use-collaborators");
|
|
13
|
+
var _useParticipants = require("../../hooks/use-participants");
|
|
11
14
|
var GlobalCommentEditor = function GlobalCommentEditor(_ref) {
|
|
12
15
|
var isScrollDisplayed = _ref.isScrollDisplayed,
|
|
13
16
|
globalCommentContent = _ref.globalCommentContent,
|
|
@@ -15,20 +18,32 @@ var GlobalCommentEditor = function GlobalCommentEditor(_ref) {
|
|
|
15
18
|
insertDocComment = _ref.insertDocComment,
|
|
16
19
|
hiddenCommentEditor = _ref.hiddenCommentEditor,
|
|
17
20
|
onContentChange = _ref.onContentChange;
|
|
21
|
+
var _useParticipantsConte = (0, _useParticipants.useParticipantsContext)(),
|
|
22
|
+
addParticipants = _useParticipantsConte.addParticipants,
|
|
23
|
+
participants = _useParticipantsConte.participants;
|
|
24
|
+
var _useCollaborators = (0, _useCollaborators2.useCollaborators)(),
|
|
25
|
+
collaborators = _useCollaborators.collaborators;
|
|
26
|
+
var commentEditorProps = {
|
|
27
|
+
type: type,
|
|
28
|
+
className: 'sdoc-doc-comment-editor',
|
|
29
|
+
hiddenUserInfo: true,
|
|
30
|
+
content: globalCommentContent,
|
|
31
|
+
insertContent: insertDocComment,
|
|
32
|
+
onContentChange: onContentChange,
|
|
33
|
+
hiddenComment: hiddenCommentEditor,
|
|
34
|
+
addParticipants: addParticipants,
|
|
35
|
+
collaborators: collaborators,
|
|
36
|
+
participants: participants,
|
|
37
|
+
api: {
|
|
38
|
+
uploadLocalImage: _context["default"].uploadLocalImage
|
|
39
|
+
}
|
|
40
|
+
};
|
|
18
41
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
19
42
|
className: (0, _classnames["default"])('sdoc-doc-comment-editor-container', 'sdoc-comment-list-container', {
|
|
20
43
|
'scrolled': isScrollDisplayed
|
|
21
44
|
})
|
|
22
45
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
23
46
|
className: "sdoc-doc-comment-editor-content"
|
|
24
|
-
}, /*#__PURE__*/_react["default"].createElement(_commentEditor
|
|
25
|
-
type: type,
|
|
26
|
-
className: "sdoc-doc-comment-editor",
|
|
27
|
-
commentContent: globalCommentContent,
|
|
28
|
-
hiddenUserInfo: true,
|
|
29
|
-
insertContent: insertDocComment,
|
|
30
|
-
hiddenComment: hiddenCommentEditor,
|
|
31
|
-
onContentChange: onContentChange
|
|
32
|
-
})));
|
|
47
|
+
}, /*#__PURE__*/_react["default"].createElement(_commentEditor.SeafileCommentEditor, commentEditorProps)));
|
|
33
48
|
};
|
|
34
49
|
var _default = exports["default"] = GlobalCommentEditor;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
z-index: 101;
|
|
5
5
|
width: auto;
|
|
6
6
|
}
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
.sdoc-link-hover-menu-container .hover-menu-container {
|
|
9
9
|
height: 36px;
|
|
10
10
|
padding: 7px 8px;
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
border: 1px solid #e8e8e8;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
.sdoc-link-hover-menu-container .hover-menu-container
|
|
20
|
+
.sdoc-link-hover-menu-container .hover-menu-container>span:not(:last-of-type) {
|
|
21
21
|
padding-right: 8px;
|
|
22
22
|
border-right: 1px solid #e5e5e5;
|
|
23
23
|
}
|
|
@@ -72,6 +72,10 @@
|
|
|
72
72
|
color: #444;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
+
.sdoc-link-hover-menu-container .hover-menu-container .sdoc-drop-down {
|
|
76
|
+
color: #999;
|
|
77
|
+
}
|
|
78
|
+
|
|
75
79
|
.sdoc-link-hover-menu-container .sdoc-file-display-style-popover {
|
|
76
80
|
position: absolute;
|
|
77
81
|
top: 37px;
|
|
@@ -36,7 +36,7 @@ function ArticleContainer(_ref) {
|
|
|
36
36
|
_ref2$isFullWidth = _ref2.isFullWidth,
|
|
37
37
|
isFullWidth = _ref2$isFullWidth === void 0 ? _localStorageUtils["default"].getItem(_constants.FULL_WIDTH_MODE) : _ref2$isFullWidth;
|
|
38
38
|
// Full width mode
|
|
39
|
-
if (isFullWidth) {
|
|
39
|
+
if (isFullWidth && editor.editorType !== _constants.WIKI_EDITOR) {
|
|
40
40
|
var _containerStyle = (0, _fullWidthMode.getStyleByFullWidthMode)(scrollRef, editor);
|
|
41
41
|
setContainerStyle(_containerStyle);
|
|
42
42
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seafile/sdoc-editor",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.139-alpha.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "jest",
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
"license": "ISC",
|
|
18
18
|
"description": "",
|
|
19
19
|
"dependencies": {
|
|
20
|
+
"@seafile/comment-editor": "^0.0.4",
|
|
20
21
|
"@seafile/print-js": "1.6.6",
|
|
21
22
|
"@seafile/react-image-lightbox": "4.0.2",
|
|
22
23
|
"@seafile/slate": "0.91.8",
|
|
@@ -69,6 +70,5 @@
|
|
|
69
70
|
},
|
|
70
71
|
"publishConfig": {
|
|
71
72
|
"access": "public"
|
|
72
|
-
}
|
|
73
|
-
"gitHead": "e37c22df522d41b67c793fd7b6f9b498ec691d17"
|
|
73
|
+
}
|
|
74
74
|
}
|
package/LICENSE.txt
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
Copyright (c) 2025 Seafile Ltd.
|
|
2
|
-
|
|
3
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
you may not use this file except in compliance with the License.
|
|
5
|
-
You may obtain a copy of the License at
|
|
6
|
-
|
|
7
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
|
|
9
|
-
Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
See the License for the specific language governing permissions and
|
|
13
|
-
limitations under the License.
|
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")["default"];
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports["default"] = void 0;
|
|
9
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
-
var _reactI18next = require("react-i18next");
|
|
11
|
-
var _slate = require("@seafile/slate");
|
|
12
|
-
var _slateReact = require("@seafile/slate-react");
|
|
13
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
14
|
-
var _constants = require("../../constants");
|
|
15
|
-
var _context = _interopRequireDefault(require("../../context"));
|
|
16
|
-
var _sdocCommentEditor = _interopRequireDefault(require("../../editor/sdoc-comment-editor"));
|
|
17
|
-
var _extension = require("../../extension");
|
|
18
|
-
var _constants2 = require("../../extension/constants");
|
|
19
|
-
var _core = require("../../extension/core");
|
|
20
|
-
var _nodeId = _interopRequireDefault(require("../../node-id"));
|
|
21
|
-
var _mdToSlate = _interopRequireDefault(require("../../slate-convert/md-to-slate"));
|
|
22
|
-
var _slateToMd = _interopRequireDefault(require("../../slate-convert/slate-to-md"));
|
|
23
|
-
var _eventBus = _interopRequireDefault(require("../../utils/event-bus"));
|
|
24
|
-
var _useParticipants = require("../hooks/use-participants");
|
|
25
|
-
var getSubmitTip = function getSubmitTip(type, content) {
|
|
26
|
-
if (content) return 'Save';
|
|
27
|
-
return type === 'comment' ? 'Comment' : 'Reply';
|
|
28
|
-
};
|
|
29
|
-
var DEFAULT_PLACEHOLDER = 'Enter_comment_shift_enter_for_new_line_Enter_to_send';
|
|
30
|
-
var CommentEditor = function CommentEditor(_ref) {
|
|
31
|
-
var type = _ref.type,
|
|
32
|
-
className = _ref.className,
|
|
33
|
-
content = _ref.content,
|
|
34
|
-
commentContent = _ref.commentContent,
|
|
35
|
-
_ref$placeholder = _ref.placeholder,
|
|
36
|
-
placeholder = _ref$placeholder === void 0 ? DEFAULT_PLACEHOLDER : _ref$placeholder,
|
|
37
|
-
insertContent = _ref.insertContent,
|
|
38
|
-
updateContent = _ref.updateContent,
|
|
39
|
-
setIsEditing = _ref.setIsEditing,
|
|
40
|
-
hiddenComment = _ref.hiddenComment,
|
|
41
|
-
hiddenUserInfo = _ref.hiddenUserInfo,
|
|
42
|
-
onContentChange = _ref.onContentChange,
|
|
43
|
-
isContextComment = _ref.isContextComment,
|
|
44
|
-
closeComment = _ref.closeComment;
|
|
45
|
-
var commentWrapperRef = (0, _react.useRef)();
|
|
46
|
-
var _useTranslation = (0, _reactI18next.useTranslation)('sdoc-editor'),
|
|
47
|
-
t = _useTranslation.t;
|
|
48
|
-
var _useParticipantsConte = (0, _useParticipants.useParticipantsContext)(),
|
|
49
|
-
addParticipants = _useParticipantsConte.addParticipants;
|
|
50
|
-
var submitTip = (0, _react.useMemo)(function () {
|
|
51
|
-
return getSubmitTip(type, content);
|
|
52
|
-
}, [content, type]);
|
|
53
|
-
var userInfo = _context["default"].getUserInfo();
|
|
54
|
-
var document = (0, _react.useMemo)(function () {
|
|
55
|
-
var cursor = {};
|
|
56
|
-
var elements = null;
|
|
57
|
-
elements = [(0, _core.generateEmptyElement)(_constants2.PARAGRAPH, {
|
|
58
|
-
placeholder: placeholder
|
|
59
|
-
})];
|
|
60
|
-
return {
|
|
61
|
-
elements: elements,
|
|
62
|
-
cursor: cursor
|
|
63
|
-
};
|
|
64
|
-
}, [placeholder]);
|
|
65
|
-
var editor = (0, _react.useMemo)(function () {
|
|
66
|
-
var defaultEditor = (0, _extension.createCommentEditor)();
|
|
67
|
-
var newEditor = (0, _nodeId["default"])(defaultEditor);
|
|
68
|
-
var cursors = document.cursors;
|
|
69
|
-
newEditor.cursors = cursors || {};
|
|
70
|
-
newEditor.width = _constants.COMMENT_EDITOR_EDIT_AREA_WIDTH; // default width
|
|
71
|
-
newEditor.editorType = _constants.COMMENT_EDITOR;
|
|
72
|
-
return newEditor;
|
|
73
|
-
}, [document]);
|
|
74
|
-
var updateValue = (0, _react.useCallback)(function (value) {
|
|
75
|
-
if (!value || value.trim() === '') return;
|
|
76
|
-
if (!content) return insertContent(value);
|
|
77
|
-
updateContent && updateContent(value);
|
|
78
|
-
}, [content, insertContent, updateContent]);
|
|
79
|
-
var onSubmit = (0, _react.useCallback)(function (event) {
|
|
80
|
-
event && event.stopPropagation();
|
|
81
|
-
var mdString = (0, _slateToMd["default"])(editor.children);
|
|
82
|
-
updateValue(mdString);
|
|
83
|
-
addParticipants(userInfo.username);
|
|
84
|
-
editor.children = [(0, _core.generateEmptyElement)(_constants2.PARAGRAPH, {
|
|
85
|
-
placeholder: placeholder
|
|
86
|
-
})];
|
|
87
|
-
_slate.Transforms.select(editor, _slate.Editor.start(editor, []));
|
|
88
|
-
onContentChange && onContentChange(null);
|
|
89
|
-
closeComment && closeComment();
|
|
90
|
-
}, [editor, updateValue, addParticipants, userInfo.username, placeholder, onContentChange, closeComment]);
|
|
91
|
-
var onSubmitByEnterKey = (0, _react.useCallback)(function (event) {
|
|
92
|
-
if (!_slateReact.ReactEditor.isFocused(editor)) return;
|
|
93
|
-
onSubmit(event);
|
|
94
|
-
}, [editor, onSubmit]);
|
|
95
|
-
(0, _react.useEffect)(function () {
|
|
96
|
-
var eventBus = _eventBus["default"].getInstance();
|
|
97
|
-
var unsubscribePostComment = eventBus.subscribe(_constants.INTERNAL_EVENT.COMMENT_EDITOR_POST_COMMENT, onSubmitByEnterKey);
|
|
98
|
-
return function () {
|
|
99
|
-
unsubscribePostComment();
|
|
100
|
-
};
|
|
101
|
-
}, [onSubmitByEnterKey]);
|
|
102
|
-
var onCancel = (0, _react.useCallback)(function (event) {
|
|
103
|
-
event.stopPropagation();
|
|
104
|
-
var eventType = event.type,
|
|
105
|
-
keyCode = event.keyCode,
|
|
106
|
-
target = event.target;
|
|
107
|
-
if (eventType === 'keydown' && keyCode !== _constants.KeyCodes.Esc) return;
|
|
108
|
-
if (eventType === 'click') {
|
|
109
|
-
var isSdocContentWrapper = target.classList.contains('sdoc-content-wrapper');
|
|
110
|
-
var listContainer = window.document.querySelector('#global-comment-list-container');
|
|
111
|
-
var resizeContainer = window.document.querySelector('.sdoc-comment-resize-handler');
|
|
112
|
-
var isClickOnListContainer = listContainer && listContainer.contains(target);
|
|
113
|
-
var isClickOnCommentEditorContainer = commentWrapperRef.current.contains(target);
|
|
114
|
-
var isClickResizeContainer = resizeContainer && resizeContainer.contains(target);
|
|
115
|
-
var isPreventCancel = isClickOnListContainer || isClickOnCommentEditorContainer || isClickResizeContainer || isSdocContentWrapper;
|
|
116
|
-
if (isPreventCancel) return;
|
|
117
|
-
}
|
|
118
|
-
setIsEditing && setIsEditing(false);
|
|
119
|
-
hiddenComment && hiddenComment(false);
|
|
120
|
-
if (onContentChange) {
|
|
121
|
-
if (editor.children.find(function (n) {
|
|
122
|
-
return _slate.Node.string(n).trim();
|
|
123
|
-
})) {
|
|
124
|
-
onContentChange((0, _slateToMd["default"])(editor.children));
|
|
125
|
-
} else {
|
|
126
|
-
onContentChange(null);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
130
|
-
}, [setIsEditing]);
|
|
131
|
-
(0, _react.useEffect)(function () {
|
|
132
|
-
var children = (0, _mdToSlate["default"])(content);
|
|
133
|
-
if (commentContent) {
|
|
134
|
-
children = (0, _mdToSlate["default"])(commentContent);
|
|
135
|
-
}
|
|
136
|
-
editor.children = children;
|
|
137
|
-
_slate.Transforms.select(editor, _slate.Editor.end(editor, []));
|
|
138
|
-
}, [editor, content, commentContent]);
|
|
139
|
-
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
140
|
-
className: (0, _classnames["default"])('comment-editor-wrapper', className),
|
|
141
|
-
ref: commentWrapperRef
|
|
142
|
-
}, type === 'comment' && !hiddenUserInfo && /*#__PURE__*/_react["default"].createElement("div", {
|
|
143
|
-
className: "comment-editor-user-info"
|
|
144
|
-
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
145
|
-
className: "comment-editor-user-img"
|
|
146
|
-
}, /*#__PURE__*/_react["default"].createElement("img", {
|
|
147
|
-
src: userInfo.avatar_url,
|
|
148
|
-
alt: "",
|
|
149
|
-
height: "100%",
|
|
150
|
-
width: "100%"
|
|
151
|
-
})), /*#__PURE__*/_react["default"].createElement("div", {
|
|
152
|
-
className: "comment-editor-user-name"
|
|
153
|
-
}, userInfo.name)), /*#__PURE__*/_react["default"].createElement(_sdocCommentEditor["default"], {
|
|
154
|
-
editor: editor,
|
|
155
|
-
type: type,
|
|
156
|
-
document: document,
|
|
157
|
-
onSubmit: onSubmit,
|
|
158
|
-
submitBtnText: t(submitTip),
|
|
159
|
-
onCancel: onCancel
|
|
160
|
-
}));
|
|
161
|
-
};
|
|
162
|
-
var _default = exports["default"] = CommentEditor;
|
|
@@ -1,209 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")["default"];
|
|
4
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports["default"] = void 0;
|
|
9
|
-
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
10
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/toConsumableArray"));
|
|
11
|
-
var _regeneratorRuntime2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/regeneratorRuntime"));
|
|
12
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/asyncToGenerator"));
|
|
13
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
14
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
15
|
-
var _reactI18next = require("react-i18next");
|
|
16
|
-
var _slate = require("@seafile/slate");
|
|
17
|
-
var _deepCopy = _interopRequireDefault(require("deep-copy"));
|
|
18
|
-
var _notificationHooks = require("../comment/hooks/notification-hooks");
|
|
19
|
-
var _fileLoading = _interopRequireDefault(require("../components/file-loading"));
|
|
20
|
-
var _toast = _interopRequireDefault(require("../components/toast"));
|
|
21
|
-
var _constants = require("../constants");
|
|
22
|
-
var _context2 = _interopRequireDefault(require("../context"));
|
|
23
|
-
var _extension = require("../extension");
|
|
24
|
-
var _core = require("../extension/core");
|
|
25
|
-
var _commentEditorToolbar = _interopRequireDefault(require("../extension/toolbar/comment-editor-toolbar"));
|
|
26
|
-
var _useCollaborators = require("../hooks/use-collaborators");
|
|
27
|
-
var _useScrollContext = require("../hooks/use-scroll-context");
|
|
28
|
-
var _layout = require("../layout");
|
|
29
|
-
var _nodeId = _interopRequireDefault(require("../node-id"));
|
|
30
|
-
var _socket = require("../socket");
|
|
31
|
-
var _commonUtils = require("../utils/common-utils");
|
|
32
|
-
var _eventBus = _interopRequireDefault(require("../utils/event-bus"));
|
|
33
|
-
var _commentArticle = _interopRequireDefault(require("./comment-article"));
|
|
34
|
-
var SdocCommentEditor = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
35
|
-
var propsEditor = _ref.editor,
|
|
36
|
-
document = _ref.document,
|
|
37
|
-
isReloading = _ref.isReloading,
|
|
38
|
-
type = _ref.type,
|
|
39
|
-
onSubmit = _ref.onSubmit,
|
|
40
|
-
submitBtnText = _ref.submitBtnText,
|
|
41
|
-
onCancel = _ref.onCancel;
|
|
42
|
-
var _useState = (0, _react.useState)(document.elements),
|
|
43
|
-
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
44
|
-
slateValue = _useState2[0],
|
|
45
|
-
_setSlateValue = _useState2[1];
|
|
46
|
-
var commentEditorContainerRef = (0, _react.useRef)(null);
|
|
47
|
-
var commentTimeoutRef = (0, _react.useRef)(null);
|
|
48
|
-
var _useNotificationConte = (0, _notificationHooks.useNotificationContext)(),
|
|
49
|
-
notificationsInfo = _useNotificationConte.notificationsInfo;
|
|
50
|
-
var _useTranslation = (0, _reactI18next.useTranslation)('sdoc-editor'),
|
|
51
|
-
t = _useTranslation.t;
|
|
52
|
-
var validEditor = (0, _react.useMemo)(function () {
|
|
53
|
-
if (propsEditor) return propsEditor;
|
|
54
|
-
var defaultEditor = (0, _extension.createCommentEditor)();
|
|
55
|
-
var editorConfig = _context2["default"].getEditorConfig();
|
|
56
|
-
var newEditor = (0, _nodeId["default"])((0, _socket.withSocketIO)(defaultEditor, {
|
|
57
|
-
document: document,
|
|
58
|
-
config: editorConfig
|
|
59
|
-
}));
|
|
60
|
-
var cursors = document.cursors;
|
|
61
|
-
newEditor.cursors = cursors || {};
|
|
62
|
-
newEditor.width = _constants.COMMENT_EDITOR_EDIT_AREA_WIDTH; // default width
|
|
63
|
-
|
|
64
|
-
return newEditor;
|
|
65
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
66
|
-
}, []);
|
|
67
|
-
(0, _react.useEffect)(function () {
|
|
68
|
-
if (!(commentEditorContainerRef !== null && commentEditorContainerRef !== void 0 && commentEditorContainerRef.current)) return;
|
|
69
|
-
if (Object.keys(notificationsInfo.notifications_map || {}).length === 0) return;
|
|
70
|
-
if (!commentEditorContainerRef.current.closest('.global-comment-input-wrapper')) return;
|
|
71
|
-
var clearAllNotification = /*#__PURE__*/function () {
|
|
72
|
-
var _ref2 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee() {
|
|
73
|
-
var res, notifications, eventBus, errorMessage;
|
|
74
|
-
return (0, _regeneratorRuntime2["default"])().wrap(function _callee$(_context) {
|
|
75
|
-
while (1) switch (_context.prev = _context.next) {
|
|
76
|
-
case 0:
|
|
77
|
-
_context.prev = 0;
|
|
78
|
-
_context.next = 3;
|
|
79
|
-
return _context2["default"].readAllNotifications();
|
|
80
|
-
case 3:
|
|
81
|
-
_context.next = 5;
|
|
82
|
-
return _context2["default"].listUnseenNotifications();
|
|
83
|
-
case 5:
|
|
84
|
-
res = _context.sent;
|
|
85
|
-
notifications = res.data.notifications;
|
|
86
|
-
eventBus = _eventBus["default"].getInstance();
|
|
87
|
-
eventBus.dispatch(_constants.INTERNAL_EVENT.UNSEEN_NOTIFICATIONS_COUNT, notifications === null || notifications === void 0 ? void 0 : notifications.length);
|
|
88
|
-
eventBus.dispatch(_constants.INTERNAL_EVENT.NEW_NOTIFICATION);
|
|
89
|
-
eventBus.dispatch(_constants.INTERNAL_EVENT.CLEAR_NOTIFICATION);
|
|
90
|
-
_context.next = 17;
|
|
91
|
-
break;
|
|
92
|
-
case 13:
|
|
93
|
-
_context.prev = 13;
|
|
94
|
-
_context.t0 = _context["catch"](0);
|
|
95
|
-
errorMessage = (0, _commonUtils.getErrorMsg)(_context.t0);
|
|
96
|
-
_toast["default"].danger(t(errorMessage));
|
|
97
|
-
case 17:
|
|
98
|
-
case "end":
|
|
99
|
-
return _context.stop();
|
|
100
|
-
}
|
|
101
|
-
}, _callee, null, [[0, 13]]);
|
|
102
|
-
}));
|
|
103
|
-
return function clearAllNotification() {
|
|
104
|
-
return _ref2.apply(this, arguments);
|
|
105
|
-
};
|
|
106
|
-
}();
|
|
107
|
-
var el = commentEditorContainerRef && commentEditorContainerRef.current;
|
|
108
|
-
|
|
109
|
-
// Mark comment as read if focusing commentEditorContainerRef over 3s
|
|
110
|
-
var handleFocusIn = function handleFocusIn(e) {
|
|
111
|
-
commentTimeoutRef.current = setTimeout(function () {
|
|
112
|
-
clearAllNotification();
|
|
113
|
-
commentTimeoutRef.current = null;
|
|
114
|
-
}, 3000);
|
|
115
|
-
};
|
|
116
|
-
var handleBlur = function handleBlur() {
|
|
117
|
-
clearTimeout(commentTimeoutRef.current);
|
|
118
|
-
commentTimeoutRef.current = null;
|
|
119
|
-
};
|
|
120
|
-
el.addEventListener('focusin', handleFocusIn);
|
|
121
|
-
el.addEventListener('focusout', handleBlur);
|
|
122
|
-
return function () {
|
|
123
|
-
el.removeEventListener('focusin', handleFocusIn);
|
|
124
|
-
el.removeEventListener('focusout', handleBlur);
|
|
125
|
-
if (commentTimeoutRef.current) {
|
|
126
|
-
clearTimeout(commentTimeoutRef.current);
|
|
127
|
-
commentTimeoutRef.current = null;
|
|
128
|
-
}
|
|
129
|
-
};
|
|
130
|
-
}, [notificationsInfo]);
|
|
131
|
-
|
|
132
|
-
// useMount: focus editor
|
|
133
|
-
(0, _react.useEffect)(function () {
|
|
134
|
-
var _validEditor$children = (0, _slicedToArray2["default"])(validEditor.children, 1),
|
|
135
|
-
firstNode = _validEditor$children[0];
|
|
136
|
-
if (firstNode) {
|
|
137
|
-
var _firstNode$children = (0, _slicedToArray2["default"])(firstNode.children, 1),
|
|
138
|
-
firstNodeFirstChild = _firstNode$children[0];
|
|
139
|
-
if (firstNodeFirstChild) {
|
|
140
|
-
var endOfFirstNode = _slate.Editor.end(validEditor, [0, 0]);
|
|
141
|
-
var range = {
|
|
142
|
-
anchor: endOfFirstNode,
|
|
143
|
-
focus: endOfFirstNode
|
|
144
|
-
};
|
|
145
|
-
(0, _core.focusEditor)(validEditor, range);
|
|
146
|
-
}
|
|
147
|
-
// Force refresh to fix comment list
|
|
148
|
-
_setSlateValue((0, _toConsumableArray2["default"])(validEditor.children));
|
|
149
|
-
}
|
|
150
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
151
|
-
}, []);
|
|
152
|
-
|
|
153
|
-
// The parent component can call the method of this component through ref
|
|
154
|
-
(0, _react.useImperativeHandle)(ref, function () {
|
|
155
|
-
return {
|
|
156
|
-
setSlateValue: function setSlateValue(document) {
|
|
157
|
-
// Force update of editor's child elements
|
|
158
|
-
validEditor.children = document.elements;
|
|
159
|
-
_setSlateValue((0, _toConsumableArray2["default"])(document.elements));
|
|
160
|
-
},
|
|
161
|
-
updateDocumentVersion: function updateDocumentVersion(document) {
|
|
162
|
-
validEditor.updateDocumentVersion(document);
|
|
163
|
-
},
|
|
164
|
-
// get value
|
|
165
|
-
getSlateValue: function getSlateValue() {
|
|
166
|
-
return (0, _deepCopy["default"])((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, document), {}, {
|
|
167
|
-
elements: slateValue
|
|
168
|
-
}));
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
172
|
-
};
|
|
173
|
-
}, [document, validEditor, slateValue]);
|
|
174
|
-
if (isReloading) {
|
|
175
|
-
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
176
|
-
className: "h-100 w-100 d-flex align-items-center justify-content-center"
|
|
177
|
-
}, /*#__PURE__*/_react["default"].createElement(_fileLoading["default"], null));
|
|
178
|
-
}
|
|
179
|
-
var handleFocusEditor = function handleFocusEditor(e) {
|
|
180
|
-
if (e.target === commentEditorContainerRef.current) {
|
|
181
|
-
var focusPoint = _slate.Editor.end(validEditor, []);
|
|
182
|
-
(0, _core.focusEditor)(validEditor, focusPoint);
|
|
183
|
-
}
|
|
184
|
-
};
|
|
185
|
-
return /*#__PURE__*/_react["default"].createElement(_layout.EditorContainer, {
|
|
186
|
-
editor: validEditor
|
|
187
|
-
}, /*#__PURE__*/_react["default"].createElement(_useCollaborators.CollaboratorsProvider, null, /*#__PURE__*/_react["default"].createElement("div", {
|
|
188
|
-
className: "sdoc-comment-editor-wrapper"
|
|
189
|
-
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
190
|
-
ref: commentEditorContainerRef,
|
|
191
|
-
className: "article sdoc-comment-editor",
|
|
192
|
-
onClick: handleFocusEditor
|
|
193
|
-
}, /*#__PURE__*/_react["default"].createElement(_useScrollContext.ScrollContext.Provider, {
|
|
194
|
-
value: {
|
|
195
|
-
scrollRef: commentEditorContainerRef
|
|
196
|
-
}
|
|
197
|
-
}, /*#__PURE__*/_react["default"].createElement(_commentArticle["default"], {
|
|
198
|
-
type: type,
|
|
199
|
-
editor: validEditor,
|
|
200
|
-
slateValue: slateValue,
|
|
201
|
-
updateSlateValue: _setSlateValue
|
|
202
|
-
}))), /*#__PURE__*/_react["default"].createElement(_commentEditorToolbar["default"], {
|
|
203
|
-
editor: validEditor,
|
|
204
|
-
onSubmit: onSubmit,
|
|
205
|
-
submitBtnText: submitBtnText,
|
|
206
|
-
onCancel: onCancel
|
|
207
|
-
}))));
|
|
208
|
-
});
|
|
209
|
-
var _default = exports["default"] = SdocCommentEditor;
|