@seafile/comment-editor 0.0.1-alpha.21 → 0.0.1-alpha.22

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.
@@ -40,11 +40,7 @@ const CommentEditor = _ref => {
40
40
  content,
41
41
  placeholder = DEFAULT_PLACEHOLDER,
42
42
  insertContent,
43
- // add
44
- updateContent,
45
- // edit
46
43
  onContentChange,
47
- setIsEditing,
48
44
  hiddenComment,
49
45
  hiddenUserInfo,
50
46
  closeComment,
@@ -91,17 +87,10 @@ const CommentEditor = _ref => {
91
87
  // init eventHandler
92
88
  // eslint-disable-next-line react-hooks/exhaustive-deps
93
89
  const eventProxy = (0, _react.useMemo)(() => new _eventHandler.default(editor), []);
94
- const updateValue = (0, _react.useCallback)(value => {
95
- if (!value || value.trim() === '') return;
96
- if (!content) return insertContent(value);
97
- updateContent && updateContent(value);
98
- }, [content, insertContent, updateContent]);
99
90
  const onSubmit = (0, _react.useCallback)(event => {
100
91
  event && event.stopPropagation();
101
92
  const mdString = (0, _slateToMd.default)(editor.children);
102
93
  if (mdString && mdString.trim()) insertContent(mdString);
103
- // updateValue(mdString);
104
-
105
94
  addParticipants(userInfo.username);
106
95
  editor.children = [(0, _core.generateEmptyElement)(_constants2.PARAGRAPH, {
107
96
  placeholder
@@ -141,24 +130,20 @@ const CommentEditor = _ref => {
141
130
  const isPreventCancel = isClickOnListContainer || isClickOnCommentEditorContainer || isClickResizeContainer || isSdocContentWrapper;
142
131
  if (isPreventCancel) return;
143
132
  }
144
- setIsEditing && setIsEditing(false);
145
133
  hiddenComment && hiddenComment(false);
146
134
  if (onContentChange) {
147
135
  if (editor.children.find(n => _slate.Node.string(n).trim())) {
148
- console.log(11);
149
136
  onContentChange((0, _slateToMd.default)(editor.children));
150
137
  } else {
151
- console.log(22);
152
138
  onContentChange(null);
153
139
  }
154
140
  }
155
141
  // eslint-disable-next-line react-hooks/exhaustive-deps
156
- }, [setIsEditing]);
142
+ }, []);
157
143
 
158
144
  // set editor children
159
145
  (0, _react.useEffect)(() => {
160
146
  let children = (0, _mdToSlate.default)(content);
161
- console.log('children', children);
162
147
  editor.children = children;
163
148
  _slate.Transforms.select(editor, _slate.Editor.end(editor, []));
164
149
  }, [editor, content]);
@@ -22,13 +22,11 @@ const SeafileCommentEditor = _ref => {
22
22
  pluginEvent,
23
23
  // Comment editor
24
24
  content,
25
- updateContent,
26
25
  insertContent,
27
26
  onContentChange,
28
27
  hiddenUserInfo,
29
28
  hiddenComment,
30
29
  closeComment,
31
- setIsEditing,
32
30
  addParticipants,
33
31
  // api
34
32
  api
@@ -43,13 +41,11 @@ const SeafileCommentEditor = _ref => {
43
41
  pluginEvent: pluginEvent
44
42
  }, /*#__PURE__*/_react.default.createElement(_basicSdk.CommentEditor, {
45
43
  content: content,
46
- updateContent: updateContent,
47
44
  insertContent: insertContent,
48
45
  onContentChange: onContentChange,
49
46
  hiddenUserInfo: hiddenUserInfo,
50
47
  hiddenComment: hiddenComment,
51
48
  closeComment: closeComment,
52
- setIsEditing: setIsEditing,
53
49
  addParticipants: addParticipants
54
50
  })));
55
51
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/comment-editor",
3
- "version": "0.0.1-alpha.21",
3
+ "version": "0.0.1-alpha.22",
4
4
  "private": false,
5
5
  "description": "This is a comment editor",
6
6
  "main": "dist/index.js",