@seafile/sdoc-editor 0.5.12 → 0.5.14

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.
@@ -206,5 +206,9 @@ class SeafileAPI {
206
206
  data: params
207
207
  });
208
208
  }
209
+ readAllNotifications(docUuid) {
210
+ const url = "/api/v2.1/seadoc/notifications/".concat(docUuid, "/");
211
+ return this.req.put(url);
212
+ }
209
213
  }
210
214
  export default SeafileAPI;
@@ -1,6 +1,10 @@
1
1
  import React, { useCallback } from 'react';
2
2
  import { useTranslation } from 'react-i18next';
3
3
  import { eventStopPropagation } from '../../../utils/mouse-event';
4
+ import context from '../../../../context';
5
+ import { INTERNAL_EVENT } from '../../../constants';
6
+ import EventBus from '../../../utils/event-bus';
7
+ import { EXTERNAL_EVENT } from '../../../../constants';
4
8
  const GlobalCommentHeader = _ref => {
5
9
  let {
6
10
  toggle,
@@ -13,6 +17,19 @@ const GlobalCommentHeader = _ref => {
13
17
  eventStopPropagation(event);
14
18
  toggleGlobalCommentEditor();
15
19
  }, [toggleGlobalCommentEditor]);
20
+ const toggleReadAll = useCallback(async event => {
21
+ eventStopPropagation(event);
22
+ try {
23
+ await context.readAllNotifications();
24
+ const res = await context.listUnseenNotifications();
25
+ const notifications = res.data.notifications;
26
+ const eventBus = EventBus.getInstance();
27
+ eventBus.dispatch(INTERNAL_EVENT.UNSEEN_NOTIFICATIONS_COUNT, notifications === null || notifications === void 0 ? void 0 : notifications.length);
28
+ eventBus.dispatch(EXTERNAL_EVENT.NEW_NOTIFICATION);
29
+ } catch (error) {
30
+ //
31
+ }
32
+ }, []);
16
33
  return /*#__PURE__*/React.createElement("div", {
17
34
  className: "comments-panel-header"
18
35
  }, /*#__PURE__*/React.createElement("span", {
@@ -20,6 +37,11 @@ const GlobalCommentHeader = _ref => {
20
37
  }, t('Comments')), /*#__PURE__*/React.createElement("div", {
21
38
  className: "comments-panel-header-right"
22
39
  }, /*#__PURE__*/React.createElement("div", {
40
+ className: "sdoc-icon-btn",
41
+ onClick: toggleReadAll
42
+ }, /*#__PURE__*/React.createElement("i", {
43
+ className: "sdocfont sdoc-all-read"
44
+ })), /*#__PURE__*/React.createElement("div", {
23
45
  className: "sdoc-icon-btn",
24
46
  onClick: toggleADDComment
25
47
  }, /*#__PURE__*/React.createElement("i", {
@@ -57,7 +57,8 @@ export function Placeholder(props) {
57
57
  maxWidth: '100%',
58
58
  display: 'block',
59
59
  userSelect: 'none',
60
- textDecoration: 'none'
60
+ textDecoration: 'none',
61
+ left: '1px'
61
62
  }
62
63
  }, t(title));
63
64
  }
package/dist/context.js CHANGED
@@ -268,6 +268,10 @@ class Context {
268
268
  const docUuid = this.getDocUuid();
269
269
  return this.api.deleteUnseenNotifications(docUuid, notificationIds);
270
270
  }
271
+ readAllNotifications() {
272
+ const docUuid = this.getDocUuid();
273
+ return this.api.readAllNotifications(docUuid);
274
+ }
271
275
  }
272
276
  const context = new Context();
273
277
  export default context;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/sdoc-editor",
3
- "version": "0.5.12",
3
+ "version": "0.5.14",
4
4
  "private": false,
5
5
  "description": "This is a sdoc editor",
6
6
  "main": "dist/index.js",
@@ -14,12 +14,15 @@
14
14
  />
15
15
  <missing-glyph />
16
16
 
17
+ <<<<<<< HEAD
17
18
  <glyph glyph-name="sdoc-center-alignment" unicode="&#58984;" d="M560 896v-128H832v-320h-272v-128H928v-320H560v-128h-96v128H96V320h368v128H192V768h272V896h96zM832 224H192v-128h640v128zM736 672H288v-128h448V672z" horiz-adv-x="1024" />
18
19
 
19
20
  <glyph glyph-name="sdoc-bottom-alignment" unicode="&#58985;" d="M0-64v96h1024v-96H0z m448 192V832H128v-704h320z m-96 96H224V736h128v-512z m544-96V640H576v-512h320z m-96 96h-128V544h128v-320z" horiz-adv-x="1024" />
20
21
 
21
22
  <glyph glyph-name="sdoc-top-alignment" unicode="&#58986;" d="M0 832v-96h1024V832H0z m448-192v-704H128V640h320z m-96-96H224v-512h128V544z m544 96v-512H576V640h320z m-96-96h-128v-320h128V544z" horiz-adv-x="1024" />
22
23
 
24
+ =======
25
+ >>>>>>> 6ce93a64 (feat: read all)
23
26
  <glyph glyph-name="sdoc-all-read" unicode="&#58973;" d="M883.2 768h121.6c9.6 0 19.2-9.6 19.2-19.2v-60.8c0-6.4-9.6-16-19.2-16h-121.6c-9.6 0-19.2 9.6-19.2 19.2V748.8c0 9.6 9.6 19.2 19.2 19.2z m-284.8-704h406.4c12.8 0 22.4-9.6 22.4-19.2v-60.8c0-9.6-9.6-19.2-22.4-19.2H598.4c-12.8 0-22.4 9.6-22.4 19.2v60.8c0 9.6 9.6 19.2 22.4 19.2z m403.2 352c12.8 0 22.4-9.6 22.4-19.2v-60.8c0-9.6-9.6-19.2-22.4-19.2h-246.4c-12.8 0-22.4 9.6-22.4 19.2v60.8c0 9.6 9.6 19.2 22.4 19.2h246.4zM761.6 860.8c-3.2 3.2-9.6 3.2-12.8 3.2-6.4 0-9.6-3.2-12.8-9.6L304 70.4 67.2 256c-9.6 6.4-22.4 3.2-28.8-6.4L0 188.8c-3.2-9.6 0-22.4 9.6-28.8l336-256L819.2 803.2c6.4 9.6 3.2 22.4-6.4 28.8l-51.2 28.8z" horiz-adv-x="1027" />
24
27
 
25
28
  <glyph glyph-name="sdoc-freezed" unicode="&#58983;" d="M512 384m-512 0a512 512 0 1 1 1024 0 512 512 0 1 1-1024 0ZM316.8 716.8c118.4 70.4 265.6 70.4 384 3.2s192-195.2 192-332.8c0-137.6-73.6-265.6-195.2-332.8-182.4-105.6-416-41.6-521.6 140.8S134.4 608 316.8 716.8z m348.8-604.8c137.6 80 195.2 249.6 131.2 396.8L259.2 195.20000000000005c92.8-124.8 268.8-163.2 406.4-83.2zM352 652.8c-137.6-80-192-249.6-128-393.6l537.6 310.4c-96 128-272 163.2-409.6 83.2z" horiz-adv-x="1024" />