@seafile/sdoc-editor 2.0.122-test-0.0.1 → 2.0.122-test-0.0.2

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.
@@ -80,6 +80,7 @@ var CommentArticle = function CommentArticle(_ref) {
80
80
  }
81
81
  eventProxy.onKeyDown(event);
82
82
  }, [eventProxy, editor]);
83
+ console.log(1, type);
83
84
  return /*#__PURE__*/_react["default"].createElement(_slateReact.Slate, {
84
85
  editor: editor,
85
86
  value: slateValue,
@@ -65,9 +65,12 @@ var SdocCommentEditor = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref)
65
65
  // eslint-disable-next-line react-hooks/exhaustive-deps
66
66
  }, []);
67
67
  (0, _react.useEffect)(function () {
68
+ console.log(1111, commentEditorContainerRef === null || commentEditorContainerRef === void 0 ? void 0 : commentEditorContainerRef.current, notificationsInfo);
69
+ console.log(22, commentEditorContainerRef.current.closest('.global-comment-input-wrapper'));
68
70
  if (!(commentEditorContainerRef !== null && commentEditorContainerRef !== void 0 && commentEditorContainerRef.current)) return;
69
- if (notificationsInfo.notifications_map.length === 0) return;
71
+ if (Object.keys(notificationsInfo.notifications_map || {}).length === 0) return;
70
72
  if (!commentEditorContainerRef.current.closest('.global-comment-input-wrapper')) return;
73
+ console.log(333);
71
74
  var clearAllNotification = /*#__PURE__*/function () {
72
75
  var _ref2 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee() {
73
76
  var res, notifications, eventBus, errorMessage;
@@ -107,22 +110,23 @@ var SdocCommentEditor = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref)
107
110
  var el = commentEditorContainerRef && commentEditorContainerRef.current;
108
111
 
109
112
  // Mark comment read if focusing commentEditorContainerRef over 3s
110
- var handleFocus = function handleFocus() {
113
+ var handleFocusIn = function handleFocusIn() {
111
114
  timeoutRef.current = setTimeout(function () {
115
+ console.log(1, 'clear');
112
116
  clearAllNotification();
113
117
  }, 3000);
114
118
  };
115
119
  var handleBlur = function handleBlur() {
116
120
  clearTimeout(timeoutRef.current);
117
121
  };
118
- el.addEventListener('focus', handleFocus);
119
- el.addEventListener('blur', handleBlur);
122
+ el.addEventListener('focusin', handleFocusIn);
123
+ el.addEventListener('focusout', handleBlur);
120
124
  return function () {
121
- el.removeEventListener('focus', handleFocus);
122
- el.removeEventListener('blur', handleBlur);
125
+ el.removeEventListener('focusin', handleFocusIn);
126
+ el.removeEventListener('focusout', handleBlur);
123
127
  clearTimeout(timeoutRef.current);
124
128
  };
125
- }, [notificationsInfo.notifications_map, t]);
129
+ }, [notificationsInfo, t]);
126
130
 
127
131
  // useMount: focus editor
128
132
  (0, _react.useEffect)(function () {
@@ -16,6 +16,7 @@ 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);
19
20
  switch (element.type) {
20
21
  case _constants.PARAGRAPH:
21
22
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/sdoc-editor",
3
- "version": "2.0.122-test-0.0.1",
3
+ "version": "2.0.122-test-0.0.2",
4
4
  "main": "dist/index.js",
5
5
  "scripts": {
6
6
  "test": "jest",