@seafile/sdoc-editor 2.0.122-test-0.0.2 → 2.0.122-test-0.0.3
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.
|
@@ -86,6 +86,7 @@ var CommentArticle = function CommentArticle(_ref) {
|
|
|
86
86
|
value: slateValue,
|
|
87
87
|
onChange: updateSlateValue
|
|
88
88
|
}, /*#__PURE__*/_react["default"].createElement(_slateReact.Editable, {
|
|
89
|
+
tabIndex: 0,
|
|
89
90
|
id: "sdoc-editor",
|
|
90
91
|
scrollSelectionIntoView: handleScrollIntoView,
|
|
91
92
|
cursors: cursors,
|
|
@@ -44,7 +44,7 @@ var SdocCommentEditor = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref)
|
|
|
44
44
|
slateValue = _useState2[0],
|
|
45
45
|
_setSlateValue = _useState2[1];
|
|
46
46
|
var commentEditorContainerRef = (0, _react.useRef)(null);
|
|
47
|
-
var
|
|
47
|
+
var commentTimeoutRef = (0, _react.useRef)(null);
|
|
48
48
|
var _useNotificationConte = (0, _notificationHooks.useNotificationContext)(),
|
|
49
49
|
notificationsInfo = _useNotificationConte.notificationsInfo;
|
|
50
50
|
var _useTranslation = (0, _reactI18next.useTranslation)('sdoc-editor'),
|
|
@@ -68,9 +68,8 @@ var SdocCommentEditor = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref)
|
|
|
68
68
|
console.log(1111, commentEditorContainerRef === null || commentEditorContainerRef === void 0 ? void 0 : commentEditorContainerRef.current, notificationsInfo);
|
|
69
69
|
console.log(22, commentEditorContainerRef.current.closest('.global-comment-input-wrapper'));
|
|
70
70
|
if (!(commentEditorContainerRef !== null && commentEditorContainerRef !== void 0 && commentEditorContainerRef.current)) return;
|
|
71
|
-
if (Object.keys(notificationsInfo.notifications_map || {}).length === 0) return;
|
|
71
|
+
// if (Object.keys(notificationsInfo.notifications_map || {}).length === 0 ) return;
|
|
72
72
|
if (!commentEditorContainerRef.current.closest('.global-comment-input-wrapper')) return;
|
|
73
|
-
console.log(333);
|
|
74
73
|
var clearAllNotification = /*#__PURE__*/function () {
|
|
75
74
|
var _ref2 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee() {
|
|
76
75
|
var res, notifications, eventBus, errorMessage;
|
|
@@ -110,23 +109,28 @@ var SdocCommentEditor = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref)
|
|
|
110
109
|
var el = commentEditorContainerRef && commentEditorContainerRef.current;
|
|
111
110
|
|
|
112
111
|
// Mark comment read if focusing commentEditorContainerRef over 3s
|
|
113
|
-
var handleFocusIn = function handleFocusIn() {
|
|
114
|
-
|
|
115
|
-
|
|
112
|
+
var handleFocusIn = function handleFocusIn(e) {
|
|
113
|
+
console.log(5, e.target);
|
|
114
|
+
commentTimeoutRef.current = setTimeout(function () {
|
|
116
115
|
clearAllNotification();
|
|
116
|
+
commentTimeoutRef.current = null;
|
|
117
117
|
}, 3000);
|
|
118
118
|
};
|
|
119
119
|
var handleBlur = function handleBlur() {
|
|
120
|
-
clearTimeout(
|
|
120
|
+
clearTimeout(commentTimeoutRef.current);
|
|
121
|
+
commentTimeoutRef.current = null;
|
|
121
122
|
};
|
|
122
123
|
el.addEventListener('focusin', handleFocusIn);
|
|
123
124
|
el.addEventListener('focusout', handleBlur);
|
|
124
125
|
return function () {
|
|
125
126
|
el.removeEventListener('focusin', handleFocusIn);
|
|
126
127
|
el.removeEventListener('focusout', handleBlur);
|
|
127
|
-
|
|
128
|
+
if (commentTimeoutRef.current) {
|
|
129
|
+
clearTimeout(commentTimeoutRef.current);
|
|
130
|
+
commentTimeoutRef.current = null;
|
|
131
|
+
}
|
|
128
132
|
};
|
|
129
|
-
}, [notificationsInfo
|
|
133
|
+
}, [notificationsInfo]);
|
|
130
134
|
|
|
131
135
|
// useMount: focus editor
|
|
132
136
|
(0, _react.useEffect)(function () {
|
|
@@ -16,7 +16,6 @@ var RenderCommentEditorCustomRenderElement = function RenderCommentEditorCustomR
|
|
|
16
16
|
var readonly = (0, _slateReact.useReadOnly)();
|
|
17
17
|
var element = props.element,
|
|
18
18
|
commentType = props.commentType;
|
|
19
|
-
console.log(1, element);
|
|
20
19
|
switch (element.type) {
|
|
21
20
|
case _constants.PARAGRAPH:
|
|
22
21
|
{
|