@seafile/sdoc-editor 1.0.112 → 1.0.114
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 +23 -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 +18 -15
- package/dist/basic-sdk/comment/components/global-comment/index.css +148 -16
- package/dist/basic-sdk/comment/components/global-comment/index.js +86 -49
- 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
|
@@ -10,6 +10,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
10
10
|
var _reactI18next = require("react-i18next");
|
|
11
11
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
12
12
|
var _slate = require("@seafile/slate");
|
|
13
|
+
var _slateReact = require("@seafile/slate-react");
|
|
13
14
|
var _context = _interopRequireDefault(require("../../../context"));
|
|
14
15
|
var _useParticipants = require("../hooks/use-participants");
|
|
15
16
|
var _sdocCommentEditor = _interopRequireDefault(require("../../editor/sdoc-comment-editor"));
|
|
@@ -31,13 +32,16 @@ const CommentEditor = _ref => {
|
|
|
31
32
|
type,
|
|
32
33
|
className,
|
|
33
34
|
content,
|
|
35
|
+
globalCommentContent,
|
|
34
36
|
placeholder,
|
|
35
37
|
insertContent,
|
|
36
38
|
updateContent,
|
|
37
39
|
setIsEditing,
|
|
38
40
|
hiddenComment,
|
|
39
41
|
commentRef,
|
|
40
|
-
globalComment
|
|
42
|
+
globalComment,
|
|
43
|
+
hiddenUserInfo,
|
|
44
|
+
updateGlobalCommentContent
|
|
41
45
|
} = _ref;
|
|
42
46
|
const commentWrapperRef = (0, _react.useRef)();
|
|
43
47
|
const {
|
|
@@ -84,9 +88,10 @@ const CommentEditor = _ref => {
|
|
|
84
88
|
const updateValue = (0, _react.useCallback)(value => {
|
|
85
89
|
if (!value || value.trim() === '') return;
|
|
86
90
|
if (!content) return insertContent(value);
|
|
87
|
-
updateContent(value);
|
|
91
|
+
updateContent && updateContent(value);
|
|
88
92
|
}, [content, insertContent, updateContent]);
|
|
89
93
|
const onSubmit = (0, _react.useCallback)(event => {
|
|
94
|
+
if (!_slateReact.ReactEditor.isFocused(editor)) return;
|
|
90
95
|
event && event.stopPropagation();
|
|
91
96
|
const mdString = (0, _slateToMd.default)(editor.children);
|
|
92
97
|
updateValue(mdString);
|
|
@@ -95,7 +100,8 @@ const CommentEditor = _ref => {
|
|
|
95
100
|
placeholder
|
|
96
101
|
})];
|
|
97
102
|
_slate.Transforms.select(editor, _slate.Editor.start(editor, []));
|
|
98
|
-
|
|
103
|
+
updateGlobalCommentContent && updateGlobalCommentContent(null);
|
|
104
|
+
}, [editor, updateValue, addParticipants, userInfo.username, placeholder, updateGlobalCommentContent]);
|
|
99
105
|
(0, _react.useEffect)(() => {
|
|
100
106
|
const eventBus = _eventBus.default.getInstance();
|
|
101
107
|
const unsubscribePostComment = eventBus.subscribe(_constants2.INTERNAL_EVENT.COMMENT_EDITOR_POST_COMMENT, onSubmit);
|
|
@@ -128,18 +134,27 @@ const CommentEditor = _ref => {
|
|
|
128
134
|
}
|
|
129
135
|
setIsEditing && setIsEditing(false);
|
|
130
136
|
hiddenComment && hiddenComment(false);
|
|
131
|
-
|
|
137
|
+
if (updateGlobalCommentContent) {
|
|
138
|
+
if (editor.children.find(n => _slate.Node.string(n).trim())) {
|
|
139
|
+
updateGlobalCommentContent((0, _slateToMd.default)(editor.children));
|
|
140
|
+
} else {
|
|
141
|
+
updateGlobalCommentContent(null);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
132
144
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
133
145
|
}, [setIsEditing]);
|
|
134
146
|
(0, _react.useEffect)(() => {
|
|
135
|
-
|
|
147
|
+
let children = (0, _mdToSlate.default)(content);
|
|
148
|
+
if (globalCommentContent) {
|
|
149
|
+
children = (0, _mdToSlate.default)(globalCommentContent);
|
|
150
|
+
}
|
|
136
151
|
editor.children = children;
|
|
137
152
|
_slate.Transforms.select(editor, _slate.Editor.end(editor, []));
|
|
138
|
-
}, [editor, content]);
|
|
153
|
+
}, [editor, content, globalCommentContent]);
|
|
139
154
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
140
155
|
className: (0, _classnames.default)('comment-editor-wrapper', className),
|
|
141
156
|
ref: commentWrapperRef
|
|
142
|
-
}, type === 'comment' && /*#__PURE__*/_react.default.createElement("div", {
|
|
157
|
+
}, type === 'comment' && !hiddenUserInfo && /*#__PURE__*/_react.default.createElement("div", {
|
|
143
158
|
className: "comment-editor-user-info"
|
|
144
159
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
145
160
|
className: "comment-editor-user-img"
|
|
@@ -160,6 +175,6 @@ const CommentEditor = _ref => {
|
|
|
160
175
|
}));
|
|
161
176
|
};
|
|
162
177
|
CommentEditor.defaultProps = {
|
|
163
|
-
placeholder: '
|
|
178
|
+
placeholder: 'Enter_comment_shift_enter_for_new_line_Enter_to_send'
|
|
164
179
|
};
|
|
165
180
|
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
|
+
}), commentCount !== 0 && /*#__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,12 +50,22 @@ 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
|
-
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
68
|
+
}, !activeCommentGroup && /*#__PURE__*/_react.default.createElement("div", {
|
|
58
69
|
id: "sdoc-read-all-btn",
|
|
59
70
|
className: "sdoc-icon-btn",
|
|
60
71
|
onClick: toggleReadAll
|
|
@@ -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,27 @@
|
|
|
108
116
|
flex: 1;
|
|
109
117
|
display: flex;
|
|
110
118
|
flex-direction: column;
|
|
111
|
-
padding: 16px;
|
|
112
119
|
padding-top: 0px;
|
|
120
|
+
margin-bottom: 11px;
|
|
113
121
|
overflow: auto;
|
|
122
|
+
border-bottom: 1px solid #e1e2e5;
|
|
114
123
|
}
|
|
115
124
|
|
|
116
125
|
.sdoc-comment-drawer .comments-panel-body__content .sdoc-comment-list-container {
|
|
117
126
|
position: relative;
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
.sdoc-comment-drawer .comments-panel-body__content .comment-ui-container.active {
|
|
121
|
-
left: 0;
|
|
127
|
+
margin-top: 0px;
|
|
122
128
|
}
|
|
123
129
|
|
|
124
130
|
.sdoc-comment-drawer .comments-panel-body__content .comment-ui-container.sdoc-resolved {
|
|
125
131
|
background: #f5f5f5;
|
|
126
132
|
}
|
|
127
133
|
|
|
134
|
+
.sdoc-comment-drawer .comments-panel-body__content .comment-ui-container.active {
|
|
135
|
+
left: 0;
|
|
136
|
+
background: #fff;
|
|
137
|
+
box-shadow: unset;
|
|
138
|
+
}
|
|
139
|
+
|
|
128
140
|
.sdoc-comment-drawer .comments-panel-body__content .comment-ui-container.active.sdoc-resolved {
|
|
129
141
|
background: #f5f5f5;
|
|
130
142
|
}
|
|
@@ -135,35 +147,155 @@
|
|
|
135
147
|
}
|
|
136
148
|
|
|
137
149
|
/* doc comment add editor */
|
|
138
|
-
.sdoc-comment-drawer .comments-panel-body .
|
|
150
|
+
.sdoc-comment-drawer .comments-panel-body .global-comment-input-wrapper {
|
|
139
151
|
padding: 0 16px;
|
|
140
|
-
position: absolute;
|
|
141
|
-
top: 120px;
|
|
142
152
|
width: 100%;
|
|
153
|
+
margin-bottom: 16px;
|
|
143
154
|
}
|
|
144
155
|
|
|
145
|
-
.sdoc-comment-drawer .comments-panel-body .
|
|
146
|
-
|
|
156
|
+
.sdoc-comment-drawer .comments-panel-body .global-comment-input-wrapper .form-control[readonly] {
|
|
157
|
+
background-color: #fff;
|
|
147
158
|
}
|
|
148
159
|
|
|
160
|
+
.sdoc-comment-drawer .comments-panel-body .global-comment-input-wrapper .form-control {
|
|
161
|
+
font-size: 14px;
|
|
162
|
+
font-weight: unset;
|
|
163
|
+
border: 1px solid #ececec;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.sdoc-comment-drawer .comments-panel-body .global-comment-input-wrapper.active .form-control {
|
|
167
|
+
padding-top: 14px;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.sdoc-comment-drawer .comments-panel-body .global-comment-input-wrapper .form-control:focus {
|
|
171
|
+
box-shadow: none;
|
|
172
|
+
border-color: #e1e2e5;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.sdoc-comment-drawer .comments-panel-body .global-comment-input-wrapper .form-control::placeholder {
|
|
176
|
+
color: rgb(191, 191, 191);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.sdoc-comment-drawer .comments-panel-body .sdoc-doc-comment-editor-container {
|
|
180
|
+
position: relative;
|
|
181
|
+
width: 100%;
|
|
182
|
+
}
|
|
149
183
|
|
|
150
184
|
.sdoc-comment-drawer .sdoc-doc-comment-editor-container .comment-ui-container.active {
|
|
151
185
|
margin-bottom: 0;
|
|
152
|
-
padding:
|
|
186
|
+
padding: 0px;
|
|
153
187
|
left: 0;
|
|
188
|
+
border: 0px;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.sdoc-comment-drawer .sdoc-doc-comment-editor-container .comment-ui-container:hover {
|
|
192
|
+
background-color: #FFF !important;
|
|
193
|
+
box-shadow: none;
|
|
154
194
|
}
|
|
155
195
|
|
|
156
196
|
/* custom */
|
|
157
197
|
.sdoc-comment-drawer .sdoc-comment-list-container .comment-ui-container {
|
|
158
198
|
background-color: #FFF;
|
|
159
|
-
|
|
199
|
+
margin-bottom: 0px;
|
|
200
|
+
box-shadow: none;
|
|
201
|
+
padding: 16px;
|
|
202
|
+
border-radius: 0px;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.sdoc-comment-drawer .sdoc-comment-list-container .comment-ui-container:hover {
|
|
206
|
+
background-color: #f5f5f5;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
.sdoc-comment-drawer .sdoc-comment-list-container .comment-ui-container .comment-item {
|
|
210
|
+
padding: 0px
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.sdoc-comment-drawer .sdoc-comment-list-container .comment-ui-container.active .comment-item:hover {
|
|
214
|
+
background-color: unset;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.sdoc-comment-drawer .sdoc-comment-list-container .comment-item .comment-header .comment-author__avatar img {
|
|
218
|
+
width: 24px;
|
|
219
|
+
height: 24px;
|
|
220
|
+
margin-top: -5px;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
.sdoc-comment-drawer .sdoc-comment-list-container .comment-item .comment-content {
|
|
224
|
+
margin-left: 35px;
|
|
225
|
+
margin-bottom: 16px;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
.sdoc-comment-drawer .sdoc-comment-list-container .comment-item .comment-footer {
|
|
229
|
+
display: flex;
|
|
230
|
+
color: #666666;
|
|
231
|
+
font-size: 14px;
|
|
232
|
+
margin-left: 35px;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
.sdoc-comment-drawer .sdoc-comment-list-container .comment-item .comment-footer .comments-count {
|
|
236
|
+
display: flex;
|
|
237
|
+
align-items: center;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
.sdoc-comment-drawer .sdoc-comment-list-container .comment-item .comment-footer .comments-count .comments-count-number {
|
|
241
|
+
margin-left: 8px;
|
|
242
|
+
margin-top: -2px;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
.sdoc-comment-drawer .sdoc-comment-list-container .comment-item .comment-footer .comment-author {
|
|
246
|
+
margin-left: 20px;
|
|
247
|
+
align-items: unset;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
.sdoc-comment-drawer .sdoc-comment-list-container .comment-item .comment-item-operation-wrapper {
|
|
251
|
+
margin-top: -12px;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
.sdoc-comment-drawer .sdoc-comment-list-container .comment-item .comment-item-operation-wrapper .comment-operation {
|
|
255
|
+
width: 24px;
|
|
256
|
+
height: 24px;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
.sdoc-comment-drawer .sdoc-comment-list-container .comment-item .comment-footer .comment-author__avatar {
|
|
260
|
+
width: 16px;
|
|
261
|
+
height: 16px;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
.sdoc-comment-drawer .sdoc-comment-list-container .comment-item .comment-footer .comment-author__avatar img {
|
|
265
|
+
border-radius: 50%;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
.sdoc-comment-drawer .sdoc-comment-list-container .comment-item .comment-footer .comment-author__latest-reply {
|
|
269
|
+
margin-left: 8px;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
.sdoc-comment-drawer .sdoc-comment-list-container .comment-item .comment-footer .comment-author__latest-reply p {
|
|
273
|
+
margin: 0px;
|
|
274
|
+
overflow: hidden;
|
|
275
|
+
text-overflow: ellipsis;
|
|
276
|
+
white-space: nowrap;
|
|
277
|
+
width: 220px;
|
|
160
278
|
}
|
|
161
279
|
|
|
162
280
|
.sdoc-comment-drawer .sdoc-comment-list-container .comment-item-selected-text-container {
|
|
163
|
-
|
|
164
|
-
|
|
281
|
+
color: #666666;
|
|
282
|
+
padding: 0px 0px 16px 0px;
|
|
283
|
+
height: auto;
|
|
165
284
|
}
|
|
166
285
|
|
|
167
286
|
.comments-panel-body__header .sdoc-comment-filter-dropdown.sdoc-dropdown-menu {
|
|
168
287
|
border: 1px solid #dee3eb;
|
|
169
288
|
}
|
|
289
|
+
|
|
290
|
+
.sdoc-comment-drawer .sdoc-comment-list-container .comment-item-detail-wrapper {
|
|
291
|
+
border-bottom: 0px
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
.sdoc-comment-drawer .sdoc-comment-list-container .comment-item-detail-wrapper:hover {
|
|
295
|
+
background-color: #FFF;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
.sdoc-comment-drawer .sdoc-comment-list-container .comment-item-detail-wrapper .comment-operation .sdoc-confirm {
|
|
299
|
+
color: rgb(70, 77, 90);
|
|
300
|
+
font-weight: unset;
|
|
301
|
+
}
|
|
@@ -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,21 @@ 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]);
|
|
127
|
+
const commentEditorPlaceholder = !activeCommentGroup ? t('Enter_comment_shift_enter_for_new_line_Enter_to_send') : t('Enter_reply_shift_Enter_for_new_line_Enter_to_send');
|
|
117
128
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
118
129
|
className: "sdoc-comment-drawer"
|
|
119
130
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -121,10 +132,11 @@ const GlobalComment = _ref => {
|
|
|
121
132
|
className: "comments-panel-wrapper"
|
|
122
133
|
}, /*#__PURE__*/_react.default.createElement(_globalCommentHeader.default, {
|
|
123
134
|
toggle: closePlugin,
|
|
124
|
-
|
|
135
|
+
activeCommentGroup: activeCommentGroup,
|
|
136
|
+
setCurrentCommentGroup: setCurrentCommentGroup
|
|
125
137
|
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
126
138
|
className: "comments-panel-body"
|
|
127
|
-
}, /*#__PURE__*/_react.default.createElement(_globalCommentBodyHeader.default, {
|
|
139
|
+
}, !activeCommentGroup && /*#__PURE__*/_react.default.createElement(_globalCommentBodyHeader.default, {
|
|
128
140
|
commentList: commentList,
|
|
129
141
|
commentType: commentType,
|
|
130
142
|
setCommentType: setCommentType
|
|
@@ -134,27 +146,52 @@ const GlobalComment = _ref => {
|
|
|
134
146
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
135
147
|
id: "global-comment-list-container",
|
|
136
148
|
className: "sdoc-comment-list-container"
|
|
137
|
-
}, Array.isArray(commentList) && commentList.map(comment => {
|
|
149
|
+
}, !activeCommentGroup && Array.isArray(commentList) && commentList.map(comment => {
|
|
150
|
+
var _comment$replies, _comment$replies2;
|
|
151
|
+
const latestComment = ((_comment$replies = comment.replies) === null || _comment$replies === void 0 ? void 0 : _comment$replies.length) > 0 ? comment.replies[comment.replies.length - 1] : comment;
|
|
152
|
+
const commentCount = (_comment$replies2 = comment.replies) === null || _comment$replies2 === void 0 ? void 0 : _comment$replies2.length;
|
|
138
153
|
const elementId = comment.detail.element_id;
|
|
139
|
-
const element =
|
|
140
|
-
|
|
141
|
-
return /*#__PURE__*/_react.default.createElement(_commentItemWrapper.default, {
|
|
154
|
+
const element = getNodeByElementId(elementId);
|
|
155
|
+
return /*#__PURE__*/_react.default.createElement(_commentItemCollapseWrapper.default, {
|
|
142
156
|
key: comment.id,
|
|
157
|
+
editor: editor,
|
|
143
158
|
element: element,
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
hiddenComment: hiddenComment,
|
|
149
|
-
updateScrollPosition: updateScrollPosition,
|
|
150
|
-
isClickCommentPanelBody: isClickCommentPanelBody,
|
|
151
|
-
editor: editor
|
|
159
|
+
topLevelComment: comment,
|
|
160
|
+
latestComment: latestComment,
|
|
161
|
+
commentCount: commentCount,
|
|
162
|
+
setCurrentCommentGroup: setCurrentCommentGroup
|
|
152
163
|
});
|
|
153
|
-
})
|
|
154
|
-
|
|
164
|
+
}), activeCommentGroup && /*#__PURE__*/_react.default.createElement(_commentItemWrapper.default, {
|
|
165
|
+
key: activeCommentGroup.id,
|
|
166
|
+
editor: editor,
|
|
167
|
+
element: getNodeByElementId(activeCommentGroup.detail.element_id),
|
|
168
|
+
container: "global-comment-list-container",
|
|
169
|
+
contentRef: contentRef,
|
|
170
|
+
comment: activeCommentGroup,
|
|
171
|
+
isGlobalComment: true,
|
|
172
|
+
isActive: true,
|
|
173
|
+
updateScrollPosition: updateScrollPosition,
|
|
155
174
|
isClickCommentPanelBody: isClickCommentPanelBody,
|
|
175
|
+
setCurrentCommentGroup: setCurrentCommentGroup
|
|
176
|
+
}))), /*#__PURE__*/_react.default.createElement("div", {
|
|
177
|
+
className: (0, _classnames.default)('global-comment-input-wrapper', {
|
|
178
|
+
'active': globalCommentContent === null || globalCommentContent === void 0 ? void 0 : globalCommentContent.trim()
|
|
179
|
+
})
|
|
180
|
+
}, !showEditor && /*#__PURE__*/_react.default.createElement(_reactstrap.Input, {
|
|
181
|
+
value: globalCommentContent !== null && globalCommentContent !== void 0 && globalCommentContent.trim() ? '.....' : '',
|
|
182
|
+
readOnly: true,
|
|
183
|
+
placeholder: commentEditorPlaceholder,
|
|
184
|
+
onFocus: () => {
|
|
185
|
+
setShowEditor(true);
|
|
186
|
+
}
|
|
187
|
+
}), showEditor && /*#__PURE__*/_react.default.createElement(_globalCommentEditor.default, {
|
|
188
|
+
globalCommentContent: globalCommentContent,
|
|
189
|
+
isScrollDisplayed: isScrollDisplayed,
|
|
156
190
|
hiddenCommentEditor: hiddenCommentEditor,
|
|
157
|
-
insertDocComment: insertDocComment
|
|
158
|
-
|
|
191
|
+
insertDocComment: insertDocComment,
|
|
192
|
+
updateGlobalCommentContent: content => {
|
|
193
|
+
setGlobalCommentContent(content);
|
|
194
|
+
}
|
|
195
|
+
})))));
|
|
159
196
|
};
|
|
160
|
-
var _default = exports.default = GlobalComment;
|
|
197
|
+
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
|
}
|