@seafile/sdoc-editor 0.5.30 → 0.5.32
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/assets/css/layout.css +11 -15
- package/dist/basic-sdk/assets/css/simple-viewer.css +0 -10
- package/dist/basic-sdk/comment/components/comment-all-participants/index.css +8 -8
- package/dist/basic-sdk/comment/components/comment-editor.js +18 -18
- package/dist/basic-sdk/comment/components/comment-item-wrapper.js +4 -2
- package/dist/basic-sdk/comment/components/comment-list.css +26 -8
- package/dist/basic-sdk/comment/components/comment-list.js +7 -2
- package/dist/basic-sdk/comment/components/editor-comment.js +12 -10
- package/dist/basic-sdk/comment/components/elements-comment-count/element-comment-count.js +4 -8
- package/dist/basic-sdk/comment/components/elements-comment-count/index.js +4 -2
- package/dist/basic-sdk/comment/components/global-comment/global-comment-editor.js +2 -18
- package/dist/basic-sdk/comment/components/global-comment/index.css +57 -33
- package/dist/basic-sdk/comment/components/global-comment/index.js +95 -30
- package/dist/basic-sdk/comment/index.js +11 -10
- package/dist/basic-sdk/comment/provider/comment-context-provider.js +2 -3
- package/dist/basic-sdk/comment/provider/index.js +7 -2
- package/dist/basic-sdk/comment/provider/notification-context-provider.js +2 -3
- package/dist/basic-sdk/editor/comment-article.js +3 -103
- package/dist/basic-sdk/editor/editable-article.js +7 -3
- package/dist/basic-sdk/editor/sdoc-editor.js +6 -3
- package/dist/basic-sdk/extension/plugins/image/plugin.js +1 -1
- package/dist/basic-sdk/extension/plugins/list/plugin/index.js +17 -10
- package/dist/basic-sdk/extension/plugins/list/plugin/shortcut.js +1 -1
- package/dist/basic-sdk/hooks/use-selection-element.js +4 -3
- package/dist/basic-sdk/layout/article-container.js +10 -1
- package/dist/basic-sdk/layout/editor-content.js +18 -11
- package/dist/basic-sdk/outline/index.js +4 -1
- package/dist/basic-sdk/outline/style.css +12 -6
- package/dist/basic-sdk/views/readonly-article.js +4 -1
- package/dist/basic-sdk/views/sdoc-viewer.js +5 -3
- package/dist/layout/layout.css +0 -5
- package/package.json +1 -1
|
@@ -28,32 +28,28 @@
|
|
|
28
28
|
border-right: none;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
.sdoc-
|
|
31
|
+
.sdoc-content-wrapper {
|
|
32
32
|
width: 100%;
|
|
33
|
-
height: calc(
|
|
33
|
+
height: calc(100vh - 44px);
|
|
34
34
|
display: flex;
|
|
35
|
-
background: #f5f5f5;
|
|
36
|
-
position: relative;
|
|
37
35
|
}
|
|
38
36
|
|
|
39
|
-
.sdoc-editor-container .sdoc-
|
|
37
|
+
.sdoc-editor-container .sdoc-editor-content {
|
|
38
|
+
display: flex;
|
|
40
39
|
position: absolute;
|
|
41
|
-
|
|
42
|
-
right: 0;
|
|
43
|
-
top: 0;
|
|
44
|
-
bottom: 0;
|
|
45
|
-
height: 100%;
|
|
40
|
+
min-width: 1100px;
|
|
46
41
|
width: 100%;
|
|
47
42
|
}
|
|
48
43
|
|
|
44
|
+
|
|
49
45
|
.sdoc-editor-container .sdoc-scroll-container {
|
|
50
|
-
position: absolute;
|
|
51
|
-
left: 0;
|
|
52
|
-
right: 0;
|
|
53
|
-
top: 0;
|
|
54
|
-
bottom: 0;
|
|
55
46
|
z-index: 100;
|
|
56
47
|
overflow: auto;
|
|
48
|
+
height: 100%;
|
|
49
|
+
width: 100%;
|
|
50
|
+
position: relative;
|
|
51
|
+
flex: 1;
|
|
52
|
+
background: #f5f5f5;
|
|
57
53
|
}
|
|
58
54
|
|
|
59
55
|
.sdoc-editor-container .sdoc-article-container {
|
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
.sdoc-editor-container .sdoc-editor-content.readonly {
|
|
2
|
-
height: 100%;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
.sdoc-editor-container .sdoc-editor-content.no-outline .sdoc-absolute-wrapper {
|
|
6
|
-
display: flex;
|
|
7
|
-
position: relative;
|
|
8
|
-
min-height: 0;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
1
|
.sdoc-editor-container .sdoc-editor-content.no-outline .sdoc-article-container {
|
|
12
2
|
margin-left: 0 !important;
|
|
13
3
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
.
|
|
1
|
+
.sdoc-comment-drawer .comments-panel-body__header .comments-participants-container {
|
|
2
2
|
width: fit-content;
|
|
3
3
|
max-width: 100%;
|
|
4
4
|
height: 42px;
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
position: relative;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
.
|
|
11
|
+
.sdoc-comment-drawer .comments-panel-body__header .comments-participants-editor-target {
|
|
12
12
|
position: absolute;
|
|
13
13
|
left: -1px;
|
|
14
14
|
top: 0;
|
|
@@ -18,13 +18,13 @@
|
|
|
18
18
|
background-color: transparent;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
.
|
|
21
|
+
.sdoc-comment-drawer .comments-panel-body__header .comment-participant-avatar {
|
|
22
22
|
border-radius: 50%;
|
|
23
23
|
vertical-align: middle;
|
|
24
24
|
margin-right: -0.5rem;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
.
|
|
27
|
+
.sdoc-comment-drawer .comments-panel-body__header .comment-participant-avatar img {
|
|
28
28
|
width: 28px;
|
|
29
29
|
height: 28px;
|
|
30
30
|
border: 2px solid #fff;
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
user-select: none;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
.
|
|
44
|
+
.sdoc-comment-drawer .comments-panel-body__header .add-comments-participants {
|
|
45
45
|
position: relative;
|
|
46
46
|
bottom: -3px;
|
|
47
47
|
cursor: pointer;
|
|
@@ -56,13 +56,13 @@
|
|
|
56
56
|
justify-content: center;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
.
|
|
59
|
+
.sdoc-comment-drawer .add-comments-participants .sdocfont {
|
|
60
60
|
font-size: 16px;
|
|
61
61
|
color: #ff8000;
|
|
62
62
|
border-radius: 50%;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
.
|
|
65
|
+
.sdoc-comment-drawer .comment-participants-more {
|
|
66
66
|
position: absolute;
|
|
67
67
|
top: 0;
|
|
68
68
|
left: 0;
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
border: 2px solid #fff;
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
.
|
|
80
|
+
.sdoc-comment-drawer .comment-participants-more .sdocfont {
|
|
81
81
|
color: #fff;
|
|
82
82
|
font-size: 12px;
|
|
83
83
|
}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
2
2
|
import { useTranslation } from 'react-i18next';
|
|
3
|
-
import { Button } from 'reactstrap';
|
|
4
3
|
import classNames from 'classnames';
|
|
5
4
|
import { Editor, Transforms } from '@seafile/slate';
|
|
6
|
-
import { useScrollContext } from '../../hooks/use-scroll-context';
|
|
7
5
|
import context from '../../../context';
|
|
8
6
|
import { useParticipantsContext } from '../hooks/use-participants';
|
|
9
7
|
import SdocCommentEditor from '../../editor/sdoc-comment-editor';
|
|
@@ -28,13 +26,14 @@ const CommentEditor = _ref => {
|
|
|
28
26
|
insertContent,
|
|
29
27
|
updateContent,
|
|
30
28
|
setIsEditing,
|
|
31
|
-
hiddenComment
|
|
29
|
+
hiddenComment,
|
|
30
|
+
commentRef,
|
|
31
|
+
globalComment
|
|
32
32
|
} = _ref;
|
|
33
33
|
const commentWrapperRef = useRef();
|
|
34
34
|
const {
|
|
35
35
|
t
|
|
36
36
|
} = useTranslation();
|
|
37
|
-
const scrollRef = useScrollContext();
|
|
38
37
|
const {
|
|
39
38
|
addParticipants
|
|
40
39
|
} = useParticipantsContext();
|
|
@@ -66,13 +65,11 @@ const CommentEditor = _ref => {
|
|
|
66
65
|
// onMount: set scrollLeft
|
|
67
66
|
useEffect(() => {
|
|
68
67
|
if (!commentWrapperRef.current) return;
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
if (!scrollRef.current) return;
|
|
75
|
-
scrollRef.current.scrollLeft = scrollRef.current.scrollLeft + width;
|
|
68
|
+
(commentRef === null || commentRef === void 0 ? void 0 : commentRef.current) && commentRef.current.scrollIntoView({
|
|
69
|
+
behavior: 'smooth',
|
|
70
|
+
block: 'nearest'
|
|
71
|
+
});
|
|
72
|
+
|
|
76
73
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
77
74
|
}, []);
|
|
78
75
|
const updateValue = useCallback(value => {
|
|
@@ -99,15 +96,18 @@ const CommentEditor = _ref => {
|
|
|
99
96
|
} = event;
|
|
100
97
|
if (eventType === 'keydown' && keyCode !== KeyCodes.Esc) return;
|
|
101
98
|
if (eventType === 'click') {
|
|
99
|
+
const isSdocContentWrapper = target.classList.contains('sdoc-content-wrapper');
|
|
102
100
|
const listContainer = window.document.querySelector('#global-comment-list-container');
|
|
103
|
-
const
|
|
104
|
-
const
|
|
105
|
-
const
|
|
101
|
+
const commentEditorContainer = window.document.querySelector('.sdoc-doc-comment-editor-container');
|
|
102
|
+
const resizeContainer = window.document.querySelector('.sdoc-comment-resize-handler');
|
|
103
|
+
const scrollContainer = window.document.querySelector('.sdoc-scroll-container');
|
|
106
104
|
const isClickOnListContainer = listContainer && listContainer.contains(target);
|
|
107
|
-
const
|
|
108
|
-
const
|
|
109
|
-
const
|
|
110
|
-
const isPreventCancel = isClickOnListContainer ||
|
|
105
|
+
const isClickOnCommentEditorContainer = commentEditorContainer && commentEditorContainer.contains(target);
|
|
106
|
+
const isClickResizeContainer = resizeContainer && resizeContainer.contains(target);
|
|
107
|
+
const isClickScrollContainer = scrollContainer && scrollContainer.contains(target);
|
|
108
|
+
const isPreventCancel = isClickOnListContainer || isClickOnCommentEditorContainer || isClickResizeContainer || isClickScrollContainer || isSdocContentWrapper;
|
|
109
|
+
// Global comment could not be canceled by clicking outside
|
|
110
|
+
if (globalComment && !isClickScrollContainer) return;
|
|
111
111
|
if (isPreventCancel) return;
|
|
112
112
|
}
|
|
113
113
|
setIsEditing && setIsEditing(false);
|
|
@@ -277,12 +277,14 @@ const CommentItemWrapper = _ref => {
|
|
|
277
277
|
key: reply.id,
|
|
278
278
|
reply: reply
|
|
279
279
|
});
|
|
280
|
-
})), isActive && /*#__PURE__*/React.createElement(
|
|
280
|
+
})), isActive && /*#__PURE__*/React.createElement("div", {
|
|
281
|
+
className: "sdoc-reply-wrapper"
|
|
282
|
+
}, /*#__PURE__*/React.createElement(CommentEditor, {
|
|
281
283
|
type: "reply",
|
|
282
284
|
placeholder: tip,
|
|
283
285
|
insertContent: insertContent,
|
|
284
286
|
hiddenComment: hiddenComment
|
|
285
|
-
}), isShowDeleteDialog && isActive && /*#__PURE__*/React.createElement(CommentDeletePopover, {
|
|
287
|
+
})), isShowDeleteDialog && isActive && /*#__PURE__*/React.createElement(CommentDeletePopover, {
|
|
286
288
|
type: "comment",
|
|
287
289
|
setIsShowDeleteDialog: setIsShowDeleteDialog,
|
|
288
290
|
targetId: commentOpToolsId,
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
+
.sdoc-article-container .sdoc-comment-list-container {
|
|
2
|
+
width: 312px;
|
|
3
|
+
}
|
|
4
|
+
|
|
1
5
|
.sdoc-comment-list-container {
|
|
2
6
|
position: absolute;
|
|
3
7
|
}
|
|
4
8
|
|
|
5
9
|
.sdoc-comment-list-container .comment-ui-container {
|
|
6
|
-
min-width: 330px;
|
|
7
|
-
max-width: 400px;
|
|
8
10
|
background-color: #edf2fa;
|
|
9
|
-
border-radius:
|
|
11
|
+
border-radius: 3px;
|
|
10
12
|
box-shadow: 0 0 2px rgba(0, 0, 0, .04);
|
|
11
|
-
padding: 16px;
|
|
13
|
+
padding: 16px 16px;
|
|
12
14
|
margin-bottom: 10px;
|
|
13
15
|
cursor: pointer;
|
|
14
16
|
}
|
|
@@ -20,6 +22,10 @@
|
|
|
20
22
|
box-shadow: 0 1px 3px rgba(0, 0, 0, .3), 0 4px 8px 3px rgba(0, 0, 0, .15);
|
|
21
23
|
}
|
|
22
24
|
|
|
25
|
+
.sdoc-comment-drawer .sdoc-comment-list-container .comment-ui-container {
|
|
26
|
+
padding: 16px 0;
|
|
27
|
+
}
|
|
28
|
+
|
|
23
29
|
.sdoc-comment-list-container .comment-item-selected-text-container {
|
|
24
30
|
width: 100%;
|
|
25
31
|
height: 32px;
|
|
@@ -27,7 +33,7 @@
|
|
|
27
33
|
padding: 6px 16px;
|
|
28
34
|
align-items: center;
|
|
29
35
|
overflow: hidden;
|
|
30
|
-
border-radius:
|
|
36
|
+
border-radius: 3px 3px 0 0;
|
|
31
37
|
}
|
|
32
38
|
|
|
33
39
|
.sdoc-comment-list-container .comment-item-selected-text-container .sdoc-comment-quote {
|
|
@@ -64,7 +70,7 @@
|
|
|
64
70
|
|
|
65
71
|
.comment-delete-popover-container .delete-control {
|
|
66
72
|
display: flex;
|
|
67
|
-
justify-content: end;
|
|
73
|
+
justify-content: flex-end;
|
|
68
74
|
width: 100%;
|
|
69
75
|
}
|
|
70
76
|
|
|
@@ -80,7 +86,6 @@
|
|
|
80
86
|
}
|
|
81
87
|
|
|
82
88
|
.sdoc-comment-list-container .comment-item .comment-content {
|
|
83
|
-
padding-bottom: 10px;
|
|
84
89
|
margin-top: 10px;
|
|
85
90
|
margin-left: 41px;
|
|
86
91
|
word-break: keep-all;
|
|
@@ -229,7 +234,7 @@
|
|
|
229
234
|
}
|
|
230
235
|
|
|
231
236
|
.comment-editor-wrapper .sdoc-comment-editor-wrapper .article.sdoc-comment-editor {
|
|
232
|
-
width:
|
|
237
|
+
width: 100%;
|
|
233
238
|
padding: 8px;
|
|
234
239
|
padding-bottom: 0;
|
|
235
240
|
min-height: 130px;
|
|
@@ -241,6 +246,10 @@
|
|
|
241
246
|
background-color: transparent;
|
|
242
247
|
}
|
|
243
248
|
|
|
249
|
+
.comment-container-right .sdoc-editor-container {
|
|
250
|
+
width: 365px;
|
|
251
|
+
}
|
|
252
|
+
|
|
244
253
|
.article.sdoc-comment-editor :first-child {
|
|
245
254
|
margin-top: 0 !important;
|
|
246
255
|
}
|
|
@@ -291,3 +300,12 @@
|
|
|
291
300
|
display: flex;
|
|
292
301
|
justify-content: flex-end;
|
|
293
302
|
}
|
|
303
|
+
|
|
304
|
+
.sdoc-reply-wrapper {
|
|
305
|
+
padding: 0 10px;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
.sdoc-doc-comment-editor-container.sdoc-comment-list-container .comment-ui-container {
|
|
309
|
+
padding-left: 10px;
|
|
310
|
+
padding-right: 10px;
|
|
311
|
+
}
|
|
@@ -23,7 +23,6 @@ const CommentList = _ref => {
|
|
|
23
23
|
if (event.target.className !== 'article') return;
|
|
24
24
|
hiddenComment();
|
|
25
25
|
}, [hiddenComment]);
|
|
26
|
-
|
|
27
26
|
// onMount: hidden comment
|
|
28
27
|
useEffect(() => {
|
|
29
28
|
const eventBus = EventBus.getInstance();
|
|
@@ -83,6 +82,10 @@ const CommentList = _ref => {
|
|
|
83
82
|
}, []);
|
|
84
83
|
useEffect(() => {
|
|
85
84
|
document.addEventListener('click', resetActiveComment);
|
|
85
|
+
commentRef.current.scrollIntoView({
|
|
86
|
+
behavior: 'smooth',
|
|
87
|
+
block: 'nearest'
|
|
88
|
+
});
|
|
86
89
|
return () => {
|
|
87
90
|
document.removeEventListener('click', resetActiveComment);
|
|
88
91
|
};
|
|
@@ -111,8 +114,10 @@ const CommentList = _ref => {
|
|
|
111
114
|
className: "comment-ui-container active"
|
|
112
115
|
}, /*#__PURE__*/React.createElement(CommentEditor, {
|
|
113
116
|
type: "comment",
|
|
117
|
+
globalComment: true,
|
|
114
118
|
insertContent: insertContent,
|
|
115
|
-
hiddenComment: hiddenComment
|
|
119
|
+
hiddenComment: hiddenComment,
|
|
120
|
+
commentRef: commentRef
|
|
116
121
|
})));
|
|
117
122
|
};
|
|
118
123
|
export default CommentList;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
2
|
-
import { useSlateStatic } from '@seafile/slate-react';
|
|
3
2
|
import { Node } from '@seafile/slate';
|
|
4
3
|
import useSelectionUpdate from '../../hooks/use-selection-update';
|
|
5
4
|
import { useCursorPosition } from '../helper';
|
|
@@ -11,11 +10,13 @@ import { ELEMENT_TYPE } from '../../extension/constants';
|
|
|
11
10
|
import { Z_INDEX } from '../../constants';
|
|
12
11
|
const EditorComment = _ref => {
|
|
13
12
|
let {
|
|
14
|
-
deleteUnseenNotifications
|
|
13
|
+
deleteUnseenNotifications,
|
|
14
|
+
editor
|
|
15
15
|
} = _ref;
|
|
16
16
|
useSelectionUpdate();
|
|
17
|
-
const
|
|
18
|
-
|
|
17
|
+
const selectionElement = useSelectionElement({
|
|
18
|
+
editor
|
|
19
|
+
});
|
|
19
20
|
const [isShowComments, setIsShowComments] = useState(false);
|
|
20
21
|
const onAddCommentToggle = useCallback(() => {
|
|
21
22
|
setIsShowComments(true);
|
|
@@ -38,6 +39,10 @@ const EditorComment = _ref => {
|
|
|
38
39
|
setComments([]);
|
|
39
40
|
setIsShowComments(false);
|
|
40
41
|
}, [element_comments_map, selectionElement, editor.selection]);
|
|
42
|
+
const hiddenComment = useCallback(() => {
|
|
43
|
+
setComments([]);
|
|
44
|
+
setIsShowComments(false);
|
|
45
|
+
}, []);
|
|
41
46
|
const cursor = useCursorPosition();
|
|
42
47
|
const style = useMemo(() => {
|
|
43
48
|
var _Node$string;
|
|
@@ -59,11 +64,7 @@ const EditorComment = _ref => {
|
|
|
59
64
|
top: cursor.y,
|
|
60
65
|
zIndex: Z_INDEX.COMMENT_ADD
|
|
61
66
|
};
|
|
62
|
-
}, [
|
|
63
|
-
const hiddenComment = useCallback(() => {
|
|
64
|
-
setComments([]);
|
|
65
|
-
setIsShowComments(false);
|
|
66
|
-
}, []);
|
|
67
|
+
}, [selectionElement, element_comments_map, cursor.y, isShowComments]);
|
|
67
68
|
return /*#__PURE__*/React.createElement("div", {
|
|
68
69
|
className: "sdoc-comment-container"
|
|
69
70
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -80,7 +81,8 @@ const EditorComment = _ref => {
|
|
|
80
81
|
className: "sdocfont sdoc-add-comment mr-1"
|
|
81
82
|
}))), /*#__PURE__*/React.createElement(ElementsCommentCount, {
|
|
82
83
|
elementCommentsMap: element_comments_map,
|
|
83
|
-
selectionElement: selectionElement
|
|
84
|
+
selectionElement: selectionElement,
|
|
85
|
+
editor: editor
|
|
84
86
|
}), /*#__PURE__*/React.createElement("div", {
|
|
85
87
|
className: "comment-list-wrapper",
|
|
86
88
|
style: isShowComments ? {
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useState } from 'react';
|
|
2
|
-
import { useSlateStatic } from '@seafile/slate-react';
|
|
3
2
|
import { getNodeById } from '../../../extension/core';
|
|
4
|
-
import { useScrollContext } from '../../../hooks/use-scroll-context';
|
|
5
3
|
import { getElementCommentCountTop } from '../../helper';
|
|
6
4
|
import { eventStopPropagation } from '../../../utils/mouse-event';
|
|
7
5
|
import { focusToCommentElement } from '../../utils';
|
|
@@ -10,23 +8,21 @@ const ElementCommentCount = _ref => {
|
|
|
10
8
|
let {
|
|
11
9
|
elementId,
|
|
12
10
|
isElementSelected,
|
|
13
|
-
commentsCount
|
|
11
|
+
commentsCount,
|
|
12
|
+
editor
|
|
14
13
|
} = _ref;
|
|
15
|
-
const editor = useSlateStatic();
|
|
16
14
|
const element = getNodeById(editor.children, elementId);
|
|
17
|
-
const scrollRef = useScrollContext();
|
|
18
15
|
const [top, setTop] = useState(-9999);
|
|
19
16
|
const onClick = useCallback(event => {
|
|
20
17
|
eventStopPropagation(event);
|
|
21
18
|
focusToCommentElement(editor, element);
|
|
22
19
|
}, [editor, element]);
|
|
23
20
|
useEffect(() => {
|
|
24
|
-
var _scrollRef$current;
|
|
25
21
|
if (!element) return;
|
|
26
|
-
const scrollTop =
|
|
22
|
+
const scrollTop = 0;
|
|
27
23
|
const newTop = getElementCommentCountTop(editor, element, scrollTop);
|
|
28
24
|
setTop(newTop);
|
|
29
|
-
}, [editor, elementId, element,
|
|
25
|
+
}, [editor, elementId, element, isElementSelected]);
|
|
30
26
|
if (!element) return null;
|
|
31
27
|
let style = {
|
|
32
28
|
top
|
|
@@ -4,7 +4,8 @@ import './index.css';
|
|
|
4
4
|
const ElementsCommentCount = _ref => {
|
|
5
5
|
let {
|
|
6
6
|
elementCommentsMap,
|
|
7
|
-
selectionElement
|
|
7
|
+
selectionElement,
|
|
8
|
+
editor
|
|
8
9
|
} = _ref;
|
|
9
10
|
if (!elementCommentsMap) return null;
|
|
10
11
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -20,7 +21,8 @@ const ElementsCommentCount = _ref => {
|
|
|
20
21
|
key: elementId,
|
|
21
22
|
elementId: elementId,
|
|
22
23
|
isElementSelected: isSelected,
|
|
23
|
-
commentsCount: unresolvedCommentCount
|
|
24
|
+
commentsCount: unresolvedCommentCount,
|
|
25
|
+
editor: editor
|
|
24
26
|
});
|
|
25
27
|
}));
|
|
26
28
|
};
|
|
@@ -1,28 +1,12 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import CommentEditor from '../comment-editor';
|
|
3
3
|
const GlobalCommentEditor = _ref => {
|
|
4
4
|
let {
|
|
5
5
|
insertDocComment,
|
|
6
6
|
hiddenCommentEditor
|
|
7
7
|
} = _ref;
|
|
8
|
-
const ref = useRef(null);
|
|
9
|
-
useEffect(() => {
|
|
10
|
-
const hidden = event => {
|
|
11
|
-
var _ref$current;
|
|
12
|
-
if (!((_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.contains(event.target))) {
|
|
13
|
-
hiddenCommentEditor();
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
document.addEventListener('click', hidden);
|
|
17
|
-
return () => {
|
|
18
|
-
document.removeEventListener('click', hidden);
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
22
|
-
}, []);
|
|
23
8
|
return /*#__PURE__*/React.createElement("div", {
|
|
24
|
-
className: "sdoc-doc-comment-editor-container sdoc-comment-list-container"
|
|
25
|
-
ref: ref
|
|
9
|
+
className: "sdoc-doc-comment-editor-container sdoc-comment-list-container"
|
|
26
10
|
}, /*#__PURE__*/React.createElement("div", {
|
|
27
11
|
className: "comment-ui-container active"
|
|
28
12
|
}, /*#__PURE__*/React.createElement(CommentEditor, {
|
|
@@ -1,23 +1,46 @@
|
|
|
1
|
-
.
|
|
2
|
-
position:
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
height: 540px;
|
|
1
|
+
.sdoc-comment-drawer {
|
|
2
|
+
position: relative;
|
|
3
|
+
width: 360px;
|
|
4
|
+
min-width: 360px;
|
|
5
|
+
max-width: 620px;
|
|
6
|
+
border-left: 1px solid #e2e3e6;
|
|
8
7
|
}
|
|
9
8
|
|
|
10
|
-
.
|
|
11
|
-
height
|
|
9
|
+
.sdoc-comment-drawer .comments-panel-wrapper {
|
|
10
|
+
/* 100vh - toolbar height*/
|
|
11
|
+
height: calc(100vh - 93px);
|
|
12
12
|
display: flex;
|
|
13
13
|
flex-direction: column;
|
|
14
14
|
background: #fff;
|
|
15
|
-
border: 1px solid #EAECEF;
|
|
16
|
-
border-radius: 4px;
|
|
17
|
-
box-shadow: 0 2px 10px rgba(0, 0, 0, .12);
|
|
18
15
|
}
|
|
19
16
|
|
|
20
|
-
.
|
|
17
|
+
.sdoc-comment-drawer .sdoc-comment-resize-handler {
|
|
18
|
+
position: absolute;
|
|
19
|
+
left: 0;
|
|
20
|
+
height: 100%;
|
|
21
|
+
margin-right: -2px;
|
|
22
|
+
width: 6px;
|
|
23
|
+
cursor: ew-resize;
|
|
24
|
+
z-index: 103;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.sdoc-comment-drawer .sdoc-comment-resize-handler:hover {
|
|
28
|
+
border-left: 2px solid #d8d8d8;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.sdoc-comment-resize-handler .sdoc-comment-move-dragger {
|
|
32
|
+
display: none;
|
|
33
|
+
position: absolute;
|
|
34
|
+
top: 0px;
|
|
35
|
+
left: -3px;
|
|
36
|
+
width: 6px;
|
|
37
|
+
height: 30px;
|
|
38
|
+
border-radius: 3px;
|
|
39
|
+
background-color: #2674f8;
|
|
40
|
+
cursor: ew-resize;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.sdoc-comment-drawer .comments-panel-header {
|
|
21
44
|
padding: 0 16px;
|
|
22
45
|
height: 46px;
|
|
23
46
|
display: flex;
|
|
@@ -26,64 +49,65 @@
|
|
|
26
49
|
border-bottom: 1px solid #EAECEF;
|
|
27
50
|
}
|
|
28
51
|
|
|
29
|
-
.
|
|
52
|
+
.sdoc-comment-drawer .comments-panel-header .title {
|
|
30
53
|
color: #212529;
|
|
31
54
|
font-size: 16px;
|
|
32
55
|
font-weight: 500;
|
|
33
56
|
}
|
|
34
57
|
|
|
35
|
-
.
|
|
58
|
+
.sdoc-comment-drawer .comments-panel-header .comments-panel-header-right {
|
|
36
59
|
display: flex;
|
|
37
60
|
}
|
|
38
61
|
|
|
39
|
-
.
|
|
62
|
+
.sdoc-comment-drawer .comments-panel-header-right .sdoc-icon-btn:not(:last-child) {
|
|
40
63
|
margin-right: 4px;
|
|
41
64
|
}
|
|
42
65
|
|
|
43
|
-
.
|
|
66
|
+
.sdoc-comment-drawer .comments-panel-header .sdoc-icon-btn .sdocfont.sdoc-sm-close {
|
|
44
67
|
font-weight: 700;
|
|
45
68
|
}
|
|
46
69
|
|
|
47
|
-
.
|
|
70
|
+
.sdoc-comment-drawer .comments-panel-body {
|
|
48
71
|
flex: 1;
|
|
49
72
|
display: flex;
|
|
50
73
|
flex-direction: column;
|
|
51
74
|
min-height: 0;
|
|
52
|
-
position: relative;
|
|
53
75
|
background-color: #F5F5F5;
|
|
54
76
|
}
|
|
55
77
|
|
|
56
|
-
.
|
|
78
|
+
.sdoc-comment-drawer .comments-panel-body__header {
|
|
57
79
|
height: 80px;
|
|
58
80
|
display: flex;
|
|
59
81
|
flex-direction: column;
|
|
60
82
|
padding: 0 16px;
|
|
61
83
|
}
|
|
62
84
|
|
|
63
|
-
.
|
|
85
|
+
.sdoc-comment-drawer .comments-panel-body__header .comments-types-count {
|
|
64
86
|
height: 38px;
|
|
65
87
|
display: flex;
|
|
66
88
|
justify-content: space-between;
|
|
67
89
|
align-items: center;
|
|
68
90
|
padding: 16px 0;
|
|
91
|
+
margin-top: 10px;
|
|
92
|
+
border-top: 1px solid #e1e2e5;
|
|
69
93
|
}
|
|
70
94
|
|
|
71
|
-
.
|
|
95
|
+
.sdoc-comment-drawer .comments-panel-body__header .comment-type {
|
|
72
96
|
color: #212529;
|
|
73
97
|
font-size: 12px;
|
|
74
98
|
}
|
|
75
99
|
|
|
76
|
-
.
|
|
100
|
+
.sdoc-comment-drawer .comments-panel-body__header .comment-type {
|
|
77
101
|
color: #212529;
|
|
78
102
|
font-size: 12px;
|
|
79
103
|
}
|
|
80
104
|
|
|
81
|
-
.
|
|
105
|
+
.sdoc-comment-drawer .comments-panel-body__header .comment-count-tip {
|
|
82
106
|
color: #999;
|
|
83
107
|
font-size: 12px;
|
|
84
108
|
}
|
|
85
109
|
|
|
86
|
-
.
|
|
110
|
+
.sdoc-comment-drawer .comments-panel-body__content {
|
|
87
111
|
flex: 1;
|
|
88
112
|
display: flex;
|
|
89
113
|
flex-direction: column;
|
|
@@ -92,19 +116,19 @@
|
|
|
92
116
|
overflow: auto;
|
|
93
117
|
}
|
|
94
118
|
|
|
95
|
-
.
|
|
119
|
+
.sdoc-comment-drawer .comments-panel-body__content .sdoc-comment-list-container {
|
|
96
120
|
position: relative;
|
|
97
121
|
}
|
|
98
122
|
|
|
99
|
-
.
|
|
123
|
+
.sdoc-comment-drawer .comments-panel-body__content .comment-ui-container.active {
|
|
100
124
|
left: 0;
|
|
101
125
|
}
|
|
102
126
|
|
|
103
|
-
.
|
|
127
|
+
.sdoc-comment-drawer .comments-panel-body__content .comment-ui-container.sdoc-resolved {
|
|
104
128
|
background: #f5f5f5;
|
|
105
129
|
}
|
|
106
130
|
|
|
107
|
-
.
|
|
131
|
+
.sdoc-comment-drawer .comments-panel-body__content .comment-ui-container.active.sdoc-resolved {
|
|
108
132
|
background: #f5f5f5;
|
|
109
133
|
}
|
|
110
134
|
|
|
@@ -114,7 +138,7 @@
|
|
|
114
138
|
}
|
|
115
139
|
|
|
116
140
|
/* doc comment add editor */
|
|
117
|
-
.
|
|
141
|
+
.sdoc-comment-drawer .comments-panel-body .sdoc-doc-comment-editor-container {
|
|
118
142
|
position: absolute;
|
|
119
143
|
left: 16px;
|
|
120
144
|
width: calc(100% - 32px);
|
|
@@ -122,18 +146,18 @@
|
|
|
122
146
|
top: 78px;
|
|
123
147
|
}
|
|
124
148
|
|
|
125
|
-
.
|
|
149
|
+
.sdoc-comment-drawer .sdoc-doc-comment-editor-container .comment-ui-container.active {
|
|
126
150
|
left: 0;
|
|
127
151
|
margin-bottom: 0;
|
|
128
152
|
}
|
|
129
153
|
|
|
130
154
|
/* custom */
|
|
131
|
-
.
|
|
155
|
+
.sdoc-comment-drawer .sdoc-comment-list-container .comment-ui-container {
|
|
132
156
|
background-color: #FFF;
|
|
133
157
|
border: 1px solid #c7c7c7;
|
|
134
158
|
}
|
|
135
159
|
|
|
136
|
-
.
|
|
160
|
+
.sdoc-comment-drawer .sdoc-comment-list-container .comment-item-selected-text-container {
|
|
137
161
|
background-color: #F5F5F5;
|
|
138
162
|
border-bottom: 1px solid #c7c7c7;
|
|
139
163
|
}
|