@seafile/sdoc-editor 1.0.136 → 1.0.137
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.
|
@@ -58,6 +58,13 @@ const GlobalComment = _ref => {
|
|
|
58
58
|
}, [contentRef]);
|
|
59
59
|
(0, _react.useEffect)(() => {
|
|
60
60
|
detectScroll();
|
|
61
|
+
// When a comment is updated, update the comment details page
|
|
62
|
+
if (activeCommentGroup) {
|
|
63
|
+
const newActiveCommentGroup = commentList.find(item => item.id === activeCommentGroup.id);
|
|
64
|
+
setActiveCommentGroup(newActiveCommentGroup);
|
|
65
|
+
deleteUnseenNotifications && deleteUnseenNotifications(newActiveCommentGroup);
|
|
66
|
+
}
|
|
67
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
61
68
|
}, [commentList, detectScroll]);
|
|
62
69
|
const updateScrollPosition = (0, _react.useCallback)(() => {
|
|
63
70
|
var _contentRef$current3;
|
|
@@ -8,6 +8,7 @@ var _constants = require("../constants");
|
|
|
8
8
|
var _model = require("../../../model");
|
|
9
9
|
var _ = require("../../");
|
|
10
10
|
var _constants2 = require("../../constants");
|
|
11
|
+
var _constants3 = require("../../../constants");
|
|
11
12
|
const initNotificationsInfo = exports.initNotificationsInfo = {
|
|
12
13
|
isFetching: true,
|
|
13
14
|
notifications_map: {},
|
|
@@ -70,6 +71,10 @@ const notificationReducer = (state, action) => {
|
|
|
70
71
|
}
|
|
71
72
|
const eventBus = _.EventBus.getInstance();
|
|
72
73
|
eventBus.dispatch(_constants2.INTERNAL_EVENT.UNSEEN_NOTIFICATIONS_COUNT, Object.keys(notifications_map).length);
|
|
74
|
+
// No unread messages, clearly marked
|
|
75
|
+
if (Object.keys(notifications_map).length === 0) {
|
|
76
|
+
eventBus.dispatch(_constants3.EXTERNAL_EVENT.CLEAR_NOTIFICATION);
|
|
77
|
+
}
|
|
73
78
|
return {
|
|
74
79
|
...state,
|
|
75
80
|
notifications_map
|
|
@@ -54,30 +54,23 @@ const withCallout = editor => {
|
|
|
54
54
|
newEditor.insertFragment = data => {
|
|
55
55
|
if ((0, _helper.getCalloutEntry)(editor)) {
|
|
56
56
|
var _data$find;
|
|
57
|
-
//
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
if (parentNodeEntry && parentNodeEntry[0].type === _constants.CALL_OUT) {
|
|
63
|
-
if (!_slate.Node.string(paragraphEntry[0]).length) {
|
|
64
|
-
insertFragment(data);
|
|
65
|
-
if ([_constants.ORDERED_LIST, _constants.UNORDERED_LIST].includes(data[0].type)) {
|
|
66
|
-
_slate.Transforms.removeNodes(newEditor, {
|
|
67
|
-
at: paragraphEntry[1]
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
const eventBus = _eventBus.default.getInstance();
|
|
76
|
-
const unsupportType = (_data$find = data.find(node => !_constant.CALLOUT_ALLOWED_INSIDE_TYPES.includes(node.type))) === null || _data$find === void 0 ? void 0 : _data$find.type;
|
|
77
|
-
if (unsupportType) {
|
|
78
|
-
eventBus.dispatch(_constants2.INTERNAL_EVENT.DISPLAY_CALLOUT_UNSUPPORT_ALERT, unsupportType);
|
|
57
|
+
// No paste any unsupportedType content into callout
|
|
58
|
+
const unsupportedType = (_data$find = data.find(node => !_constant.CALLOUT_ALLOWED_INSIDE_TYPES.includes(node.type))) === null || _data$find === void 0 ? void 0 : _data$find.type;
|
|
59
|
+
if (unsupportedType) {
|
|
60
|
+
const eventBus = _eventBus.default.getInstance();
|
|
61
|
+
eventBus.dispatch(_constants2.INTERNAL_EVENT.DISPLAY_CALLOUT_UNSUPPORT_ALERT, unsupportedType);
|
|
79
62
|
return;
|
|
80
63
|
}
|
|
64
|
+
|
|
65
|
+
// Unwrap the callout nodes if nested within another callout
|
|
66
|
+
const hasCalloutNode = data.some(node => node.type === _constants.CALL_OUT);
|
|
67
|
+
if (hasCalloutNode) {
|
|
68
|
+
const newData = data.flatMap(node => node.type === _constants.CALL_OUT ? node.children : [node]);
|
|
69
|
+
insertFragment(newData);
|
|
70
|
+
} else {
|
|
71
|
+
insertFragment(data);
|
|
72
|
+
}
|
|
73
|
+
return;
|
|
81
74
|
}
|
|
82
75
|
return insertFragment(data);
|
|
83
76
|
};
|