@seafile/sdoc-editor 1.0.184 → 1.0.185
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/basic-sdk/comment/components/comment-editor.js +12 -18
- package/dist/basic-sdk/comment/components/comment-item-collapse-wrapper.js +1 -1
- package/dist/basic-sdk/comment/components/comment-item-wrapper.js +6 -19
- package/dist/basic-sdk/comment/components/comment-list.css +37 -55
- package/dist/basic-sdk/comment/components/comment-list.js +71 -30
- package/dist/basic-sdk/comment/components/editor-comment.js +2 -13
- package/dist/basic-sdk/comment/components/global-comment/global-comment-editor.js +4 -4
- package/dist/basic-sdk/comment/components/global-comment/index.css +15 -11
- package/dist/basic-sdk/comment/components/global-comment/index.js +1 -1
- package/dist/basic-sdk/extension/plugins/file-link/render-elem.css +4 -2
- package/dist/basic-sdk/extension/plugins/sdoc-link/render/render-elem.css +11 -5
- package/dist/basic-sdk/extension/plugins/text-style/menu/index.js +0 -5
- package/package.json +1 -1
- package/public/locales/cs/sdoc-editor.json +2 -1
- package/public/locales/de/sdoc-editor.json +2 -1
- package/public/locales/en/sdoc-editor.json +2 -1
- package/public/locales/es/sdoc-editor.json +2 -1
- package/public/locales/es_AR/sdoc-editor.json +2 -1
- package/public/locales/es_MX/sdoc-editor.json +2 -1
- package/public/locales/fr/sdoc-editor.json +2 -1
- package/public/locales/it/sdoc-editor.json +2 -1
- package/public/locales/ru/sdoc-editor.json +18 -17
- package/public/locales/zh_CN/sdoc-editor.json +3 -2
|
@@ -32,15 +32,14 @@ const CommentEditor = _ref => {
|
|
|
32
32
|
type,
|
|
33
33
|
className,
|
|
34
34
|
content,
|
|
35
|
-
|
|
35
|
+
commentContent,
|
|
36
36
|
placeholder,
|
|
37
37
|
insertContent,
|
|
38
38
|
updateContent,
|
|
39
39
|
setIsEditing,
|
|
40
40
|
hiddenComment,
|
|
41
|
-
globalComment,
|
|
42
41
|
hiddenUserInfo,
|
|
43
|
-
|
|
42
|
+
onContentChange
|
|
44
43
|
} = _ref;
|
|
45
44
|
const commentWrapperRef = (0, _react.useRef)();
|
|
46
45
|
const {
|
|
@@ -87,8 +86,8 @@ const CommentEditor = _ref => {
|
|
|
87
86
|
placeholder
|
|
88
87
|
})];
|
|
89
88
|
_slate.Transforms.select(editor, _slate.Editor.start(editor, []));
|
|
90
|
-
|
|
91
|
-
}, [editor, updateValue, addParticipants, userInfo.username, placeholder,
|
|
89
|
+
onContentChange && onContentChange(null);
|
|
90
|
+
}, [editor, updateValue, addParticipants, userInfo.username, placeholder, onContentChange]);
|
|
92
91
|
const onSubmitByEnterKey = (0, _react.useCallback)(event => {
|
|
93
92
|
if (!_slateReact.ReactEditor.isFocused(editor)) return;
|
|
94
93
|
onSubmit(event);
|
|
@@ -111,37 +110,32 @@ const CommentEditor = _ref => {
|
|
|
111
110
|
if (eventType === 'click') {
|
|
112
111
|
const isSdocContentWrapper = target.classList.contains('sdoc-content-wrapper');
|
|
113
112
|
const listContainer = window.document.querySelector('#global-comment-list-container');
|
|
114
|
-
const commentEditorContainer = window.document.querySelector('.sdoc-doc-comment-editor-container');
|
|
115
113
|
const resizeContainer = window.document.querySelector('.sdoc-comment-resize-handler');
|
|
116
|
-
const scrollContainer = window.document.querySelector('.sdoc-scroll-container');
|
|
117
114
|
const isClickOnListContainer = listContainer && listContainer.contains(target);
|
|
118
|
-
const isClickOnCommentEditorContainer =
|
|
115
|
+
const isClickOnCommentEditorContainer = commentWrapperRef.current.contains(target);
|
|
119
116
|
const isClickResizeContainer = resizeContainer && resizeContainer.contains(target);
|
|
120
|
-
const
|
|
121
|
-
const isPreventCancel = isClickOnListContainer || isClickOnCommentEditorContainer || isClickResizeContainer || isClickScrollContainer || isSdocContentWrapper;
|
|
122
|
-
// Global comment could not be canceled by clicking outside
|
|
123
|
-
if (globalComment && !isClickScrollContainer) return;
|
|
117
|
+
const isPreventCancel = isClickOnListContainer || isClickOnCommentEditorContainer || isClickResizeContainer || isSdocContentWrapper;
|
|
124
118
|
if (isPreventCancel) return;
|
|
125
119
|
}
|
|
126
120
|
setIsEditing && setIsEditing(false);
|
|
127
121
|
hiddenComment && hiddenComment(false);
|
|
128
|
-
if (
|
|
122
|
+
if (onContentChange) {
|
|
129
123
|
if (editor.children.find(n => _slate.Node.string(n).trim())) {
|
|
130
|
-
|
|
124
|
+
onContentChange((0, _slateToMd.default)(editor.children));
|
|
131
125
|
} else {
|
|
132
|
-
|
|
126
|
+
onContentChange(null);
|
|
133
127
|
}
|
|
134
128
|
}
|
|
135
129
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
136
130
|
}, [setIsEditing]);
|
|
137
131
|
(0, _react.useEffect)(() => {
|
|
138
132
|
let children = (0, _mdToSlate.default)(content);
|
|
139
|
-
if (
|
|
140
|
-
children = (0, _mdToSlate.default)(
|
|
133
|
+
if (commentContent) {
|
|
134
|
+
children = (0, _mdToSlate.default)(commentContent);
|
|
141
135
|
}
|
|
142
136
|
editor.children = children;
|
|
143
137
|
_slate.Transforms.select(editor, _slate.Editor.end(editor, []));
|
|
144
|
-
}, [editor, content,
|
|
138
|
+
}, [editor, content, commentContent]);
|
|
145
139
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
146
140
|
className: (0, _classnames.default)('comment-editor-wrapper', className),
|
|
147
141
|
ref: commentWrapperRef
|
|
@@ -77,7 +77,7 @@ const CommentItemCollapseWrapper = _ref => {
|
|
|
77
77
|
}, [setCurrentCommentGroup, topLevelComment.id]);
|
|
78
78
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
79
79
|
id: `comment-item-wrapper_${topLevelComment.id}`,
|
|
80
|
-
className: (0, _classnames.default)('comment-ui-container', {
|
|
80
|
+
className: (0, _classnames.default)('comment-collapse-wrapper', 'comment-ui-container', {
|
|
81
81
|
'sdoc-resolved': topLevelComment.resolved,
|
|
82
82
|
'd-flex flex-column': element
|
|
83
83
|
}),
|
|
@@ -15,7 +15,6 @@ var _context = _interopRequireDefault(require("../../../context"));
|
|
|
15
15
|
var _useCommentContext = require("../hooks/comment-hooks/use-comment-context");
|
|
16
16
|
var _commentItemContent = _interopRequireDefault(require("./comment-item-content"));
|
|
17
17
|
var _commentItemReply = _interopRequireDefault(require("./comment-item-reply"));
|
|
18
|
-
var _commentEditor = _interopRequireDefault(require("./comment-editor"));
|
|
19
18
|
var _constants = require("../constants");
|
|
20
19
|
var _commentDeletePopover = _interopRequireDefault(require("./comment-delete-popover"));
|
|
21
20
|
const CommentItemWrapper = _ref => {
|
|
@@ -28,11 +27,10 @@ const CommentItemWrapper = _ref => {
|
|
|
28
27
|
isGlobalComment,
|
|
29
28
|
commentDetailRef,
|
|
30
29
|
updateScrollPosition,
|
|
31
|
-
hiddenComment,
|
|
32
30
|
setCurrentCommentGroup,
|
|
33
31
|
onCommentClick,
|
|
34
32
|
isEmptyComment,
|
|
35
|
-
|
|
33
|
+
isCollapseCommentEditor
|
|
36
34
|
} = _ref;
|
|
37
35
|
const listRef = (0, _react.useRef)(null);
|
|
38
36
|
const {
|
|
@@ -41,6 +39,9 @@ const CommentItemWrapper = _ref => {
|
|
|
41
39
|
const scrollRef = (0, _react.useRef)(document.querySelector('.sdoc-scroll-container'));
|
|
42
40
|
const [isShowDeleteDialog, setIsShowDeleteDialog] = (0, _react.useState)(false);
|
|
43
41
|
const commentOpToolsId = `commentOpTools_${comment === null || comment === void 0 ? void 0 : comment.id}`;
|
|
42
|
+
const style = !isGlobalComment && isCollapseCommentEditor ? {
|
|
43
|
+
maxHeight: '341px'
|
|
44
|
+
} : {};
|
|
44
45
|
const deleteComment = (0, _react.useCallback)(async commentId => {
|
|
45
46
|
await _context.default.deleteComment(commentId);
|
|
46
47
|
const {
|
|
@@ -278,7 +279,8 @@ const CommentItemWrapper = _ref => {
|
|
|
278
279
|
className: "comment-item-selected-text"
|
|
279
280
|
}, _slate.Node.string(element))), !isEmptyComment && /*#__PURE__*/_react.default.createElement("div", {
|
|
280
281
|
ref: listRef,
|
|
281
|
-
className: "comment-item-list"
|
|
282
|
+
className: "comment-item-list",
|
|
283
|
+
style: style
|
|
282
284
|
}, /*#__PURE__*/_react.default.createElement(_commentItemContent.default, {
|
|
283
285
|
key: comment.id,
|
|
284
286
|
container: container,
|
|
@@ -298,21 +300,6 @@ const CommentItemWrapper = _ref => {
|
|
|
298
300
|
updateReply
|
|
299
301
|
};
|
|
300
302
|
return /*#__PURE__*/_react.default.createElement(_commentItemReply.default, props);
|
|
301
|
-
})), !isGlobalComment && /*#__PURE__*/_react.default.createElement("div", {
|
|
302
|
-
className: "sdoc-reply-wrapper",
|
|
303
|
-
style: {
|
|
304
|
-
paddingTop: isEmptyComment ? '16px' : ''
|
|
305
|
-
}
|
|
306
|
-
}, isEmptyComment && /*#__PURE__*/_react.default.createElement(_commentEditor.default, {
|
|
307
|
-
type: "comment",
|
|
308
|
-
placeholder: 'Enter_reply_shift_Enter_for_new_line_Enter_to_send',
|
|
309
|
-
insertContent: addNewComment,
|
|
310
|
-
hiddenComment: hiddenComment
|
|
311
|
-
}), !isEmptyComment && /*#__PURE__*/_react.default.createElement(_commentEditor.default, {
|
|
312
|
-
type: "reply",
|
|
313
|
-
placeholder: 'Enter_reply_shift_Enter_for_new_line_Enter_to_send',
|
|
314
|
-
insertContent: insertContent,
|
|
315
|
-
hiddenComment: hiddenComment
|
|
316
303
|
})), isShowDeleteDialog && isActive && /*#__PURE__*/_react.default.createElement(_commentDeletePopover.default, {
|
|
317
304
|
type: "comment",
|
|
318
305
|
setIsShowDeleteDialog: setIsShowDeleteDialog,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
.sdoc-comment-list-container {
|
|
2
2
|
position: absolute;
|
|
3
|
-
margin-top: 5px;
|
|
4
3
|
right: 0;
|
|
5
4
|
}
|
|
6
5
|
|
|
@@ -8,20 +7,7 @@
|
|
|
8
7
|
font-size: 14px;
|
|
9
8
|
}
|
|
10
9
|
|
|
11
|
-
.sdoc-comment-list-container .comment-ui-container {
|
|
12
|
-
background-color: rgba(255, 255, 255);
|
|
13
|
-
margin-bottom: 0px;
|
|
14
|
-
box-shadow: 0 1px 3px rgba(0, 0, 0, .15), 0 4px 8px 3px rgba(0, 0, 0, .15);
|
|
15
|
-
padding: 16px;
|
|
16
|
-
border-radius: 5px;
|
|
17
|
-
cursor: pointer;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
10
|
/* comment detail list */
|
|
21
|
-
.sdoc-comment-list-container .comment-item-detail-wrapper .comment-item-list {
|
|
22
|
-
margin-bottom: 16px;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
11
|
.sdoc-comment-list-container .comment-item-detail-wrapper .comment-item-list .comment-item .comment-content {
|
|
26
12
|
margin-bottom: 0px;
|
|
27
13
|
}
|
|
@@ -30,27 +16,6 @@
|
|
|
30
16
|
padding: 16px 16px 0px;
|
|
31
17
|
}
|
|
32
18
|
|
|
33
|
-
.sdoc-comment-list-container .comment-ui-container.sdoc-resolved {
|
|
34
|
-
background: #f5f5f5;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
.sdoc-comment-list-container .comment-ui-container.active {
|
|
38
|
-
position: relative;
|
|
39
|
-
left: -5px;
|
|
40
|
-
background: rgba(255, 255, 255, 1);
|
|
41
|
-
box-shadow: 0 1px 3px rgba(0, 0, 0, .15), 0 4px 8px 3px rgba(0, 0, 0, .15);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
.sdoc-comment-list-container .comment-item-selected-text-container {
|
|
45
|
-
width: 100%;
|
|
46
|
-
height: 32px;
|
|
47
|
-
display: flex;
|
|
48
|
-
padding: 6px 16px;
|
|
49
|
-
align-items: center;
|
|
50
|
-
overflow: hidden;
|
|
51
|
-
border-radius: 3px 3px 0 0;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
19
|
.sdoc-comment-list-container .comment-item-selected-text-container .sdoc-comment-quote {
|
|
55
20
|
font-size: 12px;
|
|
56
21
|
flex-shrink: 0;
|
|
@@ -73,14 +38,9 @@
|
|
|
73
38
|
padding-bottom: 0px;
|
|
74
39
|
}
|
|
75
40
|
|
|
76
|
-
.sdoc-comment-list-container-popover .comment-item-list {
|
|
77
|
-
max-height: 280px;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
41
|
.sdoc-comment-list-container .comment-item {
|
|
81
42
|
position: relative;
|
|
82
43
|
padding: 0px;
|
|
83
|
-
cursor: pointer;
|
|
84
44
|
}
|
|
85
45
|
|
|
86
46
|
.sdoc-comment-list-container .comment-item .comment-item-operation-wrapper {
|
|
@@ -172,7 +132,6 @@
|
|
|
172
132
|
overflow: hidden;
|
|
173
133
|
white-space: nowrap;
|
|
174
134
|
text-overflow: ellipsis;
|
|
175
|
-
cursor: pointer;
|
|
176
135
|
}
|
|
177
136
|
|
|
178
137
|
.sdoc-comment-list-container .comment-header .comment-author__info .name {
|
|
@@ -340,11 +299,6 @@
|
|
|
340
299
|
justify-content: flex-end;
|
|
341
300
|
}
|
|
342
301
|
|
|
343
|
-
.sdoc-doc-comment-editor-container.sdoc-comment-list-container .comment-ui-container {
|
|
344
|
-
padding-left: 10px;
|
|
345
|
-
padding-right: 10px;
|
|
346
|
-
}
|
|
347
|
-
|
|
348
302
|
/* Side comment style */
|
|
349
303
|
.sdoc-article-container .sdoc-comment-list-container .comment-item .comment-header .comment-author__avatar {
|
|
350
304
|
display: flex;
|
|
@@ -380,21 +334,49 @@
|
|
|
380
334
|
padding-left: 8px;
|
|
381
335
|
}
|
|
382
336
|
|
|
383
|
-
.sdoc-article-container .sdoc-comment-list-container .sdoc-reply-wrapper {
|
|
384
|
-
padding: 0 16px 16px;
|
|
385
|
-
}
|
|
386
|
-
|
|
387
337
|
.sdoc-article-container .sdoc-comment-list-container .comment-content div:last-child p {
|
|
388
338
|
margin-bottom: 0;
|
|
389
339
|
}
|
|
390
340
|
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
341
|
+
.sdoc-comment-list-container-popover {
|
|
342
|
+
background-color: rgba(255, 255, 255);
|
|
343
|
+
box-shadow: 0 1px 3px rgba(0, 0, 0, .15), 0 4px 8px 3px rgba(0, 0, 0, .15);
|
|
344
|
+
border-radius: 5px;
|
|
394
345
|
}
|
|
395
346
|
|
|
396
|
-
.sdoc-
|
|
397
|
-
|
|
347
|
+
.sdoc-comment-list-container-popover .comment-item-list {
|
|
348
|
+
max-height: 260px;
|
|
349
|
+
margin-bottom: 16px;
|
|
350
|
+
padding-bottom: 16px;
|
|
351
|
+
border-bottom: 1px solid #ececec;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
.sdoc-comment-list-container-popover .non-global-comment-input-wrapper {
|
|
355
|
+
padding: 0px 16px 16px 16px;
|
|
356
|
+
width: 100%;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
.sdoc-comment-list-container-popover .non-global-comment-input-wrapper .form-control[readonly] {
|
|
360
|
+
background-color: #fff;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
.sdoc-comment-list-container-popover .non-global-comment-input-wrapper .form-control {
|
|
364
|
+
font-size: 14px;
|
|
365
|
+
font-weight: unset;
|
|
366
|
+
border: 1px solid #ececec;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
.sdoc-comment-list-container-popover .non-global-comment-input-wrapper.active .form-control {
|
|
370
|
+
padding-top: 14px;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
.sdoc-comment-list-container-popover .non-global-comment-input-wrapper .form-control:focus {
|
|
374
|
+
box-shadow: none;
|
|
375
|
+
border-color: #e1e2e5;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
.sdoc-comment-list-container-popover .non-global-comment-input-wrapper .form-control::placeholder {
|
|
379
|
+
color: rgb(191, 191, 191);
|
|
398
380
|
}
|
|
399
381
|
|
|
400
382
|
/* Override seafile ui */
|
|
@@ -8,26 +8,32 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _dayjs = _interopRequireDefault(require("dayjs"));
|
|
11
|
+
var _reactstrap = require("reactstrap");
|
|
12
|
+
var _reactI18next = require("react-i18next");
|
|
11
13
|
var _context = _interopRequireDefault(require("../../../context"));
|
|
12
14
|
var _useSelectionPosition = require("../../hooks/use-selection-position");
|
|
13
15
|
var _useCommentContext = require("../hooks/comment-hooks/use-comment-context");
|
|
14
16
|
var _commentItemWrapper = _interopRequireDefault(require("./comment-item-wrapper"));
|
|
15
|
-
var
|
|
17
|
+
var _commentEditor = _interopRequireDefault(require("./comment-editor"));
|
|
16
18
|
require("./comment-list.css");
|
|
17
19
|
const CommentList = _ref => {
|
|
18
20
|
let {
|
|
19
|
-
editor,
|
|
20
|
-
comments = [],
|
|
21
|
-
commentDetail = {},
|
|
22
21
|
activeElement,
|
|
23
|
-
|
|
22
|
+
commentDetail = {},
|
|
24
23
|
onSetCommentDetail,
|
|
25
|
-
|
|
24
|
+
t
|
|
26
25
|
} = _ref;
|
|
26
|
+
const commentPopover = (0, _react.useRef)(null);
|
|
27
|
+
const commentDetailRef = (0, _react.useRef)(null);
|
|
27
28
|
const position = (0, _useSelectionPosition.useCommentListPosition)(activeElement);
|
|
28
29
|
const {
|
|
29
30
|
dispatch
|
|
30
31
|
} = (0, _useCommentContext.useCommentContext)();
|
|
32
|
+
const [showEditor, setShowEditor] = (0, _react.useState)(false);
|
|
33
|
+
const [inputContent, setInputContent] = (0, _react.useState)(null);
|
|
34
|
+
const [translateY, setTranslateY] = (0, _react.useState)(0);
|
|
35
|
+
const isEmptyComment = Object.keys(commentDetail).length ? false : true;
|
|
36
|
+
const isCollapseCommentEditor = !isEmptyComment && !showEditor;
|
|
31
37
|
const insertComment = (0, _react.useCallback)(async (elementId, comment) => {
|
|
32
38
|
const res = await _context.default.insertComment(comment);
|
|
33
39
|
const {
|
|
@@ -48,8 +54,9 @@ const CommentList = _ref => {
|
|
|
48
54
|
}
|
|
49
55
|
});
|
|
50
56
|
onSetCommentDetail(newComment);
|
|
57
|
+
setShowEditor(true);
|
|
51
58
|
}, [dispatch, onSetCommentDetail]);
|
|
52
|
-
const
|
|
59
|
+
const addNewComment = (0, _react.useCallback)(content => {
|
|
53
60
|
const user = _context.default.getUserInfo();
|
|
54
61
|
const elementId = activeElement === null || activeElement === void 0 ? void 0 : activeElement.id;
|
|
55
62
|
const time = (0, _dayjs.default)().format('YYYY-MM-DD HH:mm:ss');
|
|
@@ -64,36 +71,70 @@ const CommentList = _ref => {
|
|
|
64
71
|
};
|
|
65
72
|
insertComment(elementId, comment);
|
|
66
73
|
}, [insertComment, activeElement === null || activeElement === void 0 ? void 0 : activeElement.id]);
|
|
74
|
+
const replyComment = (0, _react.useCallback)(content => {
|
|
75
|
+
if (commentDetailRef !== null && commentDetailRef !== void 0 && commentDetailRef.current) {
|
|
76
|
+
commentDetailRef.current.insertContent(content);
|
|
77
|
+
}
|
|
78
|
+
}, []);
|
|
79
|
+
const hiddenComment = (0, _react.useCallback)(() => {
|
|
80
|
+
setShowEditor(false);
|
|
81
|
+
}, []);
|
|
82
|
+
(0, _react.useEffect)(() => {
|
|
83
|
+
queueMicrotask(() => {
|
|
84
|
+
if (commentPopover !== null && commentPopover !== void 0 && commentPopover.current) {
|
|
85
|
+
const {
|
|
86
|
+
bottom
|
|
87
|
+
} = commentPopover.current.getBoundingClientRect();
|
|
88
|
+
const viewportHeight = window.innerHeight;
|
|
89
|
+
if (bottom > viewportHeight) {
|
|
90
|
+
const overflowY = bottom - viewportHeight;
|
|
91
|
+
setTranslateY(-(overflowY + 16));
|
|
92
|
+
} else {
|
|
93
|
+
setTranslateY(0);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
}, [activeElement]);
|
|
67
98
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
99
|
+
ref: commentPopover,
|
|
68
100
|
id: "sdoc-comment-list-container",
|
|
69
101
|
className: "sdoc-comment-list-container sdoc-comment-list-container-popover",
|
|
70
102
|
style: {
|
|
71
103
|
top: position.y,
|
|
72
|
-
width: '300px'
|
|
104
|
+
width: '300px',
|
|
105
|
+
transform: `translateY(${translateY}px)`
|
|
73
106
|
}
|
|
74
|
-
}, !isShowCommentDetail && comments.map(comment => {
|
|
75
|
-
var _topLevelComment$repl, _topLevelComment$repl2;
|
|
76
|
-
const topLevelComment = comment || {};
|
|
77
|
-
const replyCount = topLevelComment === null || topLevelComment === void 0 ? void 0 : (_topLevelComment$repl = topLevelComment.replies) === null || _topLevelComment$repl === void 0 ? void 0 : _topLevelComment$repl.length;
|
|
78
|
-
const latestReply = ((_topLevelComment$repl2 = topLevelComment.replies) === null || _topLevelComment$repl2 === void 0 ? void 0 : _topLevelComment$repl2.length) > 0 ? topLevelComment.replies[topLevelComment.replies.length - 1] : null;
|
|
79
|
-
return /*#__PURE__*/_react.default.createElement(_commentItemCollapseWrapper.default, {
|
|
80
|
-
key: topLevelComment.id,
|
|
81
|
-
editor: editor,
|
|
82
|
-
topLevelComment: topLevelComment,
|
|
83
|
-
replyCount: replyCount,
|
|
84
|
-
latestReply: latestReply,
|
|
85
|
-
setCurrentCommentGroup: () => {
|
|
86
|
-
deleteUnseenNotifications && deleteUnseenNotifications(topLevelComment);
|
|
87
|
-
onSetCommentDetail(topLevelComment);
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
}), isShowCommentDetail && /*#__PURE__*/_react.default.createElement("div", {
|
|
91
|
-
className: "comment-list"
|
|
92
107
|
}, /*#__PURE__*/_react.default.createElement(_commentItemWrapper.default, {
|
|
108
|
+
commentDetailRef: commentDetailRef,
|
|
93
109
|
comment: commentDetail,
|
|
94
110
|
isActive: true,
|
|
95
|
-
isEmptyComment:
|
|
96
|
-
|
|
97
|
-
})
|
|
111
|
+
isEmptyComment: isEmptyComment,
|
|
112
|
+
isCollapseCommentEditor: isCollapseCommentEditor
|
|
113
|
+
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
114
|
+
className: "non-global-comment-input-wrapper",
|
|
115
|
+
style: {
|
|
116
|
+
paddingTop: isEmptyComment ? '16px' : ''
|
|
117
|
+
}
|
|
118
|
+
}, isEmptyComment && /*#__PURE__*/_react.default.createElement(_commentEditor.default, {
|
|
119
|
+
type: "comment",
|
|
120
|
+
insertContent: addNewComment,
|
|
121
|
+
hiddenComment: hiddenComment
|
|
122
|
+
}), !isEmptyComment && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, !showEditor && /*#__PURE__*/_react.default.createElement(_reactstrap.Input, {
|
|
123
|
+
value: inputContent !== null && inputContent !== void 0 && inputContent.trim() ? '.....' : '',
|
|
124
|
+
readOnly: true,
|
|
125
|
+
placeholder: t('Enter_reply'),
|
|
126
|
+
onFocus: () => {
|
|
127
|
+
setShowEditor(true);
|
|
128
|
+
}
|
|
129
|
+
}), showEditor && /*#__PURE__*/_react.default.createElement(_commentEditor.default, {
|
|
130
|
+
type: "reply",
|
|
131
|
+
placeholder: 'Enter_reply_shift_Enter_for_new_line_Enter_to_send',
|
|
132
|
+
commentContent: inputContent,
|
|
133
|
+
insertContent: replyComment,
|
|
134
|
+
onContentChange: content => {
|
|
135
|
+
setInputContent(content);
|
|
136
|
+
},
|
|
137
|
+
hiddenComment: hiddenComment
|
|
138
|
+
}))));
|
|
98
139
|
};
|
|
99
|
-
var _default = exports.default = CommentList;
|
|
140
|
+
var _default = exports.default = (0, _reactI18next.withTranslation)('sdoc-editor')(CommentList);
|
|
@@ -30,9 +30,7 @@ const EditorComment = _ref => {
|
|
|
30
30
|
editor
|
|
31
31
|
}); // The slate node of the current cursor line
|
|
32
32
|
const [activeElement, setActiveElement] = (0, _react.useState)(null); // The slate node currently activated by clicking
|
|
33
|
-
const [comments, setComments] = (0, _react.useState)([]);
|
|
34
33
|
const [isShowComments, setIsShowComments] = (0, _react.useState)(false);
|
|
35
|
-
const [isShowCommentDetail, setIsShowCommentDetail] = (0, _react.useState)(true);
|
|
36
34
|
const [commentDetail, setCommentDetail] = (0, _react.useState)({});
|
|
37
35
|
const onAddCommentToggle = (0, _react.useCallback)(event => {
|
|
38
36
|
event.stopPropagation();
|
|
@@ -43,23 +41,19 @@ const EditorComment = _ref => {
|
|
|
43
41
|
}
|
|
44
42
|
setActiveElement(activeElement);
|
|
45
43
|
setIsShowComments(true);
|
|
46
|
-
setIsShowCommentDetail(true);
|
|
47
44
|
setCommentDetail({});
|
|
48
45
|
}, [currentSelectionElement]);
|
|
49
46
|
const onSelectElement = (0, _react.useCallback)(elementId => {
|
|
50
47
|
const activeElement = (0, _index.getCommentElementById)(elementId, editor);
|
|
51
48
|
setActiveElement(activeElement);
|
|
52
49
|
const unresolvedComments = element_comments_map[elementId].filter(item => !item.resolved);
|
|
53
|
-
|
|
50
|
+
setCommentDetail(unresolvedComments[0]);
|
|
54
51
|
setIsShowComments(true);
|
|
55
|
-
setIsShowCommentDetail(false);
|
|
56
52
|
}, [editor, element_comments_map]);
|
|
57
53
|
const onSetCommentDetail = (0, _react.useCallback)(comment => {
|
|
58
54
|
setCommentDetail(comment);
|
|
59
|
-
setIsShowCommentDetail(true);
|
|
60
55
|
}, []);
|
|
61
56
|
const hiddenComment = (0, _react.useCallback)(() => {
|
|
62
|
-
setComments([]);
|
|
63
57
|
setCommentDetail({});
|
|
64
58
|
setIsShowComments(false);
|
|
65
59
|
}, []);
|
|
@@ -68,7 +62,6 @@ const EditorComment = _ref => {
|
|
|
68
62
|
(0, _react.useEffect)(() => {
|
|
69
63
|
if (activeElement) {
|
|
70
64
|
const unresolvedComments = element_comments_map[activeElement.id].filter(item => !item.resolved);
|
|
71
|
-
setComments(unresolvedComments);
|
|
72
65
|
if (unresolvedComments.length === 0) {
|
|
73
66
|
setIsShowComments(false);
|
|
74
67
|
}
|
|
@@ -124,13 +117,9 @@ const EditorComment = _ref => {
|
|
|
124
117
|
editor: editor,
|
|
125
118
|
onSelectElement: onSelectElement
|
|
126
119
|
}), isShowComments && /*#__PURE__*/_react.default.createElement(_commentList.default, {
|
|
127
|
-
editor: editor,
|
|
128
|
-
comments: comments,
|
|
129
120
|
activeElement: activeElement,
|
|
130
|
-
isShowCommentDetail: isShowCommentDetail,
|
|
131
121
|
commentDetail: commentDetail,
|
|
132
|
-
onSetCommentDetail: onSetCommentDetail
|
|
133
|
-
deleteUnseenNotifications: deleteUnseenNotifications
|
|
122
|
+
onSetCommentDetail: onSetCommentDetail
|
|
134
123
|
})));
|
|
135
124
|
};
|
|
136
125
|
var _default = exports.default = EditorComment;
|
|
@@ -15,22 +15,22 @@ const GlobalCommentEditor = _ref => {
|
|
|
15
15
|
type,
|
|
16
16
|
insertDocComment,
|
|
17
17
|
hiddenCommentEditor,
|
|
18
|
-
|
|
18
|
+
onContentChange
|
|
19
19
|
} = _ref;
|
|
20
20
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
21
21
|
className: (0, _classnames.default)('sdoc-doc-comment-editor-container', 'sdoc-comment-list-container', {
|
|
22
22
|
'scrolled': isScrollDisplayed
|
|
23
23
|
})
|
|
24
24
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
25
|
-
className: "comment-
|
|
25
|
+
className: "sdoc-doc-comment-editor-content"
|
|
26
26
|
}, /*#__PURE__*/_react.default.createElement(_commentEditor.default, {
|
|
27
27
|
type: type,
|
|
28
28
|
className: "sdoc-doc-comment-editor",
|
|
29
|
-
|
|
29
|
+
commentContent: globalCommentContent,
|
|
30
30
|
hiddenUserInfo: true,
|
|
31
31
|
insertContent: insertDocComment,
|
|
32
32
|
hiddenComment: hiddenCommentEditor,
|
|
33
|
-
|
|
33
|
+
onContentChange: onContentChange
|
|
34
34
|
})));
|
|
35
35
|
};
|
|
36
36
|
var _default = exports.default = GlobalCommentEditor;
|
|
@@ -178,16 +178,15 @@
|
|
|
178
178
|
width: 100%;
|
|
179
179
|
}
|
|
180
180
|
|
|
181
|
-
.sdoc-comment-drawer .sdoc-doc-comment-editor-container .comment-
|
|
181
|
+
.sdoc-comment-drawer .sdoc-doc-comment-editor-container .sdoc-doc-comment-editor-content {
|
|
182
|
+
position: relative;
|
|
182
183
|
margin-bottom: 0;
|
|
183
184
|
padding: 0px;
|
|
184
185
|
left: 0;
|
|
185
186
|
border: 0px;
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
.sdoc-comment-drawer .sdoc-doc-comment-editor-container .comment-ui-container:hover {
|
|
189
|
-
background-color: #FFF !important;
|
|
187
|
+
background-color: #FFF;
|
|
190
188
|
box-shadow: none;
|
|
189
|
+
border-radius: 0px;
|
|
191
190
|
}
|
|
192
191
|
|
|
193
192
|
/* custom */
|
|
@@ -196,23 +195,22 @@
|
|
|
196
195
|
left: 0;
|
|
197
196
|
}
|
|
198
197
|
|
|
198
|
+
.sdoc-comment-drawer .sdoc-comment-list-container .comment-collapse-wrapper {
|
|
199
|
+
cursor: pointer;
|
|
200
|
+
}
|
|
201
|
+
|
|
199
202
|
.sdoc-comment-drawer .sdoc-comment-list-container .comment-ui-container {
|
|
200
203
|
background-color: #FFF;
|
|
201
204
|
margin-bottom: 0px;
|
|
202
205
|
box-shadow: none;
|
|
203
206
|
padding: 16px;
|
|
204
207
|
border-radius: 0px;
|
|
205
|
-
cursor: pointer;
|
|
206
208
|
}
|
|
207
209
|
|
|
208
210
|
.sdoc-comment-drawer .sdoc-comment-list-container .comment-ui-container:hover {
|
|
209
211
|
background-color: #f5f5f5;
|
|
210
212
|
}
|
|
211
213
|
|
|
212
|
-
.sdoc-comment-drawer .sdoc-comment-list-container .comment-ui-container .comment-item-list {
|
|
213
|
-
padding-bottom: 0px;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
214
|
.sdoc-comment-drawer .sdoc-comment-list-container .comment-ui-container.active .comment-item:hover {
|
|
217
215
|
background-color: unset;
|
|
218
216
|
}
|
|
@@ -277,9 +275,15 @@
|
|
|
277
275
|
}
|
|
278
276
|
|
|
279
277
|
.sdoc-comment-drawer .sdoc-comment-list-container .comment-item-selected-text-container {
|
|
278
|
+
width: 100%;
|
|
279
|
+
height: auto;
|
|
280
280
|
color: #666666;
|
|
281
|
+
display: flex;
|
|
282
|
+
align-items: center;
|
|
281
283
|
padding: 0px 0px 16px 0px;
|
|
282
|
-
|
|
284
|
+
border-radius: 3px 3px 0 0;
|
|
285
|
+
cursor: pointer;
|
|
286
|
+
overflow: hidden;
|
|
283
287
|
}
|
|
284
288
|
|
|
285
289
|
.comments-panel-body__header .sdoc-comment-filter-dropdown.sdoc-dropdown-menu {
|
|
@@ -208,7 +208,7 @@ const GlobalComment = _ref => {
|
|
|
208
208
|
type: activeCommentGroup ? 'replay' : 'comment',
|
|
209
209
|
hiddenCommentEditor: hiddenCommentEditor,
|
|
210
210
|
insertDocComment: insertDocComment,
|
|
211
|
-
|
|
211
|
+
onContentChange: content => {
|
|
212
212
|
setGlobalCommentContent(content);
|
|
213
213
|
}
|
|
214
214
|
})))));
|
|
@@ -25,14 +25,16 @@
|
|
|
25
25
|
|
|
26
26
|
.sdoc-file-card-link .sdoc-file-link-icon {
|
|
27
27
|
position: absolute;
|
|
28
|
-
top: 6px;
|
|
29
28
|
left: 12px;
|
|
29
|
+
top: 50%;
|
|
30
|
+
transform: translateY(-50%);
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
.sdoc-file-card-link .sdoc-file-text-link {
|
|
33
34
|
position: absolute;
|
|
34
|
-
top: 16px;
|
|
35
35
|
left: 42px;
|
|
36
|
+
top: 50%;
|
|
37
|
+
transform: translateY(-50%);
|
|
36
38
|
width: 330px;
|
|
37
39
|
overflow: hidden;
|
|
38
40
|
text-overflow: ellipsis;
|
|
@@ -26,16 +26,17 @@
|
|
|
26
26
|
|
|
27
27
|
.sdoc-file-card-link .sdoc-file-link-icon {
|
|
28
28
|
position: absolute;
|
|
29
|
-
top: 12px;
|
|
30
29
|
left: 12px;
|
|
30
|
+
top: 50%;
|
|
31
|
+
transform: translateY(-50%);
|
|
31
32
|
}
|
|
32
33
|
|
|
33
|
-
.sdoc-file-render
|
|
34
|
-
width:
|
|
34
|
+
.sdoc-file-render .sdoc-file-link-icon .file-link-img {
|
|
35
|
+
width: 20px;
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
.sdoc-file-card-link .sdoc-file-link-icon .file-link-img {
|
|
38
|
-
width:
|
|
39
|
+
width: 28px;
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
.sdoc-file-render .sdoc-file-text-link.sdoc-no-file-link-icon a {
|
|
@@ -47,8 +48,13 @@
|
|
|
47
48
|
|
|
48
49
|
.sdoc-file-card-link .sdoc-file-text-link {
|
|
49
50
|
position: absolute;
|
|
50
|
-
top: 14px;
|
|
51
51
|
left: 42px;
|
|
52
|
+
top: 50%;
|
|
53
|
+
transform: translateY(-50%);
|
|
54
|
+
width: 330px;
|
|
55
|
+
overflow: hidden;
|
|
56
|
+
text-overflow: ellipsis;
|
|
57
|
+
white-space: nowrap;
|
|
52
58
|
}
|
|
53
59
|
|
|
54
60
|
.sdoc-file-card-link .sdoc-file-text-link a {
|
|
@@ -123,11 +123,6 @@ const TextStyleMenuList = _ref => {
|
|
|
123
123
|
let list = getTextStyleList(_constants.TEXT_STYLE);
|
|
124
124
|
const dropdownList = getTextStyleList(_constants.TEXT_STYLE_MORE);
|
|
125
125
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, list.map((itemProps, index) => {
|
|
126
|
-
if (itemProps.type === _constants.LINK && editor.editorType !== _constants2.WIKI_EDITOR) {
|
|
127
|
-
return /*#__PURE__*/_react.default.createElement(_react.Fragment, {
|
|
128
|
-
key: index
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
126
|
const Component = itemProps.isColor ? _commons.ColorMenu : _commons.MenuItem;
|
|
132
127
|
return /*#__PURE__*/_react.default.createElement(Component, Object.assign({
|
|
133
128
|
key: index
|
package/package.json
CHANGED
|
@@ -585,23 +585,24 @@
|
|
|
585
585
|
"Link_to_file": "Ссылка на файл",
|
|
586
586
|
"Create_a_new_file": "Создать новый файл",
|
|
587
587
|
"Suggestion": "Предложение",
|
|
588
|
-
"Continuation": "
|
|
589
|
-
"More_details": "
|
|
590
|
-
"More_concise": "
|
|
591
|
-
"More_vivid": "
|
|
592
|
-
"Translate": "
|
|
593
|
-
"Adjustment": "
|
|
594
|
-
"Try_again": "
|
|
595
|
-
"Deprecation": "
|
|
596
|
-
"Generated_content_x_words": "
|
|
597
|
-
"Ask_AI_anything": "
|
|
598
|
-
"Thinking": "
|
|
599
|
-
"Translation_error_message": "
|
|
600
|
-
"The_translation_content_cannot_be_empty": "
|
|
601
|
-
"Processing_message": "
|
|
602
|
-
"AI_tip_content": "
|
|
588
|
+
"Continuation": "Продолжение",
|
|
589
|
+
"More_details": "Более подробный",
|
|
590
|
+
"More_concise": "Более краткий",
|
|
591
|
+
"More_vivid": "Более яркий",
|
|
592
|
+
"Translate": "Перевести",
|
|
593
|
+
"Adjustment": "Регулировка",
|
|
594
|
+
"Try_again": "Попробовать еще раз",
|
|
595
|
+
"Deprecation": "Устаревание",
|
|
596
|
+
"Generated_content_x_words": "Сгенерированный контент {{count}} слов",
|
|
597
|
+
"Ask_AI_anything": "Спросите ИИ о чем угодно...",
|
|
598
|
+
"Thinking": "Думаю...",
|
|
599
|
+
"Translation_error_message": "Ошибка перевода, попробуйте еще раз.",
|
|
600
|
+
"The_translation_content_cannot_be_empty": "Содержание перевода не может быть пустым",
|
|
601
|
+
"Processing_message": "Обработка, подождите...",
|
|
602
|
+
"AI_tip_content": "Удалить текущий контент?",
|
|
603
603
|
"Discard": "Отменить",
|
|
604
604
|
"English": "English",
|
|
605
|
-
"Chinese": "
|
|
606
|
-
"Ask_AI": "Спросить ИИ"
|
|
605
|
+
"Chinese": "Китайский",
|
|
606
|
+
"Ask_AI": "Спросить ИИ",
|
|
607
|
+
"Enter_reply": "Enter reply"
|
|
607
608
|
}
|
|
@@ -594,7 +594,7 @@
|
|
|
594
594
|
"Try_again": "再试一次",
|
|
595
595
|
"Deprecation": "弃用",
|
|
596
596
|
"Generated_content_x_words": "已生成内容 {{count}} 字",
|
|
597
|
-
"Ask_AI_anything": "
|
|
597
|
+
"Ask_AI_anything": "询问 AI 任何事情...",
|
|
598
598
|
"Thinking": "思考...",
|
|
599
599
|
"Translation_error_message": "翻译出错,请重试",
|
|
600
600
|
"The_translation_content_cannot_be_empty": "翻译内容不能为空",
|
|
@@ -603,5 +603,6 @@
|
|
|
603
603
|
"Discard": "丢弃",
|
|
604
604
|
"English": "英语",
|
|
605
605
|
"Chinese": "中文",
|
|
606
|
-
"Ask_AI": "询问 AI"
|
|
606
|
+
"Ask_AI": "询问 AI",
|
|
607
|
+
"Enter_reply": "输入回复"
|
|
607
608
|
}
|