@seafile/comment-editor 0.0.1-alpha.4 → 0.0.1-alpha.6

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.
Files changed (56) hide show
  1. package/dist/basic-sdk/assets/css/layout.css +1 -45
  2. package/dist/basic-sdk/comment/utils.js +39 -0
  3. package/dist/basic-sdk/editor/comment-editor.css +138 -0
  4. package/dist/basic-sdk/{comment/components → editor}/comment-editor.js +31 -25
  5. package/dist/basic-sdk/hooks/use-comment.js +12 -175
  6. package/dist/basic-sdk/index.js +3 -10
  7. package/dist/index.js +0 -12
  8. package/dist/pages/seafile-comment-editor.js +19 -8
  9. package/package.json +1 -1
  10. package/dist/assets/css/plugin-editor.css +0 -7
  11. package/dist/assets/css/simple-viewer.css +0 -6
  12. package/dist/basic-sdk/comment/components/comment-all-participants/index.css +0 -83
  13. package/dist/basic-sdk/comment/components/comment-all-participants/index.js +0 -67
  14. package/dist/basic-sdk/comment/components/comment-all-participants/participant-avatar.js +0 -43
  15. package/dist/basic-sdk/comment/components/comment-delete-popover.js +0 -80
  16. package/dist/basic-sdk/comment/components/comment-item-collapse-wrapper.js +0 -160
  17. package/dist/basic-sdk/comment/components/comment-item-content.js +0 -154
  18. package/dist/basic-sdk/comment/components/comment-item-reply.js +0 -124
  19. package/dist/basic-sdk/comment/components/comment-item-resolved-reply.js +0 -38
  20. package/dist/basic-sdk/comment/components/comment-item-wrapper.js +0 -364
  21. package/dist/basic-sdk/comment/components/comment-list.css +0 -422
  22. package/dist/basic-sdk/comment/components/comment-list.js +0 -216
  23. package/dist/basic-sdk/comment/components/comment-participants-editor/index.css +0 -132
  24. package/dist/basic-sdk/comment/components/comment-participants-editor/index.js +0 -69
  25. package/dist/basic-sdk/comment/components/comment-participants-editor/searched-collaborators.js +0 -62
  26. package/dist/basic-sdk/comment/components/comment-participants-editor/selected-participants.js +0 -48
  27. package/dist/basic-sdk/comment/components/editor-comment.js +0 -183
  28. package/dist/basic-sdk/comment/components/elements-comment-count/element-comment-count.js +0 -64
  29. package/dist/basic-sdk/comment/components/elements-comment-count/index.css +0 -29
  30. package/dist/basic-sdk/comment/components/elements-comment-count/index.js +0 -49
  31. package/dist/basic-sdk/comment/components/global-comment/global-comment-body-header.js +0 -88
  32. package/dist/basic-sdk/comment/components/global-comment/global-comment-header.js +0 -90
  33. package/dist/basic-sdk/comment/components/global-comment/index.css +0 -328
  34. package/dist/basic-sdk/comment/components/global-comment/index.js +0 -217
  35. package/dist/basic-sdk/comment/components/index.js +0 -21
  36. package/dist/basic-sdk/comment/components/style.css +0 -40
  37. package/dist/basic-sdk/comment/helper.js +0 -184
  38. package/dist/basic-sdk/comment/hooks/comment-hooks/use-comment-context.js +0 -20
  39. package/dist/basic-sdk/comment/hooks/comment-hooks/use-comment-list.js +0 -45
  40. package/dist/basic-sdk/comment/hooks/comment-hooks/use-comment-mount.js +0 -57
  41. package/dist/basic-sdk/comment/hooks/notification-hooks/index.js +0 -25
  42. package/dist/basic-sdk/comment/hooks/notification-hooks/use-notification-context.js +0 -20
  43. package/dist/basic-sdk/comment/hooks/notification-hooks/use-notification-mount.js +0 -70
  44. package/dist/basic-sdk/comment/hooks/use-participants.js +0 -26
  45. package/dist/basic-sdk/comment/index.js +0 -21
  46. package/dist/basic-sdk/comment/reducer/comment-reducer.js +0 -353
  47. package/dist/basic-sdk/comment/reducer/notification-reducer.js +0 -89
  48. package/dist/basic-sdk/comment/utils/get-event-transfer.js +0 -77
  49. package/dist/basic-sdk/comment/utils/index.js +0 -281
  50. package/dist/basic-sdk/comment/utils/notification-utils.js +0 -62
  51. package/dist/basic-sdk/socket/helpers.js +0 -299
  52. package/dist/basic-sdk/socket/index.js +0 -20
  53. package/dist/basic-sdk/socket/socket-client.js +0 -211
  54. package/dist/basic-sdk/socket/socket-manager.js +0 -386
  55. package/dist/basic-sdk/socket/with-socket-io.js +0 -73
  56. /package/dist/basic-sdk/comment/{constants/index.js → constants.js} +0 -0
