@seafile/sdoc-editor 0.2.29-beta → 0.2.30-beta
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/api/seafile-api.js +11 -18
- package/dist/basic-sdk/comment/components/comment-item-content.js +9 -1
- package/dist/basic-sdk/comment/components/comment-item-reply.js +9 -1
- package/dist/basic-sdk/comment/components/comment-item-wrapper.js +1 -1
- package/dist/basic-sdk/comment/components/comment-list.css +29 -0
- package/dist/basic-sdk/comment/components/comment-list.js +5 -3
- package/dist/basic-sdk/comment/components/editor-comment.js +5 -3
- package/dist/basic-sdk/comment/components/global-comment/index.js +10 -7
- package/dist/basic-sdk/comment/constants/index.js +8 -1
- package/dist/basic-sdk/comment/hooks/{use-comment-list.js → comment-hooks/use-comment-list.js} +1 -1
- package/dist/basic-sdk/comment/hooks/{use-comment-mount.js → comment-hooks/use-comment-mount.js} +36 -5
- package/dist/basic-sdk/comment/hooks/notification-hooks/index.js +2 -0
- package/dist/basic-sdk/comment/hooks/notification-hooks/use-notification-context.js +11 -0
- package/dist/basic-sdk/comment/hooks/notification-hooks/use-notification-mount.js +85 -0
- package/dist/basic-sdk/comment/index.js +46 -7
- package/dist/basic-sdk/comment/{comment-context-provider.js → provider/comment-context-provider.js} +3 -3
- package/dist/basic-sdk/comment/provider/index.js +8 -0
- package/dist/basic-sdk/comment/provider/notification-context-provider.js +26 -0
- package/dist/basic-sdk/comment/reducer/notification-reducer.js +70 -0
- package/dist/basic-sdk/comment/utils/index.js +2 -1
- package/dist/{utils → basic-sdk/comment/utils}/notification-utils.js +9 -3
- package/dist/basic-sdk/constants/index.js +5 -1
- package/dist/basic-sdk/editor/editable-article.js +1 -2
- package/dist/basic-sdk/editor/sdoc-editor.js +3 -2
- package/dist/components/doc-operations/{notifications-operation → comments-operation}/index.css +2 -2
- package/dist/components/doc-operations/comments-operation/index.js +23 -4
- package/dist/components/doc-operations/index.js +1 -2
- package/dist/components/doc-operations/revision-operations/view-changes/index.js +37 -2
- package/dist/context.js +7 -19
- package/dist/layout/index.js +1 -2
- package/dist/model/notification.js +6 -14
- package/dist/pages/simple-editor.js +3 -3
- package/dist/utils/index.js +1 -2
- package/package.json +3 -3
- package/public/locales/cs/sdoc-editor.json +4 -2
- package/public/locales/de/sdoc-editor.json +4 -2
- package/public/locales/en/sdoc-editor.json +1 -9
- package/public/locales/es/sdoc-editor.json +4 -2
- package/public/locales/fr/sdoc-editor.json +4 -2
- package/public/locales/it/sdoc-editor.json +4 -2
- package/public/locales/ru/sdoc-editor.json +6 -4
- package/public/locales/zh_CN/sdoc-editor.json +3 -3
- package/public/media/sdoc-editor-font/iconfont.eot +0 -0
- package/public/media/sdoc-editor-font/iconfont.svg +0 -2
- package/public/media/sdoc-editor-font/iconfont.ttf +0 -0
- package/public/media/sdoc-editor-font/iconfont.woff +0 -0
- package/public/media/sdoc-editor-font/iconfont.woff2 +0 -0
- package/public/media/sdoc-editor-font.css +0 -4
- package/dist/components/doc-operations/notifications-operation/index.js +0 -170
- package/dist/components/doc-operations/notifications-operation/notifications-dialog/index.css +0 -97
- package/dist/components/doc-operations/notifications-operation/notifications-dialog/index.js +0 -107
- package/dist/components/doc-operations/notifications-operation/notifications-dialog/notification.js +0 -25
- package/dist/components/doc-operations/notifications-operation/notifications-popover/index.css +0 -173
- package/dist/components/doc-operations/notifications-operation/notifications-popover/index.js +0 -78
- package/dist/components/doc-operations/notifications-operation/notifications-popover/notification.js +0 -54
- package/dist/layout/other.js +0 -8
- /package/dist/basic-sdk/comment/hooks/{use-comment-context.js → comment-hooks/use-comment-context.js} +0 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
3
|
+
import { DOC_NOTIFICATION_REDUCER_TYPE } from '../constants';
|
|
4
|
+
import { Notification } from '../../../model';
|
|
5
|
+
import { EventBus } from '../../';
|
|
6
|
+
import { INTERNAL_EVENT } from '../../constants';
|
|
7
|
+
export var initNotificationsInfo = {
|
|
8
|
+
isFetching: true,
|
|
9
|
+
notifications_map: {},
|
|
10
|
+
error: false
|
|
11
|
+
};
|
|
12
|
+
export var notificationReducer = function notificationReducer(state, action) {
|
|
13
|
+
switch (action.type) {
|
|
14
|
+
case DOC_NOTIFICATION_REDUCER_TYPE.FETCHING:
|
|
15
|
+
{
|
|
16
|
+
return initNotificationsInfo;
|
|
17
|
+
}
|
|
18
|
+
case DOC_NOTIFICATION_REDUCER_TYPE.FETCHED:
|
|
19
|
+
{
|
|
20
|
+
var notifications = action.payload;
|
|
21
|
+
var notificationsMap = {};
|
|
22
|
+
notifications.forEach(function (n) {
|
|
23
|
+
var newNotification = new Notification(n);
|
|
24
|
+
notificationsMap[newNotification.key] = newNotification;
|
|
25
|
+
});
|
|
26
|
+
return {
|
|
27
|
+
isFetching: false,
|
|
28
|
+
notifications_map: notificationsMap,
|
|
29
|
+
error: false
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
case DOC_NOTIFICATION_REDUCER_TYPE.FETCH_ERROR:
|
|
33
|
+
{
|
|
34
|
+
return {
|
|
35
|
+
isFetching: false,
|
|
36
|
+
notifications_map: {},
|
|
37
|
+
error: true
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
case DOC_NOTIFICATION_REDUCER_TYPE.ADD:
|
|
41
|
+
{
|
|
42
|
+
var notification = action.payload.notification;
|
|
43
|
+
var newNotification = new Notification(notification);
|
|
44
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
45
|
+
notifications_map: _objectSpread(_objectSpread({}, state.notifications_map), {}, _defineProperty({}, newNotification.key, newNotification))
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
case DOC_NOTIFICATION_REDUCER_TYPE.DEL:
|
|
49
|
+
{
|
|
50
|
+
var notificationKeys = action.payload;
|
|
51
|
+
var notifications_map = state.notifications_map;
|
|
52
|
+
if (Array.isArray(notificationKeys) && notificationKeys.length > 0) {
|
|
53
|
+
notificationKeys.forEach(function (notificationKey) {
|
|
54
|
+
if (notifications_map[notificationKey]) {
|
|
55
|
+
delete notifications_map[notificationKey];
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
var eventBus = EventBus.getInstance();
|
|
60
|
+
eventBus.dispatch(INTERNAL_EVENT.UNSEEN_NOTIFICATIONS_COUNT, Object.keys(notifications_map).length);
|
|
61
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
62
|
+
notifications_map: notifications_map
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
default:
|
|
66
|
+
{
|
|
67
|
+
return state;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
};
|
|
@@ -3,6 +3,7 @@ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
|
3
3
|
import { getEventTransfer } from '../../../utils';
|
|
4
4
|
import { COMMENT_URL_CLASSNAME } from '../constants';
|
|
5
5
|
import { KeyCodes } from '../../../constants';
|
|
6
|
+
import { createNotify, generatorNotificationKey } from './notification-utils';
|
|
6
7
|
export var searchCollaborators = function searchCollaborators(collaborators, searchValue) {
|
|
7
8
|
var validSearchValue = searchValue ? searchValue.trim().toLowerCase() : '';
|
|
8
9
|
var validCollaborators = Array.isArray(collaborators) && collaborators.length > 0 ? collaborators : [];
|
|
@@ -203,4 +204,4 @@ var CommentUtilities = /*#__PURE__*/_createClass(function CommentUtilities() {
|
|
|
203
204
|
}
|
|
204
205
|
};
|
|
205
206
|
});
|
|
206
|
-
export { CommentUtilities };
|
|
207
|
+
export { CommentUtilities, createNotify, generatorNotificationKey };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import dayjs from 'dayjs';
|
|
2
2
|
import relativeTime from 'dayjs/plugin/relativeTime';
|
|
3
|
-
import context from '
|
|
3
|
+
import context from '../../../context';
|
|
4
4
|
dayjs.extend(relativeTime);
|
|
5
5
|
var PERMISSION_GRANTED = 'granted';
|
|
6
6
|
var notify = function notify($title, $options) {
|
|
@@ -28,7 +28,7 @@ var notify = function notify($title, $options) {
|
|
|
28
28
|
notification.close();
|
|
29
29
|
};
|
|
30
30
|
};
|
|
31
|
-
var createNotify = function createNotify(title, options) {
|
|
31
|
+
export var createNotify = function createNotify(title, options) {
|
|
32
32
|
// Let's check if the browser supports notifications
|
|
33
33
|
if (!('Notification' in window)) {
|
|
34
34
|
return false;
|
|
@@ -43,4 +43,10 @@ var createNotify = function createNotify(title, options) {
|
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
45
|
};
|
|
46
|
-
export
|
|
46
|
+
export var generatorNotificationKey = function generatorNotificationKey(commentId) {
|
|
47
|
+
var replyId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
48
|
+
var validCommentId = commentId + '';
|
|
49
|
+
var validReplyId = replyId + '';
|
|
50
|
+
if (!validReplyId) return "sdoc_notification_".concat(validCommentId);
|
|
51
|
+
return "sdoc_notification_".concat(validCommentId, "_").concat(validReplyId);
|
|
52
|
+
};
|
|
@@ -7,8 +7,12 @@ export var INTERNAL_EVENT = {
|
|
|
7
7
|
OUTLINE_STATE_CHANGED: 'outline_state_changed',
|
|
8
8
|
RELOAD_IMAGE: 'reload_image',
|
|
9
9
|
ARTICLE_CLICK: 'hidden_comment',
|
|
10
|
-
UPDATE_TAG_VIEW: 'update_tag_view'
|
|
10
|
+
UPDATE_TAG_VIEW: 'update_tag_view',
|
|
11
|
+
COMMENT_LIST_CLICK: 'comment_list_click',
|
|
12
|
+
UNSEEN_NOTIFICATIONS_COUNT: 'unseen_notifications_count'
|
|
11
13
|
};
|
|
14
|
+
export var REVISION_DIFF_KEY = 'diff';
|
|
15
|
+
export var REVISION_DIFF_VALUE = '1';
|
|
12
16
|
export var PAGE_EDIT_AREA_WIDTH = 672; // 672 = 794 - 2[borderLeft + borderRight] - 120[paddingLeft + paddingRight]
|
|
13
17
|
|
|
14
18
|
export var MODIFY_TYPE = {
|
|
@@ -5,7 +5,6 @@ import { getAboveBlockNode, getNextNode, getPrevNode, isSelectionAtBlockEnd, isS
|
|
|
5
5
|
import EventProxy from '../utils/event-handler';
|
|
6
6
|
import { useCursors } from '../cursor/use-cursors';
|
|
7
7
|
import { INTERNAL_EVENT } from '../constants';
|
|
8
|
-
import CommentContextProvider from '../comment/comment-context-provider';
|
|
9
8
|
import CommentWrapper from '../comment';
|
|
10
9
|
import { usePipDecorate } from '../decorates';
|
|
11
10
|
import { getCursorPosition, getDomHeight, getDomMarginTop } from '../utils/dom-utils';
|
|
@@ -142,7 +141,7 @@ var EditableArticle = function EditableArticle(_ref) {
|
|
|
142
141
|
decorate: decorate,
|
|
143
142
|
onCut: eventProxy.onCut,
|
|
144
143
|
onCopy: eventProxy.onCopy
|
|
145
|
-
})), /*#__PURE__*/React.createElement(SideToolbar, null), isShowComment && /*#__PURE__*/React.createElement(
|
|
144
|
+
})), /*#__PURE__*/React.createElement(SideToolbar, null), isShowComment && /*#__PURE__*/React.createElement(CommentWrapper, null)));
|
|
146
145
|
};
|
|
147
146
|
EditableArticle.defaultProps = {
|
|
148
147
|
isShowComment: true
|
|
@@ -18,6 +18,7 @@ import { ColorProvider } from '../hooks/use-color-context';
|
|
|
18
18
|
import { HeaderToolbar } from '../extension';
|
|
19
19
|
import ReadOnlyArticle from '../views/readonly-article';
|
|
20
20
|
import { isMobile } from '../../utils';
|
|
21
|
+
import { CollaboratorsProvider } from '../../hooks';
|
|
21
22
|
var SdocEditor = forwardRef(function (_ref, ref) {
|
|
22
23
|
var document = _ref.document,
|
|
23
24
|
isReloading = _ref.isReloading;
|
|
@@ -115,7 +116,7 @@ var SdocEditor = forwardRef(function (_ref, ref) {
|
|
|
115
116
|
}
|
|
116
117
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(EditorContainer, {
|
|
117
118
|
editor: editor
|
|
118
|
-
}, /*#__PURE__*/React.createElement(ColorProvider, null, /*#__PURE__*/React.createElement(HeaderToolbar, {
|
|
119
|
+
}, /*#__PURE__*/React.createElement(CollaboratorsProvider, null, /*#__PURE__*/React.createElement(ColorProvider, null, /*#__PURE__*/React.createElement(HeaderToolbar, {
|
|
119
120
|
editor: editor
|
|
120
121
|
}), /*#__PURE__*/React.createElement(EditorContent, {
|
|
121
122
|
docValue: slateValue,
|
|
@@ -124,7 +125,7 @@ var SdocEditor = forwardRef(function (_ref, ref) {
|
|
|
124
125
|
editor: editor,
|
|
125
126
|
slateValue: slateValue,
|
|
126
127
|
updateSlateValue: _setSlateValue
|
|
127
|
-
})))), /*#__PURE__*/React.createElement(InsertElementDialog, {
|
|
128
|
+
}))))), /*#__PURE__*/React.createElement(InsertElementDialog, {
|
|
128
129
|
editor: editor
|
|
129
130
|
}));
|
|
130
131
|
});
|
package/dist/components/doc-operations/{notifications-operation → comments-operation}/index.css
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
.sdoc-notification-
|
|
1
|
+
.sdoc-notification-container .sdoc-notification-count {
|
|
2
2
|
position: absolute;
|
|
3
3
|
color: #fff;
|
|
4
4
|
font-size: 12px;
|
|
5
5
|
top: -7px;
|
|
6
|
-
right: -
|
|
6
|
+
right: -10px;
|
|
7
7
|
padding: 2px;
|
|
8
8
|
background: #fc6440;
|
|
9
9
|
border-radius: 50%;
|
|
@@ -1,16 +1,35 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
+
import React, { useCallback, useEffect, useState } from 'react';
|
|
2
3
|
import { EventBus } from '../../../basic-sdk';
|
|
3
4
|
import { eventStopPropagation } from '../../../basic-sdk/utils/mouse-event';
|
|
5
|
+
import { INTERNAL_EVENT } from '../../../basic-sdk/constants';
|
|
6
|
+
import './index.css';
|
|
4
7
|
export default function CommentsOperation() {
|
|
8
|
+
var _useState = useState(0),
|
|
9
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
10
|
+
unseenNotificationsCount = _useState2[0],
|
|
11
|
+
setUnseenNotificationsCount = _useState2[1];
|
|
5
12
|
var onCommentsToggle = useCallback(function (event) {
|
|
6
13
|
eventStopPropagation(event);
|
|
7
14
|
var eventBus = EventBus.getInstance();
|
|
8
|
-
eventBus.dispatch(
|
|
15
|
+
eventBus.dispatch(INTERNAL_EVENT.COMMENT_LIST_CLICK);
|
|
16
|
+
}, []);
|
|
17
|
+
useEffect(function () {
|
|
18
|
+
var eventBus = EventBus.getInstance();
|
|
19
|
+
var unsubscribeUnseenNotificationsCount = eventBus.subscribe(INTERNAL_EVENT.UNSEEN_NOTIFICATIONS_COUNT, function (count) {
|
|
20
|
+
return setUnseenNotificationsCount(count);
|
|
21
|
+
});
|
|
22
|
+
return function () {
|
|
23
|
+
unsubscribeUnseenNotificationsCount();
|
|
24
|
+
};
|
|
25
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
9
26
|
}, []);
|
|
10
27
|
return /*#__PURE__*/React.createElement("span", {
|
|
11
|
-
className: "op-item",
|
|
28
|
+
className: "op-item sdoc-notification-container",
|
|
12
29
|
onClick: onCommentsToggle
|
|
13
30
|
}, /*#__PURE__*/React.createElement("i", {
|
|
14
31
|
className: "sdocfont sdoc-comments"
|
|
15
|
-
})
|
|
32
|
+
}), unseenNotificationsCount > 0 && /*#__PURE__*/React.createElement("span", {
|
|
33
|
+
className: "sdoc-notification-count"
|
|
34
|
+
}, unseenNotificationsCount));
|
|
16
35
|
}
|
|
@@ -9,7 +9,6 @@ import CommentsOperation from './comments-operation';
|
|
|
9
9
|
import ShareOperation from './share-operation';
|
|
10
10
|
import TagOperation from './tag-operation';
|
|
11
11
|
import { isMobile } from '../../utils';
|
|
12
|
-
import NotificationOperation from './notifications-operation';
|
|
13
12
|
import './style.css';
|
|
14
13
|
var DocOperations = function DocOperations(_ref) {
|
|
15
14
|
var isShowChanges = _ref.isShowChanges,
|
|
@@ -34,6 +33,6 @@ var DocOperations = function DocOperations(_ref) {
|
|
|
34
33
|
handleViewChangesToggle: handleViewChangesToggle,
|
|
35
34
|
handleRevisionMerged: handleRevisionMerged,
|
|
36
35
|
handleRevisionPublished: handleRevisionPublished
|
|
37
|
-
}), !isPublished && /*#__PURE__*/React.createElement(TagOperation, null), !isPublished && /*#__PURE__*/React.createElement(
|
|
36
|
+
}), !isPublished && /*#__PURE__*/React.createElement(TagOperation, null), !isPublished && /*#__PURE__*/React.createElement(CommentsOperation, null), !isSdocRevision && /*#__PURE__*/React.createElement(ShareOperation, null), /*#__PURE__*/React.createElement(HistoryOperation, null), !isPublished && /*#__PURE__*/React.createElement(CollaboratorsOperation, null), !isSdocRevision && /*#__PURE__*/React.createElement(MoreOperations, null));
|
|
38
37
|
};
|
|
39
38
|
export default withTranslation('sdoc-editor')(DocOperations);
|
|
@@ -1,15 +1,50 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
|
|
2
|
+
import React, { useCallback, useEffect } from 'react';
|
|
2
3
|
import { useTranslation } from 'react-i18next';
|
|
3
4
|
import Switch from '../../../switch';
|
|
4
5
|
import Tooltip from '../../../tooltip';
|
|
6
|
+
import { REVISION_DIFF_KEY, REVISION_DIFF_VALUE } from '../../../../basic-sdk/constants';
|
|
5
7
|
import './index.css';
|
|
6
8
|
var ViewChanges = function ViewChanges(_ref) {
|
|
7
9
|
var isShowChanges = _ref.isShowChanges,
|
|
8
10
|
propsOnViewChangesToggle = _ref.onViewChangesToggle;
|
|
9
11
|
var _useTranslation = useTranslation(),
|
|
10
12
|
t = _useTranslation.t;
|
|
13
|
+
useEffect(function () {
|
|
14
|
+
var url = new URL(window.location.href);
|
|
15
|
+
var searchParams = new URLSearchParams(url.search);
|
|
16
|
+
if (!searchParams.has(REVISION_DIFF_KEY)) return;
|
|
17
|
+
var firstLoadValue = searchParams.get(REVISION_DIFF_KEY);
|
|
18
|
+
if (firstLoadValue === REVISION_DIFF_VALUE) {
|
|
19
|
+
propsOnViewChangesToggle(true);
|
|
20
|
+
}
|
|
21
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
22
|
+
}, []);
|
|
11
23
|
var onViewChangesToggle = useCallback(function () {
|
|
12
|
-
|
|
24
|
+
var nextIsShowChanges = !isShowChanges;
|
|
25
|
+
var url = new URL(window.location.href);
|
|
26
|
+
var searchParams = new URLSearchParams(url.search);
|
|
27
|
+
var newParamsString = '';
|
|
28
|
+
var _iterator = _createForOfIteratorHelper(searchParams.entries()),
|
|
29
|
+
_step;
|
|
30
|
+
try {
|
|
31
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
32
|
+
var item = _step.value;
|
|
33
|
+
if (item[0] !== REVISION_DIFF_KEY) {
|
|
34
|
+
newParamsString = newParamsString + "&".concat(item[0], "=").concat(item[1]);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
} catch (err) {
|
|
38
|
+
_iterator.e(err);
|
|
39
|
+
} finally {
|
|
40
|
+
_iterator.f();
|
|
41
|
+
}
|
|
42
|
+
if (!searchParams.has(REVISION_DIFF_KEY) && nextIsShowChanges) {
|
|
43
|
+
newParamsString = newParamsString + "&".concat(REVISION_DIFF_KEY, "=").concat(REVISION_DIFF_VALUE);
|
|
44
|
+
}
|
|
45
|
+
var newURL = "".concat(url.origin).concat(url.pathname).concat(newParamsString ? '/?' + newParamsString : '');
|
|
46
|
+
window.history.replaceState(null, null, newURL);
|
|
47
|
+
propsOnViewChangesToggle(nextIsShowChanges);
|
|
13
48
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
14
49
|
}, [isShowChanges, propsOnViewChangesToggle]);
|
|
15
50
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
package/dist/context.js
CHANGED
|
@@ -345,30 +345,18 @@ var Context = /*#__PURE__*/function () {
|
|
|
345
345
|
return this.api.updateRepoTag(docUuid, repoTagId, repoTagName, color);
|
|
346
346
|
}
|
|
347
347
|
|
|
348
|
-
//
|
|
348
|
+
// notification
|
|
349
349
|
}, {
|
|
350
|
-
key: "
|
|
351
|
-
value: function
|
|
350
|
+
key: "listUnseenNotifications",
|
|
351
|
+
value: function listUnseenNotifications() {
|
|
352
352
|
var docUuid = this.getDocUuid();
|
|
353
|
-
return this.api.
|
|
353
|
+
return this.api.listUnseenNotifications(docUuid);
|
|
354
354
|
}
|
|
355
355
|
}, {
|
|
356
|
-
key: "
|
|
357
|
-
value: function
|
|
356
|
+
key: "deleteUnseenNotifications",
|
|
357
|
+
value: function deleteUnseenNotifications(notificationIds) {
|
|
358
358
|
var docUuid = this.getDocUuid();
|
|
359
|
-
return this.api.
|
|
360
|
-
}
|
|
361
|
-
}, {
|
|
362
|
-
key: "deleteAllNotifications",
|
|
363
|
-
value: function deleteAllNotifications() {
|
|
364
|
-
var docUuid = this.getDocUuid();
|
|
365
|
-
return this.api.deleteAllNotifications(docUuid);
|
|
366
|
-
}
|
|
367
|
-
}, {
|
|
368
|
-
key: "markNotificationRead",
|
|
369
|
-
value: function markNotificationRead(notificationId) {
|
|
370
|
-
var docUuid = this.getDocUuid();
|
|
371
|
-
return this.api.markNotificationRead(docUuid, notificationId);
|
|
359
|
+
return this.api.deleteUnseenNotifications(docUuid, notificationIds);
|
|
372
360
|
}
|
|
373
361
|
}]);
|
|
374
362
|
return Context;
|
package/dist/layout/index.js
CHANGED
|
@@ -1,21 +1,13 @@
|
|
|
1
1
|
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
2
2
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
3
|
-
import
|
|
4
|
-
import dayjs from 'dayjs';
|
|
3
|
+
import { generatorNotificationKey } from '../basic-sdk/comment/utils';
|
|
5
4
|
var Notification = /*#__PURE__*/_createClass(function Notification(options) {
|
|
5
|
+
var _options$detail, _options$detail2, _options$detail3;
|
|
6
6
|
_classCallCheck(this, Notification);
|
|
7
7
|
this.id = options.id || '';
|
|
8
|
-
this.
|
|
9
|
-
this.
|
|
10
|
-
this.
|
|
11
|
-
this.
|
|
12
|
-
this.msgType = options.msg_type || '';
|
|
13
|
-
this.detail = options.detail.comment || options.detail.reply || '';
|
|
14
|
-
this.seen = options.seen;
|
|
15
|
-
var createdAt = options.created_at || '';
|
|
16
|
-
var lang = context.getSetting('lang');
|
|
17
|
-
var oldTime = new Date(createdAt).getTime();
|
|
18
|
-
dayjs.locale(lang);
|
|
19
|
-
this.time = dayjs(oldTime).fromNow();
|
|
8
|
+
this.comment_id = (options === null || options === void 0 ? void 0 : (_options$detail = options.detail) === null || _options$detail === void 0 ? void 0 : _options$detail.comment_id) || '';
|
|
9
|
+
this.reply_id = (options === null || options === void 0 ? void 0 : (_options$detail2 = options.detail) === null || _options$detail2 === void 0 ? void 0 : _options$detail2.reply_id) || '';
|
|
10
|
+
this.type = (options === null || options === void 0 ? void 0 : (_options$detail3 = options.detail) === null || _options$detail3 === void 0 ? void 0 : _options$detail3.msg_type) || '';
|
|
11
|
+
this.key = this.type !== 'reply' ? generatorNotificationKey(this.comment_id) : generatorNotificationKey(this.comment_id, this.reply_id);
|
|
20
12
|
});
|
|
21
13
|
export default Notification;
|
|
@@ -9,7 +9,7 @@ import context from '../context';
|
|
|
9
9
|
import ErrorBoundary from './error-boundary';
|
|
10
10
|
import { SDocEditor } from '../basic-sdk';
|
|
11
11
|
import { PublishedRevisionDiffViewer, RevisionDiffViewer } from '../basic-sdk/views';
|
|
12
|
-
import { useDocument
|
|
12
|
+
import { useDocument } from '../hooks';
|
|
13
13
|
import { resetWebTitle } from '../utils';
|
|
14
14
|
import '../assets/css/simple-editor.css';
|
|
15
15
|
var SimpleEditor = function SimpleEditor(_ref) {
|
|
@@ -110,7 +110,7 @@ var SimpleEditor = function SimpleEditor(_ref) {
|
|
|
110
110
|
className: "error-tip"
|
|
111
111
|
}, t(errorMessage)));
|
|
112
112
|
}
|
|
113
|
-
return /*#__PURE__*/React.createElement(ErrorBoundary, null, /*#__PURE__*/React.createElement(
|
|
113
|
+
return /*#__PURE__*/React.createElement(ErrorBoundary, null, /*#__PURE__*/React.createElement(Layout, null, /*#__PURE__*/React.createElement(Header, null, /*#__PURE__*/React.createElement(DocInfo, {
|
|
114
114
|
isStarred: isStarred,
|
|
115
115
|
isDraft: isDraft,
|
|
116
116
|
isPublished: isPublished,
|
|
@@ -133,6 +133,6 @@ var SimpleEditor = function SimpleEditor(_ref) {
|
|
|
133
133
|
}), !isPublished && isShowChanges && /*#__PURE__*/React.createElement(RevisionDiffViewer, {
|
|
134
134
|
revisionContent: revisionContent,
|
|
135
135
|
didMountCallback: setDiffChanges
|
|
136
|
-
}))))
|
|
136
|
+
}))));
|
|
137
137
|
};
|
|
138
138
|
export default withTranslation('sdoc-editor')(SimpleEditor);
|
package/dist/utils/index.js
CHANGED
|
@@ -3,7 +3,6 @@ import LocalStorage from './local-storage-utils';
|
|
|
3
3
|
import context from '../context';
|
|
4
4
|
import getEventTransfer from './get-event-transfer';
|
|
5
5
|
import * as Hotkey from './hotkey';
|
|
6
|
-
import { createNotify } from './notification-utils';
|
|
7
6
|
export var getDirPath = function getDirPath(path) {
|
|
8
7
|
var dir = path.slice(0, path.lastIndexOf('/'));
|
|
9
8
|
if (dir === '') {
|
|
@@ -110,4 +109,4 @@ export var getSelectionCoords = function getSelectionCoords() {
|
|
|
110
109
|
y: y
|
|
111
110
|
};
|
|
112
111
|
};
|
|
113
|
-
export { DateUtils, LocalStorage, getEventTransfer, Hotkey
|
|
112
|
+
export { DateUtils, LocalStorage, getEventTransfer, Hotkey };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seafile/sdoc-editor",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.30beta",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "This is a sdoc editor",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"@seafile/slate-history": "0.86.2",
|
|
11
11
|
"@seafile/slate-hyperscript": "0.81.7",
|
|
12
12
|
"@seafile/slate-react": "0.92.6",
|
|
13
|
-
"axios": "1.
|
|
13
|
+
"axios": "^1.6.0",
|
|
14
14
|
"classnames": "2.3.2",
|
|
15
15
|
"copy-to-clipboard": "^3.3.3",
|
|
16
16
|
"dayjs": "1.11.2",
|
|
@@ -115,7 +115,7 @@
|
|
|
115
115
|
"resolve": "1.12.0",
|
|
116
116
|
"resolve-url-loader": "3.1.5",
|
|
117
117
|
"sass-loader": "13.3.2",
|
|
118
|
-
"seafile-js": "0.2.
|
|
118
|
+
"seafile-js": "0.2.216",
|
|
119
119
|
"style-loader": "^1.0.1",
|
|
120
120
|
"terser-webpack-plugin": "4.2.3",
|
|
121
121
|
"ts-pnp": "1.1.4",
|
|
@@ -384,7 +384,6 @@
|
|
|
384
384
|
"Merge_tip": "There are conflicts in the documents. Do you want to merge them?",
|
|
385
385
|
"Has_conflict_before_view_changes_tip": "There are conflicts in the document. Please resolve the conflict before viewing the changes!",
|
|
386
386
|
"Has_been_removed_tip": "Document has been removed, please view other documents.",
|
|
387
|
-
"Revision_created": "Revision {{id}} created",
|
|
388
387
|
"Checking": "Checking...",
|
|
389
388
|
"Publishing": "Publishing...",
|
|
390
389
|
"Inline": "Inline",
|
|
@@ -408,5 +407,8 @@
|
|
|
408
407
|
"Add_option": "Vytvořit nový štítek",
|
|
409
408
|
"Find_an_option": "Search tags",
|
|
410
409
|
"Copy_link_of_section": "Copy link of section",
|
|
411
|
-
"revision": "revision"
|
|
410
|
+
"revision": "revision",
|
|
411
|
+
"xxx_added_a_new_comment": "{{author}} added a new comment",
|
|
412
|
+
"xxx_added_a_reply": "{{author}} added a reply",
|
|
413
|
+
"New": "Nový"
|
|
412
414
|
}
|
|
@@ -384,7 +384,6 @@
|
|
|
384
384
|
"Merge_tip": "There are conflicts in the documents. Do you want to merge them?",
|
|
385
385
|
"Has_conflict_before_view_changes_tip": "There are conflicts in the document. Please resolve the conflict before viewing the changes!",
|
|
386
386
|
"Has_been_removed_tip": "Document has been removed, please view other documents.",
|
|
387
|
-
"Revision_created": "Revision {{id}} created",
|
|
388
387
|
"Checking": "Checking...",
|
|
389
388
|
"Publishing": "Publishing...",
|
|
390
389
|
"Inline": "Inline",
|
|
@@ -408,5 +407,8 @@
|
|
|
408
407
|
"Add_option": "Neues Tag erstellen",
|
|
409
408
|
"Find_an_option": "Search tags",
|
|
410
409
|
"Copy_link_of_section": "Copy link of section",
|
|
411
|
-
"revision": "revision"
|
|
410
|
+
"revision": "revision",
|
|
411
|
+
"xxx_added_a_new_comment": "{{author}} added a new comment",
|
|
412
|
+
"xxx_added_a_reply": "{{author}} added a reply",
|
|
413
|
+
"New": "Erstellen"
|
|
412
414
|
}
|
|
@@ -410,13 +410,5 @@
|
|
|
410
410
|
"revision": "revision",
|
|
411
411
|
"xxx_added_a_new_comment": "{{author}} added a new comment",
|
|
412
412
|
"xxx_added_a_reply": "{{author}} added a reply",
|
|
413
|
-
"
|
|
414
|
-
"Added_a_reply": "Added a reply",
|
|
415
|
-
"All_notifications": "All notifications",
|
|
416
|
-
"No_notification": "No notification",
|
|
417
|
-
"Mark_all_as_read": "Mark all as read",
|
|
418
|
-
"Delete_all_notifications": "Delete all notifications",
|
|
419
|
-
"View_all_notifications": "View all notifications",
|
|
420
|
-
"Notification": "Notification",
|
|
421
|
-
"Update_date": "Update date"
|
|
413
|
+
"New": "New"
|
|
422
414
|
}
|
|
@@ -384,7 +384,6 @@
|
|
|
384
384
|
"Merge_tip": "There are conflicts in the documents. Do you want to merge them?",
|
|
385
385
|
"Has_conflict_before_view_changes_tip": "There are conflicts in the document. Please resolve the conflict before viewing the changes!",
|
|
386
386
|
"Has_been_removed_tip": "Document has been removed, please view other documents.",
|
|
387
|
-
"Revision_created": "Revision {{id}} created",
|
|
388
387
|
"Checking": "Checking...",
|
|
389
388
|
"Publishing": "Publishing...",
|
|
390
389
|
"Inline": "Inline",
|
|
@@ -408,5 +407,8 @@
|
|
|
408
407
|
"Add_option": "Cear una nueva etiqueta",
|
|
409
408
|
"Find_an_option": "Search tags",
|
|
410
409
|
"Copy_link_of_section": "Copy link of section",
|
|
411
|
-
"revision": "revision"
|
|
410
|
+
"revision": "revision",
|
|
411
|
+
"xxx_added_a_new_comment": "{{author}} added a new comment",
|
|
412
|
+
"xxx_added_a_reply": "{{author}} added a reply",
|
|
413
|
+
"New": "Nuevo"
|
|
412
414
|
}
|
|
@@ -384,7 +384,6 @@
|
|
|
384
384
|
"Merge_tip": "There are conflicts in the documents. Do you want to merge them?",
|
|
385
385
|
"Has_conflict_before_view_changes_tip": "There are conflicts in the document. Please resolve the conflict before viewing the changes!",
|
|
386
386
|
"Has_been_removed_tip": "Document has been removed, please view other documents.",
|
|
387
|
-
"Revision_created": "Revision {{id}} created",
|
|
388
387
|
"Checking": "Checking...",
|
|
389
388
|
"Publishing": "Publishing...",
|
|
390
389
|
"Inline": "Inline",
|
|
@@ -408,5 +407,8 @@
|
|
|
408
407
|
"Add_option": "Créer un nouveau Tag",
|
|
409
408
|
"Find_an_option": "Search tags",
|
|
410
409
|
"Copy_link_of_section": "Copy link of section",
|
|
411
|
-
"revision": "revision"
|
|
410
|
+
"revision": "revision",
|
|
411
|
+
"xxx_added_a_new_comment": "{{author}} added a new comment",
|
|
412
|
+
"xxx_added_a_reply": "{{author}} added a reply",
|
|
413
|
+
"New": "Créer"
|
|
412
414
|
}
|
|
@@ -384,7 +384,6 @@
|
|
|
384
384
|
"Merge_tip": "There are conflicts in the documents. Do you want to merge them?",
|
|
385
385
|
"Has_conflict_before_view_changes_tip": "There are conflicts in the document. Please resolve the conflict before viewing the changes!",
|
|
386
386
|
"Has_been_removed_tip": "Document has been removed, please view other documents.",
|
|
387
|
-
"Revision_created": "Revision {{id}} created",
|
|
388
387
|
"Checking": "Checking...",
|
|
389
388
|
"Publishing": "Publishing...",
|
|
390
389
|
"Inline": "Inline",
|
|
@@ -408,5 +407,8 @@
|
|
|
408
407
|
"Add_option": "Crea un nuovo tag",
|
|
409
408
|
"Find_an_option": "Search tags",
|
|
410
409
|
"Copy_link_of_section": "Copy link of section",
|
|
411
|
-
"revision": "revision"
|
|
410
|
+
"revision": "revision",
|
|
411
|
+
"xxx_added_a_new_comment": "{{author}} added a new comment",
|
|
412
|
+
"xxx_added_a_reply": "{{author}} added a reply",
|
|
413
|
+
"New": "Nuovo"
|
|
412
414
|
}
|
|
@@ -378,13 +378,12 @@
|
|
|
378
378
|
"Keep_both_modification": "Сохранить обе модификации",
|
|
379
379
|
"Tip": "Совет",
|
|
380
380
|
"Rebase_delete_no_change_revision_tip": "Редакция не внесла никаких изменений по сравнению с исходным документом. Вы хотите удалить эту редакцию?",
|
|
381
|
-
"Has_been_replaced_tip": "
|
|
382
|
-
"Has_been_published_tip": "
|
|
381
|
+
"Has_been_replaced_tip": "Содержимое документа было заменено. Обновите страницу",
|
|
382
|
+
"Has_been_published_tip": "Версия опубликована",
|
|
383
383
|
"Has_conflict_before_publish_tip": "В документе есть конфликты, разрешите их перед публикацией!",
|
|
384
384
|
"Merge_tip": "В документах есть конфликты. Вы хотите объединить их?",
|
|
385
385
|
"Has_conflict_before_view_changes_tip": "В документе есть конфликты. Разрешите конфликт перед просмотром изменений!",
|
|
386
386
|
"Has_been_removed_tip": "Документ удален, посмотрите другие документы.",
|
|
387
|
-
"Revision_created": "Версия {{id}} создана",
|
|
388
387
|
"Checking": "Проверка...",
|
|
389
388
|
"Publishing": "Публикация...",
|
|
390
389
|
"Inline": "Встроенный",
|
|
@@ -408,5 +407,8 @@
|
|
|
408
407
|
"Add_option": "Создать новый тег",
|
|
409
408
|
"Find_an_option": "Поиск тегов",
|
|
410
409
|
"Copy_link_of_section": "Копировать ссылку на раздел",
|
|
411
|
-
"revision": "
|
|
410
|
+
"revision": "версия",
|
|
411
|
+
"xxx_added_a_new_comment": "{{author}} добавил новый комментарий",
|
|
412
|
+
"xxx_added_a_reply": "{{author}} добавил ответ",
|
|
413
|
+
"New": "Новый"
|
|
412
414
|
}
|
|
@@ -384,7 +384,6 @@
|
|
|
384
384
|
"Merge_tip": "文档有冲突,是否合并?",
|
|
385
385
|
"Has_conflict_before_view_changes_tip": "文档有冲突,请解决冲突后再查看更改!",
|
|
386
386
|
"Has_been_removed_tip": "文档已经被删除,请查看其他文档",
|
|
387
|
-
"Revision_created": "已创建修订稿 {{id}}",
|
|
388
387
|
"Checking": "检查中...",
|
|
389
388
|
"Publishing": "发布中...",
|
|
390
389
|
"Inline": "嵌入行内",
|
|
@@ -409,6 +408,7 @@
|
|
|
409
408
|
"Find_an_option": "查找标签",
|
|
410
409
|
"Copy_link_of_section": "拷贝章节的链接",
|
|
411
410
|
"revision": "修订稿",
|
|
412
|
-
"xxx_added_a_new_comment": "{{author}}添加了一条新评论",
|
|
413
|
-
"xxx_added_a_reply": "{{author}}添加了一条回复"
|
|
411
|
+
"xxx_added_a_new_comment": "{{author}} 添加了一条新评论",
|
|
412
|
+
"xxx_added_a_reply": "{{author}} 添加了一条回复",
|
|
413
|
+
"New": "新"
|
|
414
414
|
}
|
|
Binary file
|
|
@@ -14,8 +14,6 @@
|
|
|
14
14
|
/>
|
|
15
15
|
<missing-glyph />
|
|
16
16
|
|
|
17
|
-
<glyph glyph-name="sdoc-notification" unicode="" d="M931.2 80c-3.2 80-44.8 150.4-105.6 198.4V496c0 124.8-89.6 233.6-208 256v6.4C617.6 816 572.8 864 515.2 864S409.6 816 409.6 758.4v-6.4c-118.4-25.6-208-131.2-208-256v-217.6C137.6 233.6 99.2 160 96 80h835.2zM492.8-96h25.6c67.2 0 124.8 51.2 134.4 118.4H377.6c9.6-67.2 64-118.4 134.4-118.4h-19.2z" horiz-adv-x="1024" />
|
|
18
|
-
|
|
19
17
|
<glyph glyph-name="sdoc-add" unicode="" d="M512-128C227.2-128 0 99.2 0 384S227.2 896 512 896s512-227.2 512-512-227.2-512-512-512z m-51.2 563.2H291.2c-19.2 0-35.2-12.8-35.2-35.2v-35.2c0-19.2 12.8-35.2 35.2-35.2h169.6V160c0-19.2 12.8-35.2 35.2-35.2h35.2c19.2 0 35.2 12.8 35.2 35.2v169.6H736c19.2 0 35.2 12.8 35.2 35.2v35.2c0 19.2-12.8 35.2-35.2 35.2h-169.6V604.8c0 19.2-12.8 35.2-35.2 35.2h-35.2c-19.2 0-35.2-12.8-35.2-35.2v-169.6z" horiz-adv-x="1024" />
|
|
20
18
|
|
|
21
19
|
<glyph glyph-name="sdoc-tag" unicode="" d="M521.353986 860.33363l466.979644-466.979644c22.389435-22.389435 35.183398-51.175851 35.183398-83.160758s-12.793963-60.771324-35.183398-83.160759l-323.047562-319.849071c-22.389435-22.389435-51.175851-35.183398-79.962268-35.183398-31.984907 0-60.771324 12.793963-83.160758 35.183398L35.183398 374.163042c-25.587926 25.587926-38.381889 60.771324-31.984907 95.954721l31.984907 291.062655c6.396981 54.374342 47.977361 95.954721 102.351703 102.351703l291.062654 31.984907c31.984907 3.198491 67.168305-9.595472 92.756231-35.183398zM444.590209 767.577399L159.924536 735.592492l-31.984908-281.467182L578.926819-0.060372l316.65058 313.45209L444.590209 767.577399z m12.793963-127.939628c57.572833-57.572833 57.572833-147.130573 0-204.703406-25.587926-25.587926-63.969814-41.580379-102.351703-41.580379-38.381889 0-73.565286 12.793963-102.351703 41.580379-57.572833 57.572833-57.572833 147.130573 0 204.703406 57.572833 57.572833 150.329063 57.572833 204.703406 0z m-102.351703-70.366796c-6.396981 0-15.992454-3.198491-22.389435-9.595472-12.793963-12.793963-12.793963-31.984907 0-44.77887 12.793963-12.793963 31.984907-12.793963 44.77887 0 12.793963 12.793963 12.793963 31.984907 0 44.77887-6.396981 6.396981-12.793963 9.595472-22.389435 9.595472z" horiz-adv-x="1024" />
|
|
Binary file
|
|
Binary file
|
|
Binary file
|