@seafile/sdoc-editor 1.0.112 → 1.0.113
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 +21 -8
- package/dist/basic-sdk/comment/components/comment-item-collapse-wrapper.js +130 -0
- package/dist/basic-sdk/comment/components/comment-item-content.js +2 -2
- package/dist/basic-sdk/comment/components/comment-item-reply.js +4 -2
- package/dist/basic-sdk/comment/components/comment-item-resolved-reply.js +1 -1
- package/dist/basic-sdk/comment/components/comment-item-wrapper.js +17 -8
- package/dist/basic-sdk/comment/components/comment-list.css +0 -5
- package/dist/basic-sdk/comment/components/global-comment/global-comment-editor.js +7 -2
- package/dist/basic-sdk/comment/components/global-comment/global-comment-header.js +17 -14
- package/dist/basic-sdk/comment/components/global-comment/index.css +150 -16
- package/dist/basic-sdk/comment/components/global-comment/index.js +83 -47
- package/dist/basic-sdk/comment/hooks/comment-hooks/use-comment-list.js +3 -1
- package/dist/basic-sdk/comment/index.js +0 -1
- package/dist/basic-sdk/extension/render/render-comment-editor-element.js +1 -1
- 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 +2 -1
- package/public/locales/zh_CN/sdoc-editor.json +2 -1
|
@@ -31,13 +31,16 @@ const CommentEditor = _ref => {
|
|
|
31
31
|
type,
|
|
32
32
|
className,
|
|
33
33
|
content,
|
|
34
|
+
globalCommentContent,
|
|
34
35
|
placeholder,
|
|
35
36
|
insertContent,
|
|
36
37
|
updateContent,
|
|
37
38
|
setIsEditing,
|
|
38
39
|
hiddenComment,
|
|
39
40
|
commentRef,
|
|
40
|
-
globalComment
|
|
41
|
+
globalComment,
|
|
42
|
+
hiddenUserInfo,
|
|
43
|
+
updateGlobalCommentContent
|
|
41
44
|
} = _ref;
|
|
42
45
|
const commentWrapperRef = (0, _react.useRef)();
|
|
43
46
|
const {
|
|
@@ -84,7 +87,7 @@ const CommentEditor = _ref => {
|
|
|
84
87
|
const updateValue = (0, _react.useCallback)(value => {
|
|
85
88
|
if (!value || value.trim() === '') return;
|
|
86
89
|
if (!content) return insertContent(value);
|
|
87
|
-
updateContent(value);
|
|
90
|
+
updateContent && updateContent(value);
|
|
88
91
|
}, [content, insertContent, updateContent]);
|
|
89
92
|
const onSubmit = (0, _react.useCallback)(event => {
|
|
90
93
|
event && event.stopPropagation();
|
|
@@ -95,7 +98,8 @@ const CommentEditor = _ref => {
|
|
|
95
98
|
placeholder
|
|
96
99
|
})];
|
|
97
100
|
_slate.Transforms.select(editor, _slate.Editor.start(editor, []));
|
|
98
|
-
|
|
101
|
+
updateGlobalCommentContent && updateGlobalCommentContent(null);
|
|
102
|
+
}, [editor, updateValue, addParticipants, userInfo.username, placeholder, updateGlobalCommentContent]);
|
|
99
103
|
(0, _react.useEffect)(() => {
|
|
100
104
|
const eventBus = _eventBus.default.getInstance();
|
|
101
105
|
const unsubscribePostComment = eventBus.subscribe(_constants2.INTERNAL_EVENT.COMMENT_EDITOR_POST_COMMENT, onSubmit);
|
|
@@ -128,18 +132,27 @@ const CommentEditor = _ref => {
|
|
|
128
132
|
}
|
|
129
133
|
setIsEditing && setIsEditing(false);
|
|
130
134
|
hiddenComment && hiddenComment(false);
|
|
131
|
-
|
|
135
|
+
if (updateGlobalCommentContent) {
|
|
136
|
+
if (editor.children.find(n => _slate.Node.string(n).trim())) {
|
|
137
|
+
updateGlobalCommentContent((0, _slateToMd.default)(editor.children));
|
|
138
|
+
} else {
|
|
139
|
+
updateGlobalCommentContent(null);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
132
142
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
133
143
|
}, [setIsEditing]);
|
|
134
144
|
(0, _react.useEffect)(() => {
|
|
135
|
-
|
|
145
|
+
let children = (0, _mdToSlate.default)(content);
|
|
146
|
+
if (globalCommentContent) {
|
|
147
|
+
children = (0, _mdToSlate.default)(globalCommentContent);
|
|
148
|
+
}
|
|
136
149
|
editor.children = children;
|
|
137
150
|
_slate.Transforms.select(editor, _slate.Editor.end(editor, []));
|
|
138
|
-
}, [editor, content]);
|
|
151
|
+
}, [editor, content, globalCommentContent]);
|
|
139
152
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
140
153
|
className: (0, _classnames.default)('comment-editor-wrapper', className),
|
|
141
154
|
ref: commentWrapperRef
|
|
142
|
-
}, type === 'comment' && /*#__PURE__*/_react.default.createElement("div", {
|
|
155
|
+
}, type === 'comment' && !hiddenUserInfo && /*#__PURE__*/_react.default.createElement("div", {
|
|
143
156
|
className: "comment-editor-user-info"
|
|
144
157
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
145
158
|
className: "comment-editor-user-img"
|
|
@@ -160,6 +173,6 @@ const CommentEditor = _ref => {
|
|
|
160
173
|
}));
|
|
161
174
|
};
|
|
162
175
|
CommentEditor.defaultProps = {
|
|
163
|
-
placeholder: '
|
|
176
|
+
placeholder: 'Enter_comment_shift_enter_for_new_line_Enter_to_send'
|
|
164
177
|
};
|
|
165
178
|
var _default = exports.default = CommentEditor;
|
|
@@ -0,0 +1,130 @@
|
|
|
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 _dayjs = _interopRequireDefault(require("dayjs"));
|
|
11
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
12
|
+
var _reactI18next = require("react-i18next");
|
|
13
|
+
var _slate = require("@seafile/slate");
|
|
14
|
+
var _slateReact = require("@seafile/slate-react");
|
|
15
|
+
var _mdToHtml = _interopRequireDefault(require("../../../slate-convert/md-to-html"));
|
|
16
|
+
var _notificationHooks = require("../hooks/notification-hooks");
|
|
17
|
+
var _constants = require("../constants");
|
|
18
|
+
const CommentItemCollapseWrapper = _ref => {
|
|
19
|
+
let {
|
|
20
|
+
element,
|
|
21
|
+
latestComment,
|
|
22
|
+
topLevelComment,
|
|
23
|
+
editor,
|
|
24
|
+
commentCount,
|
|
25
|
+
setCurrentCommentGroup,
|
|
26
|
+
t
|
|
27
|
+
} = _ref;
|
|
28
|
+
const [editorContent, setEditorContent] = (0, _react.useState)('');
|
|
29
|
+
const {
|
|
30
|
+
notificationsInfo
|
|
31
|
+
} = (0, _notificationHooks.useNotificationContext)();
|
|
32
|
+
const scrollRef = (0, _react.useRef)(document.querySelector('.sdoc-scroll-container'));
|
|
33
|
+
const isUnseen = notificationsInfo.notifications_map[`sdoc_notification_${latestComment.id}`] ? true : false;
|
|
34
|
+
(0, _react.useEffect)(() => {
|
|
35
|
+
let mdString = '';
|
|
36
|
+
if (latestComment.reply === 'True') {
|
|
37
|
+
mdString = t('Mark_as_Resolved');
|
|
38
|
+
} else if (latestComment.reply === 'False') {
|
|
39
|
+
mdString = t('Resubmitted');
|
|
40
|
+
} else if (latestComment.reply) {
|
|
41
|
+
mdString = latestComment.reply;
|
|
42
|
+
} else {
|
|
43
|
+
mdString = latestComment.comment;
|
|
44
|
+
}
|
|
45
|
+
transferHtml(mdString);
|
|
46
|
+
}, [latestComment.comment, latestComment.reply, t]);
|
|
47
|
+
const transferHtml = async mdString => {
|
|
48
|
+
const htmlString = await _mdToHtml.default.process(mdString);
|
|
49
|
+
setEditorContent(String(htmlString));
|
|
50
|
+
};
|
|
51
|
+
const handleScrollToArticle = (0, _react.useCallback)(e => {
|
|
52
|
+
e.stopPropagation();
|
|
53
|
+
const dom = _slateReact.ReactEditor.toDOMNode(editor, element);
|
|
54
|
+
const headerHeight = 56 + 37;
|
|
55
|
+
scrollRef.current.scrollTo({
|
|
56
|
+
top: dom.offsetTop - headerHeight,
|
|
57
|
+
behavior: 'smooth'
|
|
58
|
+
});
|
|
59
|
+
}, [editor, element, scrollRef]);
|
|
60
|
+
const onItemClick = (0, _react.useCallback)(event => {
|
|
61
|
+
if (event.target.className === _constants.COMMENT_URL_CLASSNAME) return;
|
|
62
|
+
setCurrentCommentGroup(topLevelComment.id);
|
|
63
|
+
}, [setCurrentCommentGroup, topLevelComment.id]);
|
|
64
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
65
|
+
id: `comment-item-wrapper_${topLevelComment.id}`,
|
|
66
|
+
className: (0, _classnames.default)('comment-ui-container', {
|
|
67
|
+
'sdoc-resolved': topLevelComment.resolved,
|
|
68
|
+
'd-flex flex-column': element
|
|
69
|
+
}),
|
|
70
|
+
onClick: onItemClick
|
|
71
|
+
}, element && /*#__PURE__*/_react.default.createElement("div", {
|
|
72
|
+
className: "comment-item-selected-text-container",
|
|
73
|
+
onClick: handleScrollToArticle
|
|
74
|
+
}, /*#__PURE__*/_react.default.createElement("i", {
|
|
75
|
+
className: "sdocfont sdoc-comment-quote mr-2"
|
|
76
|
+
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
77
|
+
className: "comment-item-selected-text"
|
|
78
|
+
}, _slate.Node.string(element))), /*#__PURE__*/_react.default.createElement("div", {
|
|
79
|
+
className: "comment-item-list"
|
|
80
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
81
|
+
className: "comment-item"
|
|
82
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
83
|
+
className: "comment-header"
|
|
84
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
85
|
+
className: "comment-author"
|
|
86
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
87
|
+
className: "comment-author__avatar"
|
|
88
|
+
}, /*#__PURE__*/_react.default.createElement("img", {
|
|
89
|
+
alt: "",
|
|
90
|
+
src: latestComment.avatar_url
|
|
91
|
+
})), /*#__PURE__*/_react.default.createElement("span", {
|
|
92
|
+
className: "comment-author__info"
|
|
93
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
94
|
+
className: "name"
|
|
95
|
+
}, latestComment.user_name), /*#__PURE__*/_react.default.createElement("span", {
|
|
96
|
+
className: "time"
|
|
97
|
+
}, (0, _dayjs.default)(latestComment.updated_at).format('MM-DD HH:mm'), isUnseen && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("span", {
|
|
98
|
+
className: "sdoc-unread-message-tip"
|
|
99
|
+
}), /*#__PURE__*/_react.default.createElement("span", {
|
|
100
|
+
className: "sdoc-unread-message-text-tip"
|
|
101
|
+
}, t('New'))))))), /*#__PURE__*/_react.default.createElement("div", {
|
|
102
|
+
className: "comment-content"
|
|
103
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
104
|
+
dangerouslySetInnerHTML: {
|
|
105
|
+
__html: editorContent
|
|
106
|
+
}
|
|
107
|
+
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
108
|
+
className: "comment-footer"
|
|
109
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
110
|
+
className: "comments-count"
|
|
111
|
+
}, /*#__PURE__*/_react.default.createElement("i", {
|
|
112
|
+
className: "sdocfont sdoc-comments"
|
|
113
|
+
}), /*#__PURE__*/_react.default.createElement("span", {
|
|
114
|
+
className: "comments-count-number"
|
|
115
|
+
}, commentCount)), /*#__PURE__*/_react.default.createElement("div", {
|
|
116
|
+
className: "comment-author"
|
|
117
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
118
|
+
className: "comment-author__avatar"
|
|
119
|
+
}, /*#__PURE__*/_react.default.createElement("img", {
|
|
120
|
+
alt: "",
|
|
121
|
+
src: latestComment.avatar_url
|
|
122
|
+
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
123
|
+
className: "comment-author__latest-reply"
|
|
124
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
125
|
+
dangerouslySetInnerHTML: {
|
|
126
|
+
__html: editorContent
|
|
127
|
+
}
|
|
128
|
+
})))))));
|
|
129
|
+
};
|
|
130
|
+
var _default = exports.default = (0, _reactI18next.withTranslation)('sdoc-editor')(CommentItemCollapseWrapper);
|
|
@@ -101,7 +101,7 @@ const CommentItem = _ref => {
|
|
|
101
101
|
}), /*#__PURE__*/_react.default.createElement("span", {
|
|
102
102
|
className: "sdoc-unread-message-text-tip"
|
|
103
103
|
}, t('New')))))), isActive && /*#__PURE__*/_react.default.createElement("div", {
|
|
104
|
-
className: "d-flex"
|
|
104
|
+
className: "d-flex comment-item-operation-wrapper"
|
|
105
105
|
}, !comment.resolved && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
106
106
|
id: `tooltip_${menuId}`,
|
|
107
107
|
className: "comment-operation mr-2",
|
|
@@ -118,7 +118,7 @@ const CommentItem = _ref => {
|
|
|
118
118
|
tag: "div",
|
|
119
119
|
className: "comment-operation"
|
|
120
120
|
}, /*#__PURE__*/_react.default.createElement("i", {
|
|
121
|
-
className: "sdocfont sdoc-more
|
|
121
|
+
className: "sdocfont sdoc-more"
|
|
122
122
|
})), /*#__PURE__*/_react.default.createElement(_reactstrap.DropdownMenu, {
|
|
123
123
|
className: "sdoc-dropdown-menu",
|
|
124
124
|
container: container
|
|
@@ -88,7 +88,9 @@ const CommentItemReply = _ref => {
|
|
|
88
88
|
className: "sdoc-unread-message-tip"
|
|
89
89
|
}), /*#__PURE__*/_react.default.createElement("span", {
|
|
90
90
|
className: "sdoc-unread-message-text-tip"
|
|
91
|
-
}, t('New')))))), isActive && user.username === reply.author && /*#__PURE__*/_react.default.createElement(
|
|
91
|
+
}, t('New')))))), isActive && user.username === reply.author && /*#__PURE__*/_react.default.createElement("div", {
|
|
92
|
+
className: "comment-item-operation-wrapper"
|
|
93
|
+
}, /*#__PURE__*/_react.default.createElement(_reactstrap.Dropdown, {
|
|
92
94
|
id: replyOpToolsId,
|
|
93
95
|
isOpen: isDropdownOpen,
|
|
94
96
|
toggle: () => setDropdownOpen(!isDropdownOpen)
|
|
@@ -96,7 +98,7 @@ const CommentItemReply = _ref => {
|
|
|
96
98
|
tag: "div",
|
|
97
99
|
className: "comment-operation"
|
|
98
100
|
}, /*#__PURE__*/_react.default.createElement("i", {
|
|
99
|
-
className: "sdocfont sdoc-more
|
|
101
|
+
className: "sdocfont sdoc-more"
|
|
100
102
|
})), /*#__PURE__*/_react.default.createElement(_reactstrap.DropdownMenu, {
|
|
101
103
|
className: "sdoc-dropdown-menu",
|
|
102
104
|
container: container
|
|
@@ -33,6 +33,6 @@ const CommentItemResolvedReply = _ref => {
|
|
|
33
33
|
className: "time"
|
|
34
34
|
}, (0, _dayjs.default)(reply.updated_at).format('MM-DD HH:mm'))))), /*#__PURE__*/_react.default.createElement("p", {
|
|
35
35
|
className: "comment-content"
|
|
36
|
-
}, reply.reply === 'True' && /*#__PURE__*/_react.default.createElement("
|
|
36
|
+
}, reply.reply === 'True' && /*#__PURE__*/_react.default.createElement("span", null, t('Mark_as_Resolved')), reply.reply === 'False' && /*#__PURE__*/_react.default.createElement("span", null, t('Resubmitted')))));
|
|
37
37
|
};
|
|
38
38
|
var _default = exports.default = (0, _reactI18next.withTranslation)('sdoc-editor')(CommentItemResolvedReply);
|
|
@@ -22,19 +22,23 @@ var _commentDeletePopover = _interopRequireDefault(require("./comment-delete-pop
|
|
|
22
22
|
const CommentItemWrapper = _ref => {
|
|
23
23
|
let {
|
|
24
24
|
container,
|
|
25
|
+
editor,
|
|
25
26
|
element,
|
|
26
27
|
isActive,
|
|
27
28
|
comment,
|
|
28
|
-
|
|
29
|
+
isGlobalComment,
|
|
30
|
+
contentRef,
|
|
29
31
|
updateScrollPosition,
|
|
30
32
|
hiddenComment,
|
|
31
|
-
|
|
33
|
+
setCurrentCommentGroup,
|
|
34
|
+
onCommentClick
|
|
32
35
|
} = _ref;
|
|
33
36
|
const listRef = (0, _react.useRef)(null);
|
|
34
37
|
const {
|
|
35
38
|
dispatch
|
|
36
39
|
} = (0, _useCommentContext.useCommentContext)();
|
|
37
40
|
const scrollRef = (0, _react.useRef)(document.querySelector('.sdoc-scroll-container'));
|
|
41
|
+
const [isShowDeleteDialog, setIsShowDeleteDialog] = (0, _react.useState)(false);
|
|
38
42
|
const commentOpToolsId = `commentOpTools_${comment.id}`;
|
|
39
43
|
const deleteComment = (0, _react.useCallback)(async commentId => {
|
|
40
44
|
await _context.default.deleteComment(commentId);
|
|
@@ -128,6 +132,7 @@ const CommentItemWrapper = _ref => {
|
|
|
128
132
|
const newReply = {
|
|
129
133
|
...reply,
|
|
130
134
|
id: returnReply.id,
|
|
135
|
+
comment_id: commentId,
|
|
131
136
|
reply: returnReply.reply,
|
|
132
137
|
user_name: returnReply.user_name,
|
|
133
138
|
avatar_url: returnReply.avatar_url
|
|
@@ -192,6 +197,9 @@ const CommentItemWrapper = _ref => {
|
|
|
192
197
|
replies.push(reply);
|
|
193
198
|
insertReply(comment.id, replies);
|
|
194
199
|
}, [comment.id, comment.resolved, insertReply]);
|
|
200
|
+
(0, _react.useImperativeHandle)(contentRef, () => ({
|
|
201
|
+
insertContent
|
|
202
|
+
}));
|
|
195
203
|
const deleteReply = (0, _react.useCallback)(async replyId => {
|
|
196
204
|
const commentId = comment.id;
|
|
197
205
|
const {
|
|
@@ -225,16 +233,16 @@ const CommentItemWrapper = _ref => {
|
|
|
225
233
|
}, [comment.detail, comment.id, dispatch]);
|
|
226
234
|
const onItemClick = (0, _react.useCallback)(event => {
|
|
227
235
|
if (event.target.className === _constants.COMMENT_URL_CLASSNAME) return;
|
|
228
|
-
onCommentClick(comment);
|
|
236
|
+
onCommentClick && onCommentClick(comment);
|
|
229
237
|
}, [comment, onCommentClick]);
|
|
230
|
-
const [isShowDeleteDialog, setIsShowDeleteDialog] = (0, _react.useState)(false);
|
|
231
238
|
const onDeleteComment = (0, _react.useCallback)(() => {
|
|
232
239
|
setIsShowDeleteDialog(true);
|
|
233
240
|
}, []);
|
|
234
241
|
const _deleteComment = (0, _react.useCallback)(() => {
|
|
235
242
|
deleteComment(comment.id);
|
|
236
243
|
setIsShowDeleteDialog(false);
|
|
237
|
-
|
|
244
|
+
setCurrentCommentGroup && setCurrentCommentGroup(null);
|
|
245
|
+
}, [comment.id, deleteComment, setCurrentCommentGroup]);
|
|
238
246
|
(0, _react.useEffect)(() => {
|
|
239
247
|
if (!isActive) {
|
|
240
248
|
setIsShowDeleteDialog(false);
|
|
@@ -243,9 +251,10 @@ const CommentItemWrapper = _ref => {
|
|
|
243
251
|
const className = (0, _classnames.default)('comment-ui-container', {
|
|
244
252
|
'active': isActive,
|
|
245
253
|
'sdoc-resolved': comment.resolved,
|
|
246
|
-
'd-flex flex-column
|
|
254
|
+
'd-flex flex-column': element,
|
|
255
|
+
'comment-item-detail-wrapper': isGlobalComment
|
|
247
256
|
});
|
|
248
|
-
const tip = comment.resolved ? 'Reopen_discussion' : '
|
|
257
|
+
const tip = comment.resolved ? 'Reopen_discussion' : 'Enter_reply_shift_Enter_for_new_line_Enter_to_send';
|
|
249
258
|
const handleScrollToArticle = (0, _react.useCallback)(e => {
|
|
250
259
|
e.stopPropagation();
|
|
251
260
|
const dom = _slateReact.ReactEditor.toDOMNode(editor, element);
|
|
@@ -299,7 +308,7 @@ const CommentItemWrapper = _ref => {
|
|
|
299
308
|
key: reply.id,
|
|
300
309
|
reply: reply
|
|
301
310
|
});
|
|
302
|
-
})), isActive && /*#__PURE__*/_react.default.createElement("div", {
|
|
311
|
+
})), !isGlobalComment && isActive && /*#__PURE__*/_react.default.createElement("div", {
|
|
303
312
|
className: "sdoc-reply-wrapper"
|
|
304
313
|
}, /*#__PURE__*/_react.default.createElement(_commentEditor.default, {
|
|
305
314
|
type: "reply",
|
|
@@ -23,11 +23,6 @@
|
|
|
23
23
|
box-shadow: 0 1px 3px rgba(0, 0, 0, .15), 0 4px 8px 3px rgba(0, 0, 0, .15);
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
.sdoc-comment-drawer .sdoc-comment-list-container .comment-ui-container {
|
|
27
|
-
padding: 0;
|
|
28
|
-
padding-bottom: 16px;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
26
|
.sdoc-comment-list-container .comment-item-selected-text-container {
|
|
32
27
|
width: 100%;
|
|
33
28
|
height: 32px;
|
|
@@ -10,9 +10,11 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
10
10
|
var _commentEditor = _interopRequireDefault(require("../comment-editor"));
|
|
11
11
|
const GlobalCommentEditor = _ref => {
|
|
12
12
|
let {
|
|
13
|
+
isScrollDisplayed,
|
|
14
|
+
globalCommentContent,
|
|
13
15
|
insertDocComment,
|
|
14
16
|
hiddenCommentEditor,
|
|
15
|
-
|
|
17
|
+
updateGlobalCommentContent
|
|
16
18
|
} = _ref;
|
|
17
19
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
18
20
|
className: (0, _classnames.default)('sdoc-doc-comment-editor-container', 'sdoc-comment-list-container', {
|
|
@@ -23,8 +25,11 @@ const GlobalCommentEditor = _ref => {
|
|
|
23
25
|
}, /*#__PURE__*/_react.default.createElement(_commentEditor.default, {
|
|
24
26
|
type: "comment",
|
|
25
27
|
className: "sdoc-doc-comment-editor",
|
|
28
|
+
globalCommentContent: globalCommentContent,
|
|
29
|
+
hiddenUserInfo: true,
|
|
26
30
|
insertContent: insertDocComment,
|
|
27
|
-
hiddenComment: hiddenCommentEditor
|
|
31
|
+
hiddenComment: hiddenCommentEditor,
|
|
32
|
+
updateGlobalCommentContent: updateGlobalCommentContent
|
|
28
33
|
})));
|
|
29
34
|
};
|
|
30
35
|
var _default = exports.default = GlobalCommentEditor;
|
|
@@ -17,7 +17,8 @@ var _tooltip = _interopRequireDefault(require("../../../../components/tooltip"))
|
|
|
17
17
|
const GlobalCommentHeader = _ref => {
|
|
18
18
|
let {
|
|
19
19
|
toggle,
|
|
20
|
-
|
|
20
|
+
activeCommentGroup,
|
|
21
|
+
setCurrentCommentGroup
|
|
21
22
|
} = _ref;
|
|
22
23
|
const {
|
|
23
24
|
t
|
|
@@ -29,10 +30,10 @@ const GlobalCommentHeader = _ref => {
|
|
|
29
30
|
setIsMounted(true);
|
|
30
31
|
}
|
|
31
32
|
}, []);
|
|
32
|
-
const
|
|
33
|
+
const goBack = (0, _react.useCallback)(event => {
|
|
33
34
|
(0, _mouseEvent.eventStopPropagation)(event);
|
|
34
|
-
|
|
35
|
-
}, [
|
|
35
|
+
setCurrentCommentGroup(null);
|
|
36
|
+
}, [setCurrentCommentGroup]);
|
|
36
37
|
const toggleReadAll = (0, _react.useCallback)(async event => {
|
|
37
38
|
(0, _mouseEvent.eventStopPropagation)(event);
|
|
38
39
|
try {
|
|
@@ -49,9 +50,19 @@ const GlobalCommentHeader = _ref => {
|
|
|
49
50
|
}, []);
|
|
50
51
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
51
52
|
className: "comments-panel-header"
|
|
52
|
-
}, /*#__PURE__*/_react.default.createElement("
|
|
53
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
54
|
+
className: "comments-panel-header-left"
|
|
55
|
+
}, activeCommentGroup && /*#__PURE__*/_react.default.createElement("div", {
|
|
56
|
+
className: "goback sdoc-icon-btn",
|
|
57
|
+
onClick: goBack
|
|
58
|
+
}, /*#__PURE__*/_react.default.createElement("i", {
|
|
59
|
+
className: "sdocfont sdoc-previous-page",
|
|
60
|
+
style: {
|
|
61
|
+
transform: 'scale(1.2)'
|
|
62
|
+
}
|
|
63
|
+
})), /*#__PURE__*/_react.default.createElement("span", {
|
|
53
64
|
className: "title"
|
|
54
|
-
}, t('Comments')), /*#__PURE__*/_react.default.createElement("div", {
|
|
65
|
+
}, activeCommentGroup ? t('Comment_details') : t('Comments'))), /*#__PURE__*/_react.default.createElement("div", {
|
|
55
66
|
ref: panelHeaderRef,
|
|
56
67
|
className: "comments-panel-header-right"
|
|
57
68
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -63,14 +74,6 @@ const GlobalCommentHeader = _ref => {
|
|
|
63
74
|
}), isMounted && /*#__PURE__*/_react.default.createElement(_tooltip.default, {
|
|
64
75
|
target: "sdoc-read-all-btn"
|
|
65
76
|
}, t('Mark_all_as_read'))), /*#__PURE__*/_react.default.createElement("div", {
|
|
66
|
-
id: "sdoc-add-comment-btn",
|
|
67
|
-
className: "sdoc-icon-btn",
|
|
68
|
-
onClick: toggleADDComment
|
|
69
|
-
}, /*#__PURE__*/_react.default.createElement("i", {
|
|
70
|
-
className: "sdocfont sdoc-add-comment"
|
|
71
|
-
}), isMounted && /*#__PURE__*/_react.default.createElement(_tooltip.default, {
|
|
72
|
-
target: "sdoc-add-comment-btn"
|
|
73
|
-
}, t('Add_comment'))), /*#__PURE__*/_react.default.createElement("div", {
|
|
74
77
|
className: "sdoc-icon-btn",
|
|
75
78
|
onClick: toggle
|
|
76
79
|
}, /*#__PURE__*/_react.default.createElement("i", {
|
|
@@ -46,12 +46,20 @@
|
|
|
46
46
|
border-bottom: 1px solid #EAECEF;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
.sdoc-comment-drawer .comments-panel-header .
|
|
49
|
+
.sdoc-comment-drawer .comments-panel-header .comments-panel-header-left {
|
|
50
|
+
display: flex;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.sdoc-comment-drawer .comments-panel-header .comments-panel-header-left .title {
|
|
50
54
|
color: #212529;
|
|
51
55
|
font-size: 16px;
|
|
52
56
|
font-weight: 500;
|
|
53
57
|
}
|
|
54
58
|
|
|
59
|
+
.sdoc-comment-drawer .comments-panel-header .comments-panel-header-left .goback {
|
|
60
|
+
margin-right: 4px;
|
|
61
|
+
}
|
|
62
|
+
|
|
55
63
|
.sdoc-comment-drawer .comments-panel-header .comments-panel-header-right {
|
|
56
64
|
display: flex;
|
|
57
65
|
}
|
|
@@ -69,7 +77,7 @@
|
|
|
69
77
|
display: flex;
|
|
70
78
|
flex-direction: column;
|
|
71
79
|
min-height: 0;
|
|
72
|
-
|
|
80
|
+
position: relative;
|
|
73
81
|
}
|
|
74
82
|
|
|
75
83
|
.sdoc-comment-drawer .comments-panel-body__header {
|
|
@@ -108,23 +116,26 @@
|
|
|
108
116
|
flex: 1;
|
|
109
117
|
display: flex;
|
|
110
118
|
flex-direction: column;
|
|
111
|
-
padding: 16px;
|
|
112
119
|
padding-top: 0px;
|
|
120
|
+
margin-bottom: 20px;
|
|
113
121
|
overflow: auto;
|
|
114
122
|
}
|
|
115
123
|
|
|
116
124
|
.sdoc-comment-drawer .comments-panel-body__content .sdoc-comment-list-container {
|
|
117
125
|
position: relative;
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
.sdoc-comment-drawer .comments-panel-body__content .comment-ui-container.active {
|
|
121
|
-
left: 0;
|
|
126
|
+
margin-top: 0px
|
|
122
127
|
}
|
|
123
128
|
|
|
124
129
|
.sdoc-comment-drawer .comments-panel-body__content .comment-ui-container.sdoc-resolved {
|
|
125
130
|
background: #f5f5f5;
|
|
126
131
|
}
|
|
127
132
|
|
|
133
|
+
.sdoc-comment-drawer .comments-panel-body__content .comment-ui-container.active {
|
|
134
|
+
left: 0;
|
|
135
|
+
background: #fff;
|
|
136
|
+
box-shadow: unset;
|
|
137
|
+
}
|
|
138
|
+
|
|
128
139
|
.sdoc-comment-drawer .comments-panel-body__content .comment-ui-container.active.sdoc-resolved {
|
|
129
140
|
background: #f5f5f5;
|
|
130
141
|
}
|
|
@@ -135,35 +146,158 @@
|
|
|
135
146
|
}
|
|
136
147
|
|
|
137
148
|
/* doc comment add editor */
|
|
138
|
-
.sdoc-comment-drawer .comments-panel-body .
|
|
149
|
+
.sdoc-comment-drawer .comments-panel-body .global-comment-input-wrapper {
|
|
139
150
|
padding: 0 16px;
|
|
140
|
-
position: absolute;
|
|
141
|
-
top: 120px;
|
|
142
151
|
width: 100%;
|
|
152
|
+
margin-bottom: 16px;
|
|
143
153
|
}
|
|
144
154
|
|
|
145
|
-
.sdoc-comment-drawer .comments-panel-body .
|
|
146
|
-
|
|
155
|
+
.sdoc-comment-drawer .comments-panel-body .global-comment-input-wrapper .form-control[readonly] {
|
|
156
|
+
background-color: #fff;
|
|
147
157
|
}
|
|
148
158
|
|
|
159
|
+
.sdoc-comment-drawer .comments-panel-body .global-comment-input-wrapper .form-control {
|
|
160
|
+
font-size: 14px;
|
|
161
|
+
font-weight: unset;
|
|
162
|
+
border: 1px solid #ececec;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.sdoc-comment-drawer .comments-panel-body .global-comment-input-wrapper.active .form-control {
|
|
166
|
+
padding-top: 14px;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.sdoc-comment-drawer .comments-panel-body .global-comment-input-wrapper .form-control:focus {
|
|
170
|
+
box-shadow: none;
|
|
171
|
+
border-color: #e1e2e5;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.sdoc-comment-drawer .comments-panel-body .global-comment-input-wrapper .form-control::placeholder {
|
|
175
|
+
color: rgb(191, 191, 191);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.sdoc-comment-drawer .comments-panel-body .sdoc-doc-comment-editor-container {
|
|
179
|
+
padding: 0 16px;
|
|
180
|
+
position: absolute;
|
|
181
|
+
bottom: 16px;
|
|
182
|
+
width: 100%;
|
|
183
|
+
}
|
|
149
184
|
|
|
150
185
|
.sdoc-comment-drawer .sdoc-doc-comment-editor-container .comment-ui-container.active {
|
|
151
186
|
margin-bottom: 0;
|
|
152
|
-
padding:
|
|
187
|
+
padding: 0px;
|
|
153
188
|
left: 0;
|
|
189
|
+
border: 0px;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.sdoc-comment-drawer .sdoc-doc-comment-editor-container .comment-ui-container:hover {
|
|
193
|
+
background-color: #FFF !important;
|
|
194
|
+
box-shadow: none;
|
|
154
195
|
}
|
|
155
196
|
|
|
156
197
|
/* custom */
|
|
157
198
|
.sdoc-comment-drawer .sdoc-comment-list-container .comment-ui-container {
|
|
158
199
|
background-color: #FFF;
|
|
159
|
-
border: 1px solid #
|
|
200
|
+
border-bottom: 1px solid #e1e2e5;
|
|
201
|
+
margin-bottom: 0px;
|
|
202
|
+
box-shadow: none;
|
|
203
|
+
padding: 16px;
|
|
204
|
+
border-radius: 0px;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.sdoc-comment-drawer .sdoc-comment-list-container .comment-ui-container:hover {
|
|
208
|
+
background-color: #f5f5f5;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.sdoc-comment-drawer .sdoc-comment-list-container .comment-ui-container .comment-item {
|
|
212
|
+
padding: 0px
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.sdoc-comment-drawer .sdoc-comment-list-container .comment-ui-container.active .comment-item:hover {
|
|
216
|
+
background-color: unset;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.sdoc-comment-drawer .sdoc-comment-list-container .comment-item .comment-header .comment-author__avatar img {
|
|
220
|
+
width: 24px;
|
|
221
|
+
height: 24px;
|
|
222
|
+
margin-top: -5px;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
.sdoc-comment-drawer .sdoc-comment-list-container .comment-item .comment-content {
|
|
226
|
+
margin-left: 35px;
|
|
227
|
+
margin-bottom: 16px;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
.sdoc-comment-drawer .sdoc-comment-list-container .comment-item .comment-footer {
|
|
231
|
+
display: flex;
|
|
232
|
+
color: #666666;
|
|
233
|
+
font-size: 14px;
|
|
234
|
+
margin-left: 35px;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
.sdoc-comment-drawer .sdoc-comment-list-container .comment-item .comment-footer .comments-count {
|
|
238
|
+
display: flex;
|
|
239
|
+
align-items: center;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
.sdoc-comment-drawer .sdoc-comment-list-container .comment-item .comment-footer .comments-count .comments-count-number {
|
|
243
|
+
margin-left: 8px;
|
|
244
|
+
margin-top: -2px;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
.sdoc-comment-drawer .sdoc-comment-list-container .comment-item .comment-footer .comment-author {
|
|
248
|
+
margin-left: 20px;
|
|
249
|
+
align-items: unset;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
.sdoc-comment-drawer .sdoc-comment-list-container .comment-item .comment-item-operation-wrapper {
|
|
253
|
+
margin-top: -12px;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
.sdoc-comment-drawer .sdoc-comment-list-container .comment-item .comment-item-operation-wrapper .comment-operation {
|
|
257
|
+
width: 24px;
|
|
258
|
+
height: 24px;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
.sdoc-comment-drawer .sdoc-comment-list-container .comment-item .comment-footer .comment-author__avatar {
|
|
262
|
+
width: 16px;
|
|
263
|
+
height: 16px;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
.sdoc-comment-drawer .sdoc-comment-list-container .comment-item .comment-footer .comment-author__avatar img {
|
|
267
|
+
border-radius: 50%;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
.sdoc-comment-drawer .sdoc-comment-list-container .comment-item .comment-footer .comment-author__latest-reply {
|
|
271
|
+
margin-left: 8px;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
.sdoc-comment-drawer .sdoc-comment-list-container .comment-item .comment-footer .comment-author__latest-reply p {
|
|
275
|
+
margin: 0px;
|
|
276
|
+
overflow: hidden;
|
|
277
|
+
text-overflow: ellipsis;
|
|
278
|
+
white-space: nowrap;
|
|
279
|
+
width: 220px;
|
|
160
280
|
}
|
|
161
281
|
|
|
162
282
|
.sdoc-comment-drawer .sdoc-comment-list-container .comment-item-selected-text-container {
|
|
163
|
-
|
|
164
|
-
|
|
283
|
+
color: #666666;
|
|
284
|
+
padding: 0px 0px 16px 0px;
|
|
285
|
+
height: auto;
|
|
165
286
|
}
|
|
166
287
|
|
|
167
288
|
.comments-panel-body__header .sdoc-comment-filter-dropdown.sdoc-dropdown-menu {
|
|
168
289
|
border: 1px solid #dee3eb;
|
|
169
290
|
}
|
|
291
|
+
|
|
292
|
+
.sdoc-comment-drawer .sdoc-comment-list-container .comment-item-detail-wrapper {
|
|
293
|
+
border-bottom: 0px
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
.sdoc-comment-drawer .sdoc-comment-list-container .comment-item-detail-wrapper:hover {
|
|
297
|
+
background-color: #FFF;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
.sdoc-comment-drawer .sdoc-comment-list-container .comment-item-detail-wrapper .comment-operation .sdoc-confirm {
|
|
301
|
+
color: rgb(70, 77, 90);;
|
|
302
|
+
font-weight: unset;
|
|
303
|
+
}
|
|
@@ -8,35 +8,40 @@ 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");
|
|
13
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
14
|
var _useCommentList = _interopRequireDefault(require("../../hooks/comment-hooks/use-comment-list"));
|
|
12
15
|
var _commentItemWrapper = _interopRequireDefault(require("../comment-item-wrapper"));
|
|
16
|
+
var _commentItemCollapseWrapper = _interopRequireDefault(require("../comment-item-collapse-wrapper"));
|
|
13
17
|
var _globalCommentHeader = _interopRequireDefault(require("./global-comment-header"));
|
|
14
18
|
var _globalCommentBodyHeader = _interopRequireDefault(require("./global-comment-body-header"));
|
|
15
19
|
var _constants = require("../../constants");
|
|
16
20
|
var _context = _interopRequireDefault(require("../../../../context"));
|
|
17
|
-
var _useCommentContext = require("../../hooks/comment-hooks/use-comment-context");
|
|
18
21
|
var _globalCommentEditor = _interopRequireDefault(require("./global-comment-editor"));
|
|
19
22
|
var _core = require("../../../extension/core");
|
|
20
23
|
var _hooks = require("../../../../hooks");
|
|
21
24
|
require("./index.css");
|
|
22
25
|
const GlobalComment = _ref => {
|
|
23
26
|
let {
|
|
24
|
-
|
|
25
|
-
|
|
27
|
+
editor,
|
|
28
|
+
t
|
|
26
29
|
} = _ref;
|
|
27
|
-
const [activeComment, setActiveComment] = (0, _react.useState)(null);
|
|
28
|
-
const [showEditor, setShowEditor] = (0, _react.useState)(false);
|
|
29
|
-
const [isScrollDisplayed, setIsScrollDisplayed] = (0, _react.useState)(false);
|
|
30
30
|
const commentRef = (0, _react.useRef)(null);
|
|
31
31
|
const contentRef = (0, _react.useRef)(null);
|
|
32
|
+
const {
|
|
33
|
+
closePlugin
|
|
34
|
+
} = (0, _hooks.usePlugins)();
|
|
35
|
+
const [activeCommentGroup, setActiveCommentGroup] = (0, _react.useState)(null);
|
|
36
|
+
const [showEditor, setShowEditor] = (0, _react.useState)(false);
|
|
37
|
+
const [isScrollDisplayed, setIsScrollDisplayed] = (0, _react.useState)(false);
|
|
38
|
+
const [globalCommentContent, setGlobalCommentContent] = (0, _react.useState)(null);
|
|
32
39
|
const {
|
|
33
40
|
commentList,
|
|
34
41
|
commentType,
|
|
35
|
-
setCommentType
|
|
42
|
+
setCommentType,
|
|
43
|
+
dispatch
|
|
36
44
|
} = (0, _useCommentList.default)();
|
|
37
|
-
const {
|
|
38
|
-
closePlugin
|
|
39
|
-
} = (0, _hooks.usePlugins)();
|
|
40
45
|
const detectScroll = (0, _react.useCallback)(() => {
|
|
41
46
|
if (!contentRef.current) return;
|
|
42
47
|
const contentContainer = contentRef.current;
|
|
@@ -47,25 +52,13 @@ const GlobalComment = _ref => {
|
|
|
47
52
|
detectScroll();
|
|
48
53
|
}, [commentList, detectScroll]);
|
|
49
54
|
const updateScrollPosition = (0, _react.useCallback)(() => {
|
|
55
|
+
var _contentRef$current;
|
|
50
56
|
const resolvedDom = document.querySelector('.sdoc-resolved');
|
|
51
|
-
contentRef.current.scrollTo({
|
|
57
|
+
(_contentRef$current = contentRef.current) === null || _contentRef$current === void 0 ? void 0 : _contentRef$current.scrollTo({
|
|
52
58
|
top: resolvedDom.offsetTop,
|
|
53
59
|
behavior: 'smooth'
|
|
54
60
|
});
|
|
55
61
|
}, []);
|
|
56
|
-
const hiddenComment = (0, _react.useCallback)(() => {
|
|
57
|
-
setActiveComment(null);
|
|
58
|
-
}, []);
|
|
59
|
-
const onCommentClick = (0, _react.useCallback)((comment, element) => {
|
|
60
|
-
if (activeComment && activeComment.id === comment.id) return;
|
|
61
|
-
setActiveComment(comment);
|
|
62
|
-
deleteUnseenNotifications && deleteUnseenNotifications(comment);
|
|
63
|
-
if (comment.detail.element_id === _constants.DOC_COMMENT_ELEMENT_ID) return;
|
|
64
|
-
if (!element) return;
|
|
65
|
-
}, [activeComment, deleteUnseenNotifications]);
|
|
66
|
-
const {
|
|
67
|
-
dispatch
|
|
68
|
-
} = (0, _useCommentContext.useCommentContext)();
|
|
69
62
|
const insertComment = (0, _react.useCallback)(async (elementId, comment) => {
|
|
70
63
|
const res = await _context.default.insertComment(comment);
|
|
71
64
|
const {
|
|
@@ -85,9 +78,16 @@ const GlobalComment = _ref => {
|
|
|
85
78
|
comment: newComment
|
|
86
79
|
}
|
|
87
80
|
});
|
|
88
|
-
setShowEditor(false);
|
|
89
81
|
}, [dispatch]);
|
|
90
82
|
const insertDocComment = (0, _react.useCallback)(commentDetail => {
|
|
83
|
+
var _contentRef$current2;
|
|
84
|
+
// Reply to a comment
|
|
85
|
+
if (activeCommentGroup && (_contentRef$current2 = contentRef.current) !== null && _contentRef$current2 !== void 0 && _contentRef$current2.insertContent) {
|
|
86
|
+
contentRef.current.insertContent(commentDetail);
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// Insert global comment
|
|
91
91
|
const user = _context.default.getUserInfo();
|
|
92
92
|
const elementId = _constants.DOC_COMMENT_ELEMENT_ID;
|
|
93
93
|
const time = (0, _dayjs.default)().format('YYYY-MM-DD HH:mm:ss');
|
|
@@ -102,11 +102,7 @@ const GlobalComment = _ref => {
|
|
|
102
102
|
};
|
|
103
103
|
insertComment(elementId, comment);
|
|
104
104
|
detectScroll();
|
|
105
|
-
}, [detectScroll, insertComment]);
|
|
106
|
-
const toggleGlobalCommentEditor = (0, _react.useCallback)(() => {
|
|
107
|
-
setShowEditor(!showEditor);
|
|
108
|
-
setActiveComment(null);
|
|
109
|
-
}, [showEditor]);
|
|
105
|
+
}, [activeCommentGroup, detectScroll, insertComment]);
|
|
110
106
|
const hiddenCommentEditor = (0, _react.useCallback)(() => {
|
|
111
107
|
setShowEditor(false);
|
|
112
108
|
}, []);
|
|
@@ -114,6 +110,20 @@ const GlobalComment = _ref => {
|
|
|
114
110
|
if (contentRef.current && contentRef.current.contains(event.target)) return true;
|
|
115
111
|
return false;
|
|
116
112
|
}, []);
|
|
113
|
+
const getNodeByElementId = (0, _react.useCallback)(elementId => {
|
|
114
|
+
if (elementId !== _constants.DOC_COMMENT_ELEMENT_ID) {
|
|
115
|
+
return (0, _core.getNodeById)(editor.children, elementId);
|
|
116
|
+
}
|
|
117
|
+
return null;
|
|
118
|
+
}, [editor.children]);
|
|
119
|
+
const setCurrentCommentGroup = (0, _react.useCallback)(commentGroupId => {
|
|
120
|
+
const activeCommentGroup = commentList.find(item => item.id === commentGroupId);
|
|
121
|
+
if (activeCommentGroup) {
|
|
122
|
+
setActiveCommentGroup(activeCommentGroup);
|
|
123
|
+
} else {
|
|
124
|
+
setActiveCommentGroup(null);
|
|
125
|
+
}
|
|
126
|
+
}, [commentList]);
|
|
117
127
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
118
128
|
className: "sdoc-comment-drawer"
|
|
119
129
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -121,7 +131,8 @@ const GlobalComment = _ref => {
|
|
|
121
131
|
className: "comments-panel-wrapper"
|
|
122
132
|
}, /*#__PURE__*/_react.default.createElement(_globalCommentHeader.default, {
|
|
123
133
|
toggle: closePlugin,
|
|
124
|
-
|
|
134
|
+
activeCommentGroup: activeCommentGroup,
|
|
135
|
+
setCurrentCommentGroup: setCurrentCommentGroup
|
|
125
136
|
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
126
137
|
className: "comments-panel-body"
|
|
127
138
|
}, /*#__PURE__*/_react.default.createElement(_globalCommentBodyHeader.default, {
|
|
@@ -134,27 +145,52 @@ const GlobalComment = _ref => {
|
|
|
134
145
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
135
146
|
id: "global-comment-list-container",
|
|
136
147
|
className: "sdoc-comment-list-container"
|
|
137
|
-
}, Array.isArray(commentList) && commentList.map(comment => {
|
|
148
|
+
}, !activeCommentGroup && Array.isArray(commentList) && commentList.map(comment => {
|
|
149
|
+
var _comment$replies, _comment$replies2;
|
|
150
|
+
const latestComment = ((_comment$replies = comment.replies) === null || _comment$replies === void 0 ? void 0 : _comment$replies.length) > 0 ? comment.replies[comment.replies.length - 1] : comment;
|
|
151
|
+
const commentCount = ((_comment$replies2 = comment.replies) === null || _comment$replies2 === void 0 ? void 0 : _comment$replies2.length) + 1;
|
|
138
152
|
const elementId = comment.detail.element_id;
|
|
139
|
-
const element =
|
|
140
|
-
|
|
141
|
-
return /*#__PURE__*/_react.default.createElement(_commentItemWrapper.default, {
|
|
153
|
+
const element = getNodeByElementId(elementId);
|
|
154
|
+
return /*#__PURE__*/_react.default.createElement(_commentItemCollapseWrapper.default, {
|
|
142
155
|
key: comment.id,
|
|
156
|
+
editor: editor,
|
|
143
157
|
element: element,
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
hiddenComment: hiddenComment,
|
|
149
|
-
updateScrollPosition: updateScrollPosition,
|
|
150
|
-
isClickCommentPanelBody: isClickCommentPanelBody,
|
|
151
|
-
editor: editor
|
|
158
|
+
topLevelComment: comment,
|
|
159
|
+
latestComment: latestComment,
|
|
160
|
+
commentCount: commentCount,
|
|
161
|
+
setCurrentCommentGroup: setCurrentCommentGroup
|
|
152
162
|
});
|
|
153
|
-
})
|
|
154
|
-
|
|
163
|
+
}), activeCommentGroup && /*#__PURE__*/_react.default.createElement(_commentItemWrapper.default, {
|
|
164
|
+
key: activeCommentGroup.id,
|
|
165
|
+
editor: editor,
|
|
166
|
+
element: getNodeByElementId(activeCommentGroup.detail.element_id),
|
|
167
|
+
container: "global-comment-list-container",
|
|
168
|
+
contentRef: contentRef,
|
|
169
|
+
comment: activeCommentGroup,
|
|
170
|
+
isGlobalComment: true,
|
|
171
|
+
isActive: true,
|
|
172
|
+
updateScrollPosition: updateScrollPosition,
|
|
155
173
|
isClickCommentPanelBody: isClickCommentPanelBody,
|
|
174
|
+
setCurrentCommentGroup: setCurrentCommentGroup
|
|
175
|
+
}))), !showEditor && /*#__PURE__*/_react.default.createElement("div", {
|
|
176
|
+
className: (0, _classnames.default)('global-comment-input-wrapper', {
|
|
177
|
+
'active': globalCommentContent === null || globalCommentContent === void 0 ? void 0 : globalCommentContent.trim()
|
|
178
|
+
})
|
|
179
|
+
}, /*#__PURE__*/_react.default.createElement(_reactstrap.Input, {
|
|
180
|
+
value: globalCommentContent !== null && globalCommentContent !== void 0 && globalCommentContent.trim() ? '.....' : '',
|
|
181
|
+
readOnly: true,
|
|
182
|
+
placeholder: t('Enter_comment_shift_enter_for_new_line_Enter_to_send'),
|
|
183
|
+
onFocus: () => {
|
|
184
|
+
setShowEditor(true);
|
|
185
|
+
}
|
|
186
|
+
})), showEditor && /*#__PURE__*/_react.default.createElement(_globalCommentEditor.default, {
|
|
187
|
+
globalCommentContent: globalCommentContent,
|
|
188
|
+
isScrollDisplayed: isScrollDisplayed,
|
|
156
189
|
hiddenCommentEditor: hiddenCommentEditor,
|
|
157
|
-
insertDocComment: insertDocComment
|
|
190
|
+
insertDocComment: insertDocComment,
|
|
191
|
+
updateGlobalCommentContent: content => {
|
|
192
|
+
setGlobalCommentContent(content);
|
|
193
|
+
}
|
|
158
194
|
}))));
|
|
159
195
|
};
|
|
160
|
-
var _default = exports.default = GlobalComment;
|
|
196
|
+
var _default = exports.default = (0, _reactI18next.withTranslation)('sdoc-editor')(GlobalComment);
|
|
@@ -9,7 +9,8 @@ var _useCommentContext = require("./use-comment-context");
|
|
|
9
9
|
var _constants = require("../../constants");
|
|
10
10
|
const useCommentList = () => {
|
|
11
11
|
const {
|
|
12
|
-
commentsInfo
|
|
12
|
+
commentsInfo,
|
|
13
|
+
dispatch
|
|
13
14
|
} = (0, _useCommentContext.useCommentContext)();
|
|
14
15
|
const {
|
|
15
16
|
comment_list
|
|
@@ -31,6 +32,7 @@ const useCommentList = () => {
|
|
|
31
32
|
}
|
|
32
33
|
}, [commentType, comment_list]);
|
|
33
34
|
return {
|
|
35
|
+
dispatch,
|
|
34
36
|
commentList,
|
|
35
37
|
commentType,
|
|
36
38
|
setCommentType
|
|
@@ -59,7 +59,6 @@ const CommentWrapper = _ref => {
|
|
|
59
59
|
deleteUnseenNotifications: deleteUnseenNotifications,
|
|
60
60
|
editor: editor
|
|
61
61
|
}), type === 'global' && /*#__PURE__*/_react.default.createElement(_components.GlobalComment, {
|
|
62
|
-
deleteUnseenNotifications: deleteUnseenNotifications,
|
|
63
62
|
editor: editor
|
|
64
63
|
}));
|
|
65
64
|
};
|
|
@@ -27,7 +27,7 @@ const RenderCommentEditorCustomRenderElement = props => {
|
|
|
27
27
|
const [renderParagraph] = _plugins.ParagraphPlugin.renderElements;
|
|
28
28
|
return renderParagraph(_props);
|
|
29
29
|
}
|
|
30
|
-
const placeholder = commentType === 'comment' ? '
|
|
30
|
+
const placeholder = commentType === 'comment' ? 'Enter_comment_shift_enter_for_new_line_Enter_to_send' : 'Enter_reply_shift_Enter_for_new_line_Enter_to_send';
|
|
31
31
|
const [renderParagraph] = _plugins.ParagraphPlugin.renderElements;
|
|
32
32
|
return renderParagraph({
|
|
33
33
|
..._props,
|
package/package.json
CHANGED
|
@@ -565,5 +565,6 @@
|
|
|
565
565
|
"Double_click_to_enter_edit_mode_and_adjust_field_width" : "Double click to enter edit mode and adjust field width",
|
|
566
566
|
"Enter_comment_Enter_for_new_line_shift_enter_to_send": "Enter comment, Enter for new line, Shift + Enter to send",
|
|
567
567
|
"Sub_table": "Tabulka",
|
|
568
|
-
"Search_action...": "Search action..."
|
|
568
|
+
"Search_action...": "Search action...",
|
|
569
|
+
"Comment_details": "Comment details"
|
|
569
570
|
}
|
|
@@ -565,5 +565,6 @@
|
|
|
565
565
|
"Double_click_to_enter_edit_mode_and_adjust_field_width" : "Double click to enter edit mode and adjust field width",
|
|
566
566
|
"Enter_comment_Enter_for_new_line_shift_enter_to_send": "Enter comment, Enter for new line, Shift + Enter to send",
|
|
567
567
|
"Sub_table": "Tabelle",
|
|
568
|
-
"Search_action...": "Search action..."
|
|
568
|
+
"Search_action...": "Search action...",
|
|
569
|
+
"Comment_details": "Comment details"
|
|
569
570
|
}
|
|
@@ -565,5 +565,6 @@
|
|
|
565
565
|
"Double_click_to_enter_edit_mode_and_adjust_field_width" : "Double click to enter edit mode and adjust field width",
|
|
566
566
|
"Enter_comment_Enter_for_new_line_shift_enter_to_send": "Enter comment, Enter for new line, Shift + Enter to send",
|
|
567
567
|
"Sub_table": "Table",
|
|
568
|
-
"Search_action...": "Search action..."
|
|
568
|
+
"Search_action...": "Search action...",
|
|
569
|
+
"Comment_details": "Comment details"
|
|
569
570
|
}
|
|
@@ -565,5 +565,6 @@
|
|
|
565
565
|
"Double_click_to_enter_edit_mode_and_adjust_field_width" : "Double click to enter edit mode and adjust field width",
|
|
566
566
|
"Enter_comment_Enter_for_new_line_shift_enter_to_send": "Enter comment, Enter for new line, Shift + Enter to send",
|
|
567
567
|
"Sub_table": "Tabla",
|
|
568
|
-
"Search_action...": "Search action..."
|
|
568
|
+
"Search_action...": "Search action...",
|
|
569
|
+
"Comment_details": "Comment details"
|
|
569
570
|
}
|
|
@@ -565,5 +565,6 @@
|
|
|
565
565
|
"Double_click_to_enter_edit_mode_and_adjust_field_width" : "Double click to enter edit mode and adjust field width",
|
|
566
566
|
"Enter_comment_Enter_for_new_line_shift_enter_to_send": "Enter comment, Enter for new line, Shift + Enter to send",
|
|
567
567
|
"Sub_table": "Tabla",
|
|
568
|
-
"Search_action...": "Search action..."
|
|
568
|
+
"Search_action...": "Search action...",
|
|
569
|
+
"Comment_details": "Comment details"
|
|
569
570
|
}
|
|
@@ -565,5 +565,6 @@
|
|
|
565
565
|
"Double_click_to_enter_edit_mode_and_adjust_field_width" : "Double click to enter edit mode and adjust field width",
|
|
566
566
|
"Enter_comment_Enter_for_new_line_shift_enter_to_send": "Enter comment, Enter for new line, Shift + Enter to send",
|
|
567
567
|
"Sub_table": "Tabla",
|
|
568
|
-
"Search_action...": "Search action..."
|
|
568
|
+
"Search_action...": "Search action...",
|
|
569
|
+
"Comment_details": "Comment details"
|
|
569
570
|
}
|
|
@@ -565,5 +565,6 @@
|
|
|
565
565
|
"Double_click_to_enter_edit_mode_and_adjust_field_width" : "Double click to enter edit mode and adjust field width",
|
|
566
566
|
"Enter_comment_Enter_for_new_line_shift_enter_to_send": "Enter comment, Enter for new line, Shift + Enter to send",
|
|
567
567
|
"Sub_table": "Tableau",
|
|
568
|
-
"Search_action...": "Search action..."
|
|
568
|
+
"Search_action...": "Search action...",
|
|
569
|
+
"Comment_details": "Comment details"
|
|
569
570
|
}
|
|
@@ -565,5 +565,6 @@
|
|
|
565
565
|
"Double_click_to_enter_edit_mode_and_adjust_field_width" : "Double click to enter edit mode and adjust field width",
|
|
566
566
|
"Enter_comment_Enter_for_new_line_shift_enter_to_send": "Enter comment, Enter for new line, Shift + Enter to send",
|
|
567
567
|
"Sub_table": "Tabella",
|
|
568
|
-
"Search_action...": "Search action..."
|
|
568
|
+
"Search_action...": "Search action...",
|
|
569
|
+
"Comment_details": "Comment details"
|
|
569
570
|
}
|
|
@@ -565,5 +565,6 @@
|
|
|
565
565
|
"Double_click_to_enter_edit_mode_and_adjust_field_width" : "Дважды щелкните, чтобы войти в режим редактирования и отрегулировать ширину поля",
|
|
566
566
|
"Enter_comment_Enter_for_new_line_shift_enter_to_send": "Введите комментарий, Enter для новой строки, Shift + Enter для отправки",
|
|
567
567
|
"Sub_table": "Таблица",
|
|
568
|
-
"Search_action...": "
|
|
568
|
+
"Search_action...": "Поиск действия...",
|
|
569
|
+
"Comment_details": "Comment details"
|
|
569
570
|
}
|
|
@@ -565,5 +565,6 @@
|
|
|
565
565
|
"Double_click_to_enter_edit_mode_and_adjust_field_width" : "双击可进入编辑模式并调整字段宽度",
|
|
566
566
|
"Enter_comment_Enter_for_new_line_shift_enter_to_send": "输入评论,Enter 换行,Shift + Enter 发送",
|
|
567
567
|
"Sub_table": "子表",
|
|
568
|
-
"Search_action...": "搜索操作..."
|
|
568
|
+
"Search_action...": "搜索操作...",
|
|
569
|
+
"Comment_details": "评论详情"
|
|
569
570
|
}
|