@@ -1,88 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = void 0;
8
- var _react = _interopRequireWildcard(require("react"));
9
- var _reactI18next = require("react-i18next");
10
- var _reactstrap = require("reactstrap");
11
- var _useComment = require("../../../hooks/use-comment");
12
- var _mouseEvent = require("../../../utils/mouse-event");
13
- var _constants = require("../../constants");
14
- const CommentTypeDropdownItem = _ref => {
15
- let {
16
- type,
17
- setCommentType
18
- } = _ref;
19
- const {
20
- t
21
- } = (0, _reactI18next.useTranslation)('sdoc-editor');
22
- const handleCommentTypeChanged = (0, _react.useCallback)((event, type) => {
23
- (0, _mouseEvent.eventStopPropagation)(event);
24
- setCommentType(type);
25
-
26
- // eslint-disable-next-line react-hooks/exhaustive-deps
27
- }, []);
28
- return /*#__PURE__*/_react.default.createElement(_reactstrap.DropdownItem, {
29
- className: "sdoc-dropdown-menu-item",
30
- tag: 'div',
31
- onClick: event => handleCommentTypeChanged(event, type)
32
- }, t(type));
33
- };
34
- const GlobalCommentBodyHeader = () => {
35
- const {
36
- commentList,
37
- commentType,
38
- setCommentType
39
- } = (0, _useComment.useComment)();
40
- const {
41
- t
42
- } = (0, _reactI18next.useTranslation)('sdoc-editor');
43
- const [isDropdownOpen, setDropdownOpen] = (0, _react.useState)(false);
44
- let commentTip = null;
45
- if (commentList.length === 1) {
46
- commentTip = t('Total_1_comment');
47
- } else if (commentList.length > 1) {
48
- commentTip = t('Total_count_comments', {
49
- count: commentList.length
50
- });
51
- }
52
- const id = 'comment-type-controller';
53
- return /*#__PURE__*/_react.default.createElement("div", {
54
- className: "comments-panel-body__header"
55
- }, /*#__PURE__*/_react.default.createElement("div", {
56
- className: "comments-types-count"
57
- }, /*#__PURE__*/_react.default.createElement("div", {
58
- id: "comment-types",
59
- className: "comment-type"
60
- }, /*#__PURE__*/_react.default.createElement(_reactstrap.Dropdown, {
61
- isOpen: isDropdownOpen,
62
- toggle: () => setDropdownOpen(!isDropdownOpen)
63
- }, /*#__PURE__*/_react.default.createElement(_reactstrap.DropdownToggle, {
64
- tag: 'div',
65
- caret: true,
66
- className: "d-flex align-items-center justify-content-center"
67
- }, /*#__PURE__*/_react.default.createElement("div", {
68
- id: id
69
- }, t(commentType))), /*#__PURE__*/_react.default.createElement(_reactstrap.DropdownMenu, {
70
- className: "sdoc-dropdown-menu sdoc-comment-filter-dropdown",
71
- container: "comment-types"
72
- }, /*#__PURE__*/_react.default.createElement(CommentTypeDropdownItem, {
73
- type: _constants.COMMENT_TYPES.ALL,
74
- setCommentType: setCommentType
75
- }), /*#__PURE__*/_react.default.createElement(CommentTypeDropdownItem, {
76
- type: _constants.COMMENT_TYPES.DOC,
77
- setCommentType: setCommentType
78
- }), /*#__PURE__*/_react.default.createElement(CommentTypeDropdownItem, {
79
- type: _constants.COMMENT_TYPES.RESOLVED,
80
- setCommentType: setCommentType
81
- }), /*#__PURE__*/_react.default.createElement(CommentTypeDropdownItem, {
82
- type: _constants.COMMENT_TYPES.UNRESOLVED,
83
- setCommentType: setCommentType
84
- })))), /*#__PURE__*/_react.default.createElement("div", {
85
- className: "comment-count-tip"
86
- }, commentTip)));
87
- };
88
- var _default = exports.default = GlobalCommentBodyHeader;
@@ -1,90 +0,0 @@
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 _reactI18next = require("react-i18next");
11
- var _tooltip = _interopRequireDefault(require("../../../components/tooltip"));
12
- var _constants = require("../../../constants");
13
- var _useComment = require("../../../hooks/use-comment");
14
- var _eventBus = _interopRequireDefault(require("../../../utils/event-bus"));
15
- var _mouseEvent = require("../../../utils/mouse-event");
16
- const GlobalCommentHeader = _ref => {
17
- let {
18
- toggle,
19
- activeCommentGroup,
20
- setCurrentCommentGroup
21
- } = _ref;
22
- const {
23
- t
24
- } = (0, _reactI18next.useTranslation)('sdoc-editor');
25
- const panelHeaderRef = (0, _react.useRef)(null);
26
- const [isMounted, setIsMounted] = (0, _react.useState)(false);
27
- const {
28
- api,
29
- pluginEvent
30
- } = (0, _useComment.useComment)();
31
- const {
32
- readAllNotifications,
33
- listUnseenNotifications
34
- } = api;
35
- (0, _react.useEffect)(() => {
36
- if (panelHeaderRef.current) {
37
- setIsMounted(true);
38
- }
39
- }, []);
40
- const goBack = (0, _react.useCallback)(event => {
41
- (0, _mouseEvent.eventStopPropagation)(event);
42
- setCurrentCommentGroup(null);
43
- }, [setCurrentCommentGroup]);
44
- const toggleReadAll = (0, _react.useCallback)(async event => {
45
- (0, _mouseEvent.eventStopPropagation)(event);
46
- try {
47
- await readAllNotifications();
48
- const res = await listUnseenNotifications();
49
- const notifications = res.data.notifications;
50
- const eventBus = _eventBus.default.getInstance();
51
- eventBus.dispatch(pluginEvent.UNSEEN_NOTIFICATIONS_COUNT, notifications === null || notifications === void 0 ? void 0 : notifications.length);
52
- eventBus.dispatch(_constants.INTERNAL_EVENT.NEW_NOTIFICATION);
53
- eventBus.dispatch(_constants.INTERNAL_EVENT.CLEAR_NOTIFICATION);
54
- } catch (error) {
55
- //
56
- }
57
- }, [listUnseenNotifications, pluginEvent.UNSEEN_NOTIFICATIONS_COUNT, readAllNotifications]);
58
- return /*#__PURE__*/_react.default.createElement("div", {
59
- className: "comments-panel-header"
60
- }, /*#__PURE__*/_react.default.createElement("div", {
61
- className: "comments-panel-header-left"
62
- }, activeCommentGroup && /*#__PURE__*/_react.default.createElement("div", {
63
- className: "goback sdoc-icon-btn",
64
- onClick: goBack
65
- }, /*#__PURE__*/_react.default.createElement("i", {
66
- className: "sdocfont sdoc-previous-page",
67
- style: {
68
- transform: 'scale(1.2)'
69
- }
70
- })), /*#__PURE__*/_react.default.createElement("span", {
71
- className: "title"
72
- }, activeCommentGroup ? t('Comment_details') : t('Comments'))), /*#__PURE__*/_react.default.createElement("div", {
73
- ref: panelHeaderRef,
74
- className: "comments-panel-header-right"
75
- }, !activeCommentGroup && /*#__PURE__*/_react.default.createElement("div", {
76
- id: "sdoc-read-all-btn",
77
- className: "sdoc-icon-btn",
78
- onClick: toggleReadAll
79
- }, /*#__PURE__*/_react.default.createElement("i", {
80
- className: "sdocfont sdoc-all-read"
81
- }), isMounted && /*#__PURE__*/_react.default.createElement(_tooltip.default, {
82
- target: "sdoc-read-all-btn"
83
- }, t('Mark_all_as_read'))), /*#__PURE__*/_react.default.createElement("div", {
84
- className: "sdoc-icon-btn",
85
- onClick: toggle
86
- }, /*#__PURE__*/_react.default.createElement("i", {
87
- className: "sdocfont sdoc-sm-close"
88
- }))));
89
- };
90
- var _default = exports.default = GlobalCommentHeader;
@@ -1,328 +0,0 @@
1
- .comment-drawer {
2
- width: 100%;
3
- height: 100%;
4
- overflow: hidden;
5
- border-left: 1px solid #d8d8d8;
6
- }
7
-
8
- .comment-drawer .comments-panel-wrapper {
9
- /* 100vh - toolbar height*/
10
- height: calc(100vh - 93px);
11
- display: flex;
12
- flex-direction: column;
13
- background: #fff;
14
- }
15
-
16
- .comment-drawer .sdoc-comment-resize-handler {
17
- position: absolute;
18
- left: 0;
19
- height: 100%;
20
- margin-right: -2px;
21
- width: 6px;
22
- cursor: ew-resize;
23
- z-index: 103;
24
- }
25
-
26
- .comment-drawer .sdoc-comment-resize-handler:hover {
27
- border-left: 1px solid #d8d8d8;
28
- }
29
-
30
- .sdoc-comment-resize-handler .sdoc-comment-move-dragger {
31
- display: none;
32
- position: absolute;
33
- top: 0px;
34
- left: -4px;
35
- width: 6px;
36
- height: 30px;
37
- border-radius: 3px;
38
- background-color: #2674f8;
39
- cursor: ew-resize;
40
- }
41
-
42
- .comment-drawer .comments-panel-header {
43
- padding: 0 16px;
44
- height: 46px;
45
- display: flex;
46
- align-items: center;
47
- justify-content: space-between;
48
- border-bottom: 1px solid #EAECEF;
49
- }
50
-
51
- .comment-drawer .comments-panel-header .comments-panel-header-left {
52
- display: flex;
53
- }
54
-
55
- .comment-drawer .comments-panel-header .comments-panel-header-left .title {
56
- color: #212529;
57
- font-size: 16px;
58
- font-weight: 500;
59
- }
60
-
61
- .comment-drawer .comments-panel-header .comments-panel-header-left .goback {
62
- margin-right: 4px;
63
- }
64
-
65
- .comment-drawer .comments-panel-header .comments-panel-header-right {
66
- display: flex;
67
- }
68
-
69
- .comment-drawer .comments-panel-header-right .sdoc-icon-btn:not(:last-child) {
70
- margin-right: 4px;
71
- }
72
-
73
- .comment-drawer .comments-panel-header .sdoc-icon-btn .sdocfont.sdoc-sm-close {
74
- font-weight: 700;
75
- }
76
-
77
- .comment-drawer .comments-panel-body {
78
- flex: 1;
79
- display: flex;
80
- flex-direction: column;
81
- min-height: 0;
82
- position: relative;
83
- }
84
-
85
- .comment-drawer .comments-panel-body__header {
86
- display: flex;
87
- flex-direction: column;
88
- padding: 0 16px;
89
- }
90
-
91
- .comment-drawer .comments-panel-body__header .comments-types-count {
92
- height: 38px;
93
- display: flex;
94
- justify-content: space-between;
95
- align-items: center;
96
- padding: 16px 0;
97
- }
98
-
99
- .comment-drawer .comments-panel-body__header .comment-type {
100
- color: #212529;
101
- font-size: 12px;
102
- }
103
-
104
- .comment-drawer .comments-panel-body__header .comment-type {
105
- color: #212529;
106
- font-size: 12px;
107
- }
108
-
109
- .comment-drawer .comments-panel-body__header .comment-count-tip {
110
- color: #999;
111
- font-size: 12px;
112
- }
113
-
114
- .comment-drawer .comments-panel-body__content {
115
- flex: 1;
116
- display: flex;
117
- flex-direction: column;
118
- padding-top: 0px;
119
- margin-bottom: 16px;
120
- overflow: auto;
121
- border-bottom: 1px solid #e1e2e5;
122
- }
123
-
124
- .comment-drawer .comments-panel-body__content .sdoc-comment-list-container {
125
- position: relative;
126
- margin-top: 0px;
127
- }
128
-
129
- .comment-drawer .comments-panel-body__content .comment-ui-container.active {
130
- left: 0;
131
- background: #fff;
132
- box-shadow: unset;
133
- }
134
-
135
- .sdoc-dropdown-menu .dropdown-item {
136
- font-size: 14px;
137
- color: #212529;
138
- }
139
-
140
- /* doc comment add editor */
141
- .comment-drawer .comments-panel-body .global-comment-input-wrapper {
142
- padding: 0 16px;
143
- width: 100%;
144
- margin-bottom: 16px;
145
- }
146
-
147
- .comment-drawer .comments-panel-body .global-comment-input-wrapper .form-control[readonly] {
148
- background-color: #fff;
149
- }
150
-
151
- .comment-drawer .comments-panel-body .global-comment-input-wrapper .form-control {
152
- font-size: 14px;
153
- font-weight: unset;
154
- border: 1px solid #ececec;
155
- }
156
-
157
- .comment-drawer .comments-panel-body .global-comment-input-wrapper.active .form-control {
158
- padding-top: 14px;
159
- }
160
-
161
- .comment-drawer .comments-panel-body .global-comment-input-wrapper .form-control:focus {
162
- box-shadow: none;
163
- border-color: #e1e2e5;
164
- }
165
-
166
- .comment-drawer .comments-panel-body .global-comment-input-wrapper .form-control::placeholder {
167
- color: rgb(191, 191, 191);
168
- }
169
-
170
- .comment-drawer .comments-panel-body .global-comment-editor-container {
171
- position: relative;
172
- width: 100%;
173
- }
174
-
175
- .comment-drawer .global-comment-editor-container .global-comment-editor-content {
176
- position: relative;
177
- margin-bottom: 0;
178
- padding: 0px;
179
- left: 0;
180
- border: 0px;
181
- background-color: #FFF;
182
- box-shadow: none;
183
- border-radius: 0px;
184
- }
185
-
186
- /* custom */
187
- .comment-drawer .sdoc-comment-list-container {
188
- margin-top: 0px;
189
- left: 0;
190
- }
191
-
192
- .comment-drawer .sdoc-comment-list-container .comment-collapse-wrapper {
193
- cursor: pointer;
194
- }
195
-
196
- .comment-drawer .sdoc-comment-list-container .comment-ui-container {
197
- background-color: #FFF;
198
- margin-bottom: 0px;
199
- box-shadow: none;
200
- padding: 16px;
201
- border-radius: 0px;
202
- }
203
-
204
- .comment-drawer .sdoc-comment-list-container .comment-ui-container:hover {
205
- background-color: #f5f5f5;
206
- }
207
-
208
- .comment-drawer .sdoc-comment-list-container .comment-ui-container.active .comment-item:hover {
209
- background-color: unset;
210
- }
211
-
212
- .comment-drawer .sdoc-comment-list-container .comment-item .comment-header .comment-author__avatar {
213
- width: 24px;
214
- height: 24px;
215
- margin-top: -5px;
216
- }
217
-
218
- .comment-drawer .sdoc-comment-list-container .comment-item .comment-header .comment-author__avatar img {
219
- border-radius: 50%;
220
- }
221
-
222
- .comment-drawer .sdoc-comment-list-container .comment-item .comment-content {
223
- margin-left: 35px;
224
- display: flex;
225
- align-items: center;
226
- }
227
-
228
- .comment-drawer .sdoc-comment-list-container .comment-item .comment-footer .comments-count {
229
- display: flex;
230
- align-items: center;
231
- position: relative;
232
- }
233
-
234
- .comment-drawer .sdoc-comment-list-container .comment-item .comment-footer .comments-count .comments-count-number {
235
- margin-left: 8px;
236
- margin-top: -2px;
237
- }
238
-
239
- .comment-drawer .sdoc-comment-list-container .comment-item .comment-footer .comment-author {
240
- margin-left: 20px;
241
- align-items: unset;
242
- }
243
-
244
- .comment-drawer .sdoc-comment-list-container .comment-item .comment-item-operation-wrapper .comment-operation {
245
- width: 24px;
246
- height: 24px;
247
- }
248
-
249
- .comment-drawer .sdoc-comment-list-container .comment-item .comment-footer .comment-author__avatar {
250
- width: 16px;
251
- height: 16px;
252
- margin-top: -1px
253
- }
254
-
255
- .comment-drawer .sdoc-comment-list-container .comment-item .comment-footer .comment-author__avatar img {
256
- border-radius: 50%;
257
- }
258
-
259
- .comment-drawer .sdoc-comment-list-container .comment-item .comment-footer .comment-author__latest-reply {
260
- margin-left: 8px;
261
- }
262
-
263
- .comment-drawer .sdoc-comment-list-container .comment-item .comment-footer .comment-author__latest-reply p {
264
- margin: 0px;
265
- overflow: hidden;
266
- text-overflow: ellipsis;
267
- white-space: nowrap;
268
- width: 220px;
269
- }
270
-
271
- .comment-drawer .sdoc-comment-list-container .comment-item-selected-text-container {
272
- width: 100%;
273
- height: auto;
274
- color: #666666;
275
- display: flex;
276
- align-items: center;
277
- padding: 0px 0px 16px 0px;
278
- border-radius: 3px 3px 0 0;
279
- cursor: pointer;
280
- overflow: hidden;
281
- }
282
-
283
- .comment-drawer .sdoc-comment-list-container .detail-context-comment {
284
- align-items: start !important;
285
- }
286
-
287
- .comment-drawer .sdoc-comment-list-container .detail-context-comment .sdoc-comment-quote {
288
- padding-top: 1px;
289
- }
290
-
291
- .comment-drawer .sdoc-comment-list-container .context-comment-item-selected-text-container {
292
- padding: 16px 16px 0 16px;
293
- color: #666;
294
- display: flex;
295
- }
296
-
297
- .comment-drawer .sdoc-comment-list-container .context-comment-item-selected-text-container .sdoc-comment-quote {
298
- font-size: 12px;
299
- padding-top: 1px;
300
- }
301
-
302
- .comment-drawer .sdoc-comment-list-container .context-comment-item-selected-text-container .context-comment-items {
303
- display: flex;
304
- flex-direction: column;
305
- font-size: 14px;
306
- }
307
-
308
- .comments-panel-body__header .sdoc-comment-filter-dropdown.sdoc-dropdown-menu {
309
- border: 1px solid #dee3eb;
310
- }
311
-
312
- /* global detail */
313
- .comment-drawer .sdoc-comment-list-container .global-comment-item-detail-wrapper {
314
- border-bottom: 0px
315
- }
316
-
317
- .comment-drawer .sdoc-comment-list-container .global-comment-item-detail-wrapper:hover {
318
- background-color: #FFF;
319
- }
320
-
321
- .comment-drawer .sdoc-comment-list-container .global-comment-item-detail-wrapper .comment-operation .sdoc-confirm {
322
- color: rgb(70, 77, 90);
323
- font-weight: unset;
324
- }
325
-
326
- .comment-drawer .sdoc-comment-list-container .global-comment-item-detail-wrapper .comment-item:not(:last-child){
327
- margin-bottom: 16px;
328
- }