@seafile/comment-editor 0.0.1-alpha.0 → 0.0.1-alpha.2
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/README.md +2 -4
- package/dist/basic-sdk/assets/css/layout.css +2 -2
- package/dist/basic-sdk/assets/css/sdoc-comment-editor-plugin.css +4 -4
- package/dist/basic-sdk/comment/components/comment-all-participants/index.css +8 -8
- package/dist/basic-sdk/comment/components/comment-editor.js +123 -7
- package/dist/basic-sdk/comment/components/comment-item-collapse-wrapper.js +2 -2
- package/dist/basic-sdk/comment/components/comment-item-content.js +11 -13
- package/dist/basic-sdk/comment/components/comment-item-wrapper.js +32 -36
- package/dist/basic-sdk/comment/components/comment-list.css +4 -4
- package/dist/basic-sdk/comment/components/comment-participants-editor/index.js +2 -2
- package/dist/basic-sdk/comment/components/global-comment/global-comment-body-header.js +5 -4
- package/dist/basic-sdk/comment/components/global-comment/global-comment-header.js +11 -4
- package/dist/basic-sdk/comment/components/global-comment/index.css +56 -54
- package/dist/basic-sdk/comment/components/global-comment/index.js +41 -36
- package/dist/basic-sdk/comment/hooks/comment-hooks/use-comment-mount.js +3 -4
- package/dist/basic-sdk/comment/hooks/notification-hooks/use-notification-mount.js +2 -6
- package/dist/basic-sdk/comment/index.js +2 -48
- package/dist/basic-sdk/constants/index.js +1 -2
- package/dist/basic-sdk/context.js +8 -8
- package/dist/basic-sdk/extension/plugins/link/menu/index.js +1 -1
- package/dist/basic-sdk/extension/plugins/mention/render-elem/participant-popover.js +3 -6
- package/dist/basic-sdk/extension/render/render-comment-editor-element.js +1 -1
- package/dist/basic-sdk/extension/toolbar/comment-editor-toolbar/index.js +3 -3
- package/dist/basic-sdk/extension/toolbar/comment-editor-toolbar/post-comment/index.js +2 -2
- package/dist/basic-sdk/hooks/use-comment.js +218 -0
- package/dist/basic-sdk/index.js +12 -32
- package/dist/basic-sdk/{right-panel → layout/comment-layout}/index.css +2 -2
- package/dist/basic-sdk/{right-panel → layout/comment-layout}/index.js +29 -28
- package/dist/basic-sdk/layout/comment-layout/resize-width/index.css +38 -0
- package/dist/basic-sdk/{right-panel → layout/comment-layout}/resize-width/index.js +3 -3
- package/dist/basic-sdk/layout/index.js +0 -7
- package/dist/index.js +12 -0
- package/dist/pages/seafile-comment-editor.js +19 -52
- package/package.json +2 -1
- package/dist/basic-sdk/comment/components/global-comment/global-comment-editor.js +0 -36
- package/dist/basic-sdk/comment/provider/comment-context-provider.js +0 -37
- package/dist/basic-sdk/comment/provider/index.js +0 -23
- package/dist/basic-sdk/comment/provider/notification-context-provider.js +0 -31
- package/dist/basic-sdk/comment/provider/participants-content-provider.js +0 -96
- package/dist/basic-sdk/editor/comment-article.js +0 -104
- package/dist/basic-sdk/editor/sdoc-comment-editor.js +0 -128
- package/dist/basic-sdk/editor/sdoc-editor.js +0 -50
- package/dist/basic-sdk/hooks/use-collaborators.js +0 -62
- package/dist/basic-sdk/hooks/use-plugins.js +0 -9
- package/dist/basic-sdk/layout/article-container.js +0 -89
- package/dist/basic-sdk/right-panel/resize-width/index.css +0 -38
- package/dist/hooks/index.js +0 -12
- package/dist/hooks/use-document.js +0 -75
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
.
|
|
1
|
+
.comment-drawer {
|
|
2
2
|
width: 100%;
|
|
3
3
|
height: 100%;
|
|
4
|
+
overflow: hidden;
|
|
5
|
+
border-left: 1px solid #d8d8d8;
|
|
4
6
|
}
|
|
5
7
|
|
|
6
|
-
.
|
|
8
|
+
.comment-drawer .comments-panel-wrapper {
|
|
7
9
|
/* 100vh - toolbar height*/
|
|
8
10
|
height: calc(100vh - 93px);
|
|
9
11
|
display: flex;
|
|
@@ -11,7 +13,7 @@
|
|
|
11
13
|
background: #fff;
|
|
12
14
|
}
|
|
13
15
|
|
|
14
|
-
.
|
|
16
|
+
.comment-drawer .sdoc-comment-resize-handler {
|
|
15
17
|
position: absolute;
|
|
16
18
|
left: 0;
|
|
17
19
|
height: 100%;
|
|
@@ -21,7 +23,7 @@
|
|
|
21
23
|
z-index: 103;
|
|
22
24
|
}
|
|
23
25
|
|
|
24
|
-
.
|
|
26
|
+
.comment-drawer .sdoc-comment-resize-handler:hover {
|
|
25
27
|
border-left: 1px solid #d8d8d8;
|
|
26
28
|
}
|
|
27
29
|
|
|
@@ -37,7 +39,7 @@
|
|
|
37
39
|
cursor: ew-resize;
|
|
38
40
|
}
|
|
39
41
|
|
|
40
|
-
.
|
|
42
|
+
.comment-drawer .comments-panel-header {
|
|
41
43
|
padding: 0 16px;
|
|
42
44
|
height: 46px;
|
|
43
45
|
display: flex;
|
|
@@ -46,33 +48,33 @@
|
|
|
46
48
|
border-bottom: 1px solid #EAECEF;
|
|
47
49
|
}
|
|
48
50
|
|
|
49
|
-
.
|
|
51
|
+
.comment-drawer .comments-panel-header .comments-panel-header-left {
|
|
50
52
|
display: flex;
|
|
51
53
|
}
|
|
52
54
|
|
|
53
|
-
.
|
|
55
|
+
.comment-drawer .comments-panel-header .comments-panel-header-left .title {
|
|
54
56
|
color: #212529;
|
|
55
57
|
font-size: 16px;
|
|
56
58
|
font-weight: 500;
|
|
57
59
|
}
|
|
58
60
|
|
|
59
|
-
.
|
|
61
|
+
.comment-drawer .comments-panel-header .comments-panel-header-left .goback {
|
|
60
62
|
margin-right: 4px;
|
|
61
63
|
}
|
|
62
64
|
|
|
63
|
-
.
|
|
65
|
+
.comment-drawer .comments-panel-header .comments-panel-header-right {
|
|
64
66
|
display: flex;
|
|
65
67
|
}
|
|
66
68
|
|
|
67
|
-
.
|
|
69
|
+
.comment-drawer .comments-panel-header-right .sdoc-icon-btn:not(:last-child) {
|
|
68
70
|
margin-right: 4px;
|
|
69
71
|
}
|
|
70
72
|
|
|
71
|
-
.
|
|
73
|
+
.comment-drawer .comments-panel-header .sdoc-icon-btn .sdocfont.sdoc-sm-close {
|
|
72
74
|
font-weight: 700;
|
|
73
75
|
}
|
|
74
76
|
|
|
75
|
-
.
|
|
77
|
+
.comment-drawer .comments-panel-body {
|
|
76
78
|
flex: 1;
|
|
77
79
|
display: flex;
|
|
78
80
|
flex-direction: column;
|
|
@@ -80,13 +82,13 @@
|
|
|
80
82
|
position: relative;
|
|
81
83
|
}
|
|
82
84
|
|
|
83
|
-
.
|
|
85
|
+
.comment-drawer .comments-panel-body__header {
|
|
84
86
|
display: flex;
|
|
85
87
|
flex-direction: column;
|
|
86
88
|
padding: 0 16px;
|
|
87
89
|
}
|
|
88
90
|
|
|
89
|
-
.
|
|
91
|
+
.comment-drawer .comments-panel-body__header .comments-types-count {
|
|
90
92
|
height: 38px;
|
|
91
93
|
display: flex;
|
|
92
94
|
justify-content: space-between;
|
|
@@ -94,22 +96,22 @@
|
|
|
94
96
|
padding: 16px 0;
|
|
95
97
|
}
|
|
96
98
|
|
|
97
|
-
.
|
|
99
|
+
.comment-drawer .comments-panel-body__header .comment-type {
|
|
98
100
|
color: #212529;
|
|
99
101
|
font-size: 12px;
|
|
100
102
|
}
|
|
101
103
|
|
|
102
|
-
.
|
|
104
|
+
.comment-drawer .comments-panel-body__header .comment-type {
|
|
103
105
|
color: #212529;
|
|
104
106
|
font-size: 12px;
|
|
105
107
|
}
|
|
106
108
|
|
|
107
|
-
.
|
|
109
|
+
.comment-drawer .comments-panel-body__header .comment-count-tip {
|
|
108
110
|
color: #999;
|
|
109
111
|
font-size: 12px;
|
|
110
112
|
}
|
|
111
113
|
|
|
112
|
-
.
|
|
114
|
+
.comment-drawer .comments-panel-body__content {
|
|
113
115
|
flex: 1;
|
|
114
116
|
display: flex;
|
|
115
117
|
flex-direction: column;
|
|
@@ -119,12 +121,12 @@
|
|
|
119
121
|
border-bottom: 1px solid #e1e2e5;
|
|
120
122
|
}
|
|
121
123
|
|
|
122
|
-
.
|
|
124
|
+
.comment-drawer .comments-panel-body__content .sdoc-comment-list-container {
|
|
123
125
|
position: relative;
|
|
124
126
|
margin-top: 0px;
|
|
125
127
|
}
|
|
126
128
|
|
|
127
|
-
.
|
|
129
|
+
.comment-drawer .comments-panel-body__content .comment-ui-container.active {
|
|
128
130
|
left: 0;
|
|
129
131
|
background: #fff;
|
|
130
132
|
box-shadow: unset;
|
|
@@ -136,41 +138,41 @@
|
|
|
136
138
|
}
|
|
137
139
|
|
|
138
140
|
/* doc comment add editor */
|
|
139
|
-
.
|
|
141
|
+
.comment-drawer .comments-panel-body .global-comment-input-wrapper {
|
|
140
142
|
padding: 0 16px;
|
|
141
143
|
width: 100%;
|
|
142
144
|
margin-bottom: 16px;
|
|
143
145
|
}
|
|
144
146
|
|
|
145
|
-
.
|
|
147
|
+
.comment-drawer .comments-panel-body .global-comment-input-wrapper .form-control[readonly] {
|
|
146
148
|
background-color: #fff;
|
|
147
149
|
}
|
|
148
150
|
|
|
149
|
-
.
|
|
151
|
+
.comment-drawer .comments-panel-body .global-comment-input-wrapper .form-control {
|
|
150
152
|
font-size: 14px;
|
|
151
153
|
font-weight: unset;
|
|
152
154
|
border: 1px solid #ececec;
|
|
153
155
|
}
|
|
154
156
|
|
|
155
|
-
.
|
|
157
|
+
.comment-drawer .comments-panel-body .global-comment-input-wrapper.active .form-control {
|
|
156
158
|
padding-top: 14px;
|
|
157
159
|
}
|
|
158
160
|
|
|
159
|
-
.
|
|
161
|
+
.comment-drawer .comments-panel-body .global-comment-input-wrapper .form-control:focus {
|
|
160
162
|
box-shadow: none;
|
|
161
163
|
border-color: #e1e2e5;
|
|
162
164
|
}
|
|
163
165
|
|
|
164
|
-
.
|
|
166
|
+
.comment-drawer .comments-panel-body .global-comment-input-wrapper .form-control::placeholder {
|
|
165
167
|
color: rgb(191, 191, 191);
|
|
166
168
|
}
|
|
167
169
|
|
|
168
|
-
.
|
|
170
|
+
.comment-drawer .comments-panel-body .global-comment-editor-container {
|
|
169
171
|
position: relative;
|
|
170
172
|
width: 100%;
|
|
171
173
|
}
|
|
172
174
|
|
|
173
|
-
.
|
|
175
|
+
.comment-drawer .global-comment-editor-container .global-comment-editor-content {
|
|
174
176
|
position: relative;
|
|
175
177
|
margin-bottom: 0;
|
|
176
178
|
padding: 0px;
|
|
@@ -182,16 +184,16 @@
|
|
|
182
184
|
}
|
|
183
185
|
|
|
184
186
|
/* custom */
|
|
185
|
-
.
|
|
187
|
+
.comment-drawer .sdoc-comment-list-container {
|
|
186
188
|
margin-top: 0px;
|
|
187
189
|
left: 0;
|
|
188
190
|
}
|
|
189
191
|
|
|
190
|
-
.
|
|
192
|
+
.comment-drawer .sdoc-comment-list-container .comment-collapse-wrapper {
|
|
191
193
|
cursor: pointer;
|
|
192
194
|
}
|
|
193
195
|
|
|
194
|
-
.
|
|
196
|
+
.comment-drawer .sdoc-comment-list-container .comment-ui-container {
|
|
195
197
|
background-color: #FFF;
|
|
196
198
|
margin-bottom: 0px;
|
|
197
199
|
box-shadow: none;
|
|
@@ -199,66 +201,66 @@
|
|
|
199
201
|
border-radius: 0px;
|
|
200
202
|
}
|
|
201
203
|
|
|
202
|
-
.
|
|
204
|
+
.comment-drawer .sdoc-comment-list-container .comment-ui-container:hover {
|
|
203
205
|
background-color: #f5f5f5;
|
|
204
206
|
}
|
|
205
207
|
|
|
206
|
-
.
|
|
208
|
+
.comment-drawer .sdoc-comment-list-container .comment-ui-container.active .comment-item:hover {
|
|
207
209
|
background-color: unset;
|
|
208
210
|
}
|
|
209
211
|
|
|
210
|
-
.
|
|
212
|
+
.comment-drawer .sdoc-comment-list-container .comment-item .comment-header .comment-author__avatar {
|
|
211
213
|
width: 24px;
|
|
212
214
|
height: 24px;
|
|
213
215
|
margin-top: -5px;
|
|
214
216
|
}
|
|
215
217
|
|
|
216
|
-
.
|
|
218
|
+
.comment-drawer .sdoc-comment-list-container .comment-item .comment-header .comment-author__avatar img {
|
|
217
219
|
border-radius: 50%;
|
|
218
220
|
}
|
|
219
221
|
|
|
220
|
-
.
|
|
222
|
+
.comment-drawer .sdoc-comment-list-container .comment-item .comment-content {
|
|
221
223
|
margin-left: 35px;
|
|
222
224
|
display: flex;
|
|
223
225
|
align-items: center;
|
|
224
226
|
}
|
|
225
227
|
|
|
226
|
-
.
|
|
228
|
+
.comment-drawer .sdoc-comment-list-container .comment-item .comment-footer .comments-count {
|
|
227
229
|
display: flex;
|
|
228
230
|
align-items: center;
|
|
229
231
|
position: relative;
|
|
230
232
|
}
|
|
231
233
|
|
|
232
|
-
.
|
|
234
|
+
.comment-drawer .sdoc-comment-list-container .comment-item .comment-footer .comments-count .comments-count-number {
|
|
233
235
|
margin-left: 8px;
|
|
234
236
|
margin-top: -2px;
|
|
235
237
|
}
|
|
236
238
|
|
|
237
|
-
.
|
|
239
|
+
.comment-drawer .sdoc-comment-list-container .comment-item .comment-footer .comment-author {
|
|
238
240
|
margin-left: 20px;
|
|
239
241
|
align-items: unset;
|
|
240
242
|
}
|
|
241
243
|
|
|
242
|
-
.
|
|
244
|
+
.comment-drawer .sdoc-comment-list-container .comment-item .comment-item-operation-wrapper .comment-operation {
|
|
243
245
|
width: 24px;
|
|
244
246
|
height: 24px;
|
|
245
247
|
}
|
|
246
248
|
|
|
247
|
-
.
|
|
249
|
+
.comment-drawer .sdoc-comment-list-container .comment-item .comment-footer .comment-author__avatar {
|
|
248
250
|
width: 16px;
|
|
249
251
|
height: 16px;
|
|
250
252
|
margin-top: -1px
|
|
251
253
|
}
|
|
252
254
|
|
|
253
|
-
.
|
|
255
|
+
.comment-drawer .sdoc-comment-list-container .comment-item .comment-footer .comment-author__avatar img {
|
|
254
256
|
border-radius: 50%;
|
|
255
257
|
}
|
|
256
258
|
|
|
257
|
-
.
|
|
259
|
+
.comment-drawer .sdoc-comment-list-container .comment-item .comment-footer .comment-author__latest-reply {
|
|
258
260
|
margin-left: 8px;
|
|
259
261
|
}
|
|
260
262
|
|
|
261
|
-
.
|
|
263
|
+
.comment-drawer .sdoc-comment-list-container .comment-item .comment-footer .comment-author__latest-reply p {
|
|
262
264
|
margin: 0px;
|
|
263
265
|
overflow: hidden;
|
|
264
266
|
text-overflow: ellipsis;
|
|
@@ -266,7 +268,7 @@
|
|
|
266
268
|
width: 220px;
|
|
267
269
|
}
|
|
268
270
|
|
|
269
|
-
.
|
|
271
|
+
.comment-drawer .sdoc-comment-list-container .comment-item-selected-text-container {
|
|
270
272
|
width: 100%;
|
|
271
273
|
height: auto;
|
|
272
274
|
color: #666666;
|
|
@@ -278,26 +280,26 @@
|
|
|
278
280
|
overflow: hidden;
|
|
279
281
|
}
|
|
280
282
|
|
|
281
|
-
.
|
|
283
|
+
.comment-drawer .sdoc-comment-list-container .detail-context-comment {
|
|
282
284
|
align-items: start !important;
|
|
283
285
|
}
|
|
284
286
|
|
|
285
|
-
.
|
|
287
|
+
.comment-drawer .sdoc-comment-list-container .detail-context-comment .sdoc-comment-quote {
|
|
286
288
|
padding-top: 1px;
|
|
287
289
|
}
|
|
288
290
|
|
|
289
|
-
.
|
|
291
|
+
.comment-drawer .sdoc-comment-list-container .context-comment-item-selected-text-container {
|
|
290
292
|
padding: 16px 16px 0 16px;
|
|
291
293
|
color: #666;
|
|
292
294
|
display: flex;
|
|
293
295
|
}
|
|
294
296
|
|
|
295
|
-
.
|
|
297
|
+
.comment-drawer .sdoc-comment-list-container .context-comment-item-selected-text-container .sdoc-comment-quote {
|
|
296
298
|
font-size: 12px;
|
|
297
299
|
padding-top: 1px;
|
|
298
300
|
}
|
|
299
301
|
|
|
300
|
-
.
|
|
302
|
+
.comment-drawer .sdoc-comment-list-container .context-comment-item-selected-text-container .context-comment-items {
|
|
301
303
|
display: flex;
|
|
302
304
|
flex-direction: column;
|
|
303
305
|
font-size: 14px;
|
|
@@ -308,19 +310,19 @@
|
|
|
308
310
|
}
|
|
309
311
|
|
|
310
312
|
/* global detail */
|
|
311
|
-
.
|
|
313
|
+
.comment-drawer .sdoc-comment-list-container .global-comment-item-detail-wrapper {
|
|
312
314
|
border-bottom: 0px
|
|
313
315
|
}
|
|
314
316
|
|
|
315
|
-
.
|
|
317
|
+
.comment-drawer .sdoc-comment-list-container .global-comment-item-detail-wrapper:hover {
|
|
316
318
|
background-color: #FFF;
|
|
317
319
|
}
|
|
318
320
|
|
|
319
|
-
.
|
|
321
|
+
.comment-drawer .sdoc-comment-list-container .global-comment-item-detail-wrapper .comment-operation .sdoc-confirm {
|
|
320
322
|
color: rgb(70, 77, 90);
|
|
321
323
|
font-weight: unset;
|
|
322
324
|
}
|
|
323
325
|
|
|
324
|
-
.
|
|
326
|
+
.comment-drawer .sdoc-comment-list-container .global-comment-item-detail-wrapper .comment-item:not(:last-child){
|
|
325
327
|
margin-bottom: 16px;
|
|
326
328
|
}
|
|
@@ -13,18 +13,17 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
13
13
|
var _dayjs = _interopRequireDefault(require("dayjs"));
|
|
14
14
|
var _context = _interopRequireDefault(require("../../../context"));
|
|
15
15
|
var _core = require("../../../extension/core");
|
|
16
|
+
var _useComment = require("../../../hooks/use-comment");
|
|
16
17
|
var _constants = require("../../constants");
|
|
17
|
-
var
|
|
18
|
+
var _commentEditor = _interopRequireDefault(require("../comment-editor"));
|
|
18
19
|
var _commentItemCollapseWrapper = _interopRequireDefault(require("../comment-item-collapse-wrapper"));
|
|
19
20
|
var _commentItemWrapper = _interopRequireDefault(require("../comment-item-wrapper"));
|
|
20
21
|
var _globalCommentBodyHeader = _interopRequireDefault(require("./global-comment-body-header"));
|
|
21
|
-
var _globalCommentEditor = _interopRequireDefault(require("./global-comment-editor"));
|
|
22
22
|
var _globalCommentHeader = _interopRequireDefault(require("./global-comment-header"));
|
|
23
23
|
require("./index.css");
|
|
24
24
|
const GlobalComment = _ref => {
|
|
25
25
|
let {
|
|
26
26
|
editor,
|
|
27
|
-
deleteUnseenNotifications,
|
|
28
27
|
t
|
|
29
28
|
} = _ref;
|
|
30
29
|
const contentRef = (0, _react.useRef)(null);
|
|
@@ -34,11 +33,14 @@ const GlobalComment = _ref => {
|
|
|
34
33
|
const [isScrollDisplayed, setIsScrollDisplayed] = (0, _react.useState)(false);
|
|
35
34
|
const [globalCommentContent, setGlobalCommentContent] = (0, _react.useState)(null);
|
|
36
35
|
const {
|
|
36
|
+
api,
|
|
37
37
|
commentList,
|
|
38
38
|
commentType,
|
|
39
|
+
dispatch,
|
|
39
40
|
setCommentType,
|
|
40
|
-
|
|
41
|
-
|
|
41
|
+
onCloseCommentPanel,
|
|
42
|
+
deleteUnseenNotifications
|
|
43
|
+
} = (0, _useComment.useComment)();
|
|
42
44
|
const detectScroll = (0, _react.useCallback)(() => {
|
|
43
45
|
if (!contentRef.current) return;
|
|
44
46
|
const contentContainer = contentRef.current;
|
|
@@ -70,27 +72,7 @@ const GlobalComment = _ref => {
|
|
|
70
72
|
behavior: 'smooth'
|
|
71
73
|
});
|
|
72
74
|
}, []);
|
|
73
|
-
const
|
|
74
|
-
const res = await _context.default.insertComment(comment);
|
|
75
|
-
const {
|
|
76
|
-
comment: returnComment
|
|
77
|
-
} = res.data;
|
|
78
|
-
const newComment = {
|
|
79
|
-
...comment,
|
|
80
|
-
id: returnComment.id,
|
|
81
|
-
user_name: returnComment.user_name,
|
|
82
|
-
avatar_url: returnComment.avatar_url,
|
|
83
|
-
replies: []
|
|
84
|
-
};
|
|
85
|
-
dispatch({
|
|
86
|
-
type: 'INSERT_COMMENT',
|
|
87
|
-
payload: {
|
|
88
|
-
element_id: elementId,
|
|
89
|
-
comment: newComment
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
}, [dispatch]);
|
|
93
|
-
const insertDocComment = (0, _react.useCallback)(commentDetail => {
|
|
75
|
+
const insertDocComment = (0, _react.useCallback)(async commentDetail => {
|
|
94
76
|
var _commentDetailRef$cur;
|
|
95
77
|
// Reply to a comment
|
|
96
78
|
if (activeCommentGroup && (_commentDetailRef$cur = commentDetailRef.current) !== null && _commentDetailRef$cur !== void 0 && _commentDetailRef$cur.insertContent) {
|
|
@@ -109,14 +91,31 @@ const GlobalComment = _ref => {
|
|
|
109
91
|
author: user.username,
|
|
110
92
|
updated_at: time
|
|
111
93
|
};
|
|
112
|
-
insertComment(
|
|
94
|
+
const res = await api.insertComment(comment);
|
|
95
|
+
const {
|
|
96
|
+
comment: returnComment
|
|
97
|
+
} = res.data;
|
|
98
|
+
const newComment = {
|
|
99
|
+
...comment,
|
|
100
|
+
id: returnComment.id,
|
|
101
|
+
user_name: returnComment.user_name,
|
|
102
|
+
avatar_url: returnComment.avatar_url,
|
|
103
|
+
replies: []
|
|
104
|
+
};
|
|
105
|
+
dispatch({
|
|
106
|
+
type: 'INSERT_COMMENT',
|
|
107
|
+
payload: {
|
|
108
|
+
element_id: elementId,
|
|
109
|
+
comment: newComment
|
|
110
|
+
}
|
|
111
|
+
});
|
|
113
112
|
detectScroll();
|
|
114
113
|
}
|
|
115
114
|
// After the comment is inserted, scroll to the bottom
|
|
116
115
|
setTimeout(() => {
|
|
117
116
|
onCommentsPanelBodyScroll('bottom');
|
|
118
117
|
}, 500);
|
|
119
|
-
}, [activeCommentGroup, detectScroll,
|
|
118
|
+
}, [activeCommentGroup, api, detectScroll, dispatch, onCommentsPanelBodyScroll]);
|
|
120
119
|
const hiddenCommentEditor = (0, _react.useCallback)(() => {
|
|
121
120
|
setShowEditor(false);
|
|
122
121
|
}, []);
|
|
@@ -141,11 +140,11 @@ const GlobalComment = _ref => {
|
|
|
141
140
|
}, [commentList, deleteUnseenNotifications]);
|
|
142
141
|
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');
|
|
143
142
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
144
|
-
className: "
|
|
143
|
+
className: "comment-drawer"
|
|
145
144
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
146
145
|
className: "comments-panel-wrapper"
|
|
147
146
|
}, /*#__PURE__*/_react.default.createElement(_globalCommentHeader.default, {
|
|
148
|
-
toggle:
|
|
147
|
+
toggle: onCloseCommentPanel,
|
|
149
148
|
activeCommentGroup: activeCommentGroup,
|
|
150
149
|
setCurrentCommentGroup: setCurrentCommentGroup
|
|
151
150
|
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -198,15 +197,21 @@ const GlobalComment = _ref => {
|
|
|
198
197
|
onFocus: () => {
|
|
199
198
|
setShowEditor(true);
|
|
200
199
|
}
|
|
201
|
-
}), showEditor && /*#__PURE__*/_react.default.createElement(
|
|
202
|
-
|
|
203
|
-
|
|
200
|
+
}), showEditor && /*#__PURE__*/_react.default.createElement("div", {
|
|
201
|
+
className: (0, _classnames.default)('global-comment-editor-container', 'sdoc-comment-list-container', {
|
|
202
|
+
'scrolled': isScrollDisplayed
|
|
203
|
+
})
|
|
204
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
205
|
+
className: "global-comment-editor-content"
|
|
206
|
+
}, /*#__PURE__*/_react.default.createElement(_commentEditor.default, {
|
|
204
207
|
type: activeCommentGroup ? 'replay' : 'comment',
|
|
205
|
-
|
|
206
|
-
|
|
208
|
+
commentContent: globalCommentContent,
|
|
209
|
+
hiddenUserInfo: true,
|
|
210
|
+
insertContent: insertDocComment,
|
|
211
|
+
hiddenComment: hiddenCommentEditor,
|
|
207
212
|
onContentChange: content => {
|
|
208
213
|
setGlobalCommentContent(content);
|
|
209
214
|
}
|
|
210
|
-
})))));
|
|
215
|
+
})))))));
|
|
211
216
|
};
|
|
212
217
|
var _default = exports.default = (0, _reactI18next.withTranslation)('sdoc-editor')(GlobalComment);
|
|
@@ -7,15 +7,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.useCommentsMount = void 0;
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
var _constants = require("../../../constants");
|
|
10
|
-
var _context = _interopRequireDefault(require("../../../context"));
|
|
11
10
|
var _eventBus = _interopRequireDefault(require("../../../utils/event-bus"));
|
|
12
|
-
const useCommentsMount = dispatch => {
|
|
11
|
+
const useCommentsMount = (dispatch, api) => {
|
|
13
12
|
const request = (0, _react.useCallback)(async () => {
|
|
14
13
|
dispatch({
|
|
15
14
|
type: 'FETCHING_STATE'
|
|
16
15
|
});
|
|
17
16
|
try {
|
|
18
|
-
const res = await
|
|
17
|
+
const res = await api.listComments();
|
|
19
18
|
const comments = res.data.comments;
|
|
20
19
|
dispatch({
|
|
21
20
|
type: 'RECEIVE_STATE',
|
|
@@ -34,7 +33,7 @@ const useCommentsMount = dispatch => {
|
|
|
34
33
|
type: 'REFETCHING_STATE'
|
|
35
34
|
});
|
|
36
35
|
try {
|
|
37
|
-
const res = await
|
|
36
|
+
const res = await api.listComments();
|
|
38
37
|
const comments = res.data.comments;
|
|
39
38
|
dispatch({
|
|
40
39
|
type: 'RECEIVE_STATE',
|
|
@@ -9,17 +9,13 @@ var _react = require("react");
|
|
|
9
9
|
var _reactI18next = require("react-i18next");
|
|
10
10
|
var _constants = require("../../../constants");
|
|
11
11
|
var _context = _interopRequireDefault(require("../../../context"));
|
|
12
|
-
var _useCollaborators = require("../../../hooks/use-collaborators");
|
|
13
12
|
var _eventBus = _interopRequireDefault(require("../../../utils/event-bus"));
|
|
14
13
|
var _constants2 = require("../../constants");
|
|
15
14
|
var _utils = require("../../utils");
|
|
16
|
-
const useNotificationsMount = dispatch => {
|
|
15
|
+
const useNotificationsMount = (dispatch, api, collaborators) => {
|
|
17
16
|
const {
|
|
18
17
|
t
|
|
19
18
|
} = (0, _reactI18next.useTranslation)('sdoc-editor');
|
|
20
|
-
const {
|
|
21
|
-
collaborators
|
|
22
|
-
} = (0, _useCollaborators.useCollaborators)();
|
|
23
19
|
const popupBrowserCommentNotification = (0, _react.useCallback)(notification => {
|
|
24
20
|
if (!notification) return;
|
|
25
21
|
const {
|
|
@@ -46,7 +42,7 @@ const useNotificationsMount = dispatch => {
|
|
|
46
42
|
type: _constants2.DOC_NOTIFICATION_REDUCER_TYPE.FETCHING
|
|
47
43
|
});
|
|
48
44
|
try {
|
|
49
|
-
const res = await
|
|
45
|
+
const res = await api.listUnseenNotifications();
|
|
50
46
|
const notifications = res.data.notifications;
|
|
51
47
|
dispatch({
|
|
52
48
|
type: _constants2.DOC_NOTIFICATION_REDUCER_TYPE.FETCHED,
|
|
@@ -1,66 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = void 0;
|
|
9
|
-
var _react =
|
|
10
|
-
var _context = _interopRequireDefault(require("../context"));
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
9
|
var _components = require("./components");
|
|
12
|
-
var _constants = require("./constants");
|
|
13
|
-
var _useCommentContext = require("./hooks/comment-hooks/use-comment-context");
|
|
14
|
-
var _notificationHooks = require("./hooks/notification-hooks");
|
|
15
|
-
var _utils = require("./utils");
|
|
16
10
|
const CommentWrapper = _ref => {
|
|
17
11
|
let {
|
|
18
12
|
type,
|
|
19
13
|
editor
|
|
20
14
|
} = _ref;
|
|
21
|
-
|
|
22
|
-
commentsInfo
|
|
23
|
-
} = (0, _useCommentContext.useCommentContext)();
|
|
24
|
-
console.log(commentsInfo);
|
|
25
|
-
const {
|
|
26
|
-
notificationsInfo,
|
|
27
|
-
dispatch: notificationDispatch
|
|
28
|
-
} = (0, _notificationHooks.useNotificationContext)();
|
|
29
|
-
const deleteUnseenNotifications = (0, _react.useCallback)(comment => {
|
|
30
|
-
let unseenCommentIds = [];
|
|
31
|
-
let unseenNotificationKeys = [];
|
|
32
|
-
const commentNotificationKey = (0, _utils.generatorNotificationKey)(comment.id);
|
|
33
|
-
const commentNotification = notificationsInfo.notifications_map[commentNotificationKey];
|
|
34
|
-
if (commentNotification) {
|
|
35
|
-
unseenNotificationKeys.push(commentNotification.key);
|
|
36
|
-
unseenCommentIds.push(commentNotification.id);
|
|
37
|
-
}
|
|
38
|
-
Array.isArray(comment.replies) && comment.replies.forEach(reply => {
|
|
39
|
-
const replyNotificationKey = (0, _utils.generatorNotificationKey)(reply.comment_id, reply.id);
|
|
40
|
-
const replyNotification = notificationsInfo.notifications_map[replyNotificationKey];
|
|
41
|
-
if (replyNotification) {
|
|
42
|
-
unseenNotificationKeys.push(replyNotification.key);
|
|
43
|
-
unseenCommentIds.push(replyNotification.id);
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
_context.default.deleteUnseenNotifications(unseenCommentIds).then(res => {
|
|
47
|
-
notificationDispatch({
|
|
48
|
-
type: _constants.DOC_NOTIFICATION_REDUCER_TYPE.DEL,
|
|
49
|
-
payload: unseenNotificationKeys
|
|
50
|
-
});
|
|
51
|
-
}).catch(error => {
|
|
52
|
-
//
|
|
53
|
-
});
|
|
54
|
-
}, [notificationDispatch, notificationsInfo.notifications_map]);
|
|
55
|
-
const {
|
|
56
|
-
isFreezed
|
|
57
|
-
} = _context.default.getSettings('isFreezed');
|
|
58
|
-
if (commentsInfo.isFetching) return null;
|
|
59
|
-
console.log(type);
|
|
60
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, type === 'editor' && !isFreezed && /*#__PURE__*/_react.default.createElement(_components.EditorComment, {
|
|
15
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, type === 'editor' && /*#__PURE__*/_react.default.createElement(_components.EditorComment, {
|
|
61
16
|
editor: editor
|
|
62
17
|
}), type === 'global' && /*#__PURE__*/_react.default.createElement(_components.GlobalComment, {
|
|
63
|
-
deleteUnseenNotifications: deleteUnseenNotifications,
|
|
64
18
|
editor: editor
|
|
65
19
|
}));
|
|
66
20
|
};
|
|
@@ -19,7 +19,7 @@ Object.defineProperty(exports, "PLUGIN_DISPLAY_TYPE", {
|
|
|
19
19
|
return _plugin.PLUGIN_DISPLAY_TYPE;
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
|
-
exports.Z_INDEX = exports.WIKI_OUTLINE = exports.
|
|
22
|
+
exports.Z_INDEX = exports.WIKI_OUTLINE = exports.WIKI_EDITOR = exports.SDOC_STORAGE = exports.REBASE_TYPES = exports.REBASE_TYPE = exports.REBASE_ORIGIN = exports.REBASE_MARK_KEY = exports.REBASE_MARKS = void 0;
|
|
23
23
|
var _keyCodes = _interopRequireDefault(require("./key-codes"));
|
|
24
24
|
var _plugin = require("./plugin");
|
|
25
25
|
var _Z_INDEX = _interopRequireWildcard(require("./z-index"));
|
|
@@ -72,7 +72,6 @@ const INTERNAL_EVENT = exports.INTERNAL_EVENT = {
|
|
|
72
72
|
};
|
|
73
73
|
const PAGE_EDIT_AREA_WIDTH = exports.PAGE_EDIT_AREA_WIDTH = 672; // 672 = 794 - 2[borderLeft + borderRight] - 120[paddingLeft + paddingRight]
|
|
74
74
|
const COMMENT_EDITOR_EDIT_AREA_WIDTH = exports.COMMENT_EDITOR_EDIT_AREA_WIDTH = 364;
|
|
75
|
-
const WIKI_EDITOR_EDIT_AREA_WIDTH = exports.WIKI_EDITOR_EDIT_AREA_WIDTH = 714;
|
|
76
75
|
const COMMENT_EDITOR = exports.COMMENT_EDITOR = 'comment_editor';
|
|
77
76
|
const WIKI_EDITOR = exports.WIKI_EDITOR = 'wiki_editor';
|
|
78
77
|
const DOCUMENT_PLUGIN_EDITOR = exports.DOCUMENT_PLUGIN_EDITOR = 'document_plugin_editor';
|
|
@@ -55,15 +55,15 @@ class Context {
|
|
|
55
55
|
this.api = null;
|
|
56
56
|
this.config = null;
|
|
57
57
|
}
|
|
58
|
-
|
|
58
|
+
init() {
|
|
59
59
|
this.initSettings(); // lazy init context class
|
|
60
|
-
const server = this.getSetting('serviceUrl');
|
|
61
|
-
const token = this.getSetting('accessToken');
|
|
62
|
-
this.api = new
|
|
63
|
-
const isOpenSocket = this.getSetting('isOpenSocket');
|
|
64
|
-
if (isOpenSocket) {
|
|
65
|
-
|
|
66
|
-
}
|
|
60
|
+
// const server = this.getSetting('serviceUrl');
|
|
61
|
+
// const token = this.getSetting('accessToken');
|
|
62
|
+
// this.api = new SeafileAPI(server, token);
|
|
63
|
+
// const isOpenSocket = this.getSetting('isOpenSocket');
|
|
64
|
+
// if (isOpenSocket) {
|
|
65
|
+
// this.sdocServerApi = new SDocServerApi(this.settings);
|
|
66
|
+
// }
|
|
67
67
|
}
|
|
68
68
|
getSettings() {
|
|
69
69
|
return this.settings;
|
|
@@ -44,7 +44,7 @@ const LinkMenu = _ref => {
|
|
|
44
44
|
isActive: false,
|
|
45
45
|
onMouseDown: openLinkDialog
|
|
46
46
|
};
|
|
47
|
-
menuProps.id = '
|
|
47
|
+
menuProps.id = 'comment-editor' + menuConfig.id;
|
|
48
48
|
return /*#__PURE__*/_react.default.createElement(_commons.MenuItem, menuProps);
|
|
49
49
|
}
|
|
50
50
|
|