@seafile/comment-editor 0.0.1-alpha.14 → 0.0.1-alpha.15
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.
|
@@ -38,7 +38,6 @@ const DEFAULT_PLACEHOLDER = 'Enter_comment_shift_enter_for_new_line_Enter_to_sen
|
|
|
38
38
|
const CommentEditor = _ref => {
|
|
39
39
|
let {
|
|
40
40
|
content,
|
|
41
|
-
commentContent,
|
|
42
41
|
placeholder = DEFAULT_PLACEHOLDER,
|
|
43
42
|
insertContent,
|
|
44
43
|
updateContent,
|
|
@@ -105,7 +104,6 @@ const CommentEditor = _ref => {
|
|
|
105
104
|
})];
|
|
106
105
|
_slate.Transforms.select(editor, _slate.Editor.start(editor, []));
|
|
107
106
|
onContentChange && onContentChange(null);
|
|
108
|
-
console.log('closeComment', closeComment);
|
|
109
107
|
closeComment && closeComment();
|
|
110
108
|
}, [editor, updateValue, addParticipants, userInfo.username, placeholder, onContentChange, closeComment]);
|
|
111
109
|
const onSubmitByEnterKey = (0, _react.useCallback)(event => {
|
|
@@ -154,12 +152,9 @@ const CommentEditor = _ref => {
|
|
|
154
152
|
// set editor children
|
|
155
153
|
(0, _react.useEffect)(() => {
|
|
156
154
|
let children = (0, _mdToSlate.default)(content);
|
|
157
|
-
if (commentContent) {
|
|
158
|
-
children = (0, _mdToSlate.default)(commentContent);
|
|
159
|
-
}
|
|
160
155
|
editor.children = children;
|
|
161
156
|
_slate.Transforms.select(editor, _slate.Editor.end(editor, []));
|
|
162
|
-
}, [editor, content
|
|
157
|
+
}, [editor, content]);
|
|
163
158
|
|
|
164
159
|
// useMount: focus editor
|
|
165
160
|
(0, _react.useEffect)(() => {
|
|
@@ -19,8 +19,9 @@ const CommentProvider = _ref => {
|
|
|
19
19
|
type,
|
|
20
20
|
// comment or replay
|
|
21
21
|
userInfo,
|
|
22
|
-
pluginName = '',
|
|
23
22
|
className = '',
|
|
23
|
+
pluginName = '',
|
|
24
|
+
// sdoc or wiki or txt ...
|
|
24
25
|
pluginEventBus,
|
|
25
26
|
pluginEvent
|
|
26
27
|
} = _ref;
|
|
@@ -29,8 +30,8 @@ const CommentProvider = _ref => {
|
|
|
29
30
|
value: {
|
|
30
31
|
type,
|
|
31
32
|
userInfo,
|
|
32
|
-
pluginName,
|
|
33
33
|
className,
|
|
34
|
+
pluginName,
|
|
34
35
|
pluginEventBus,
|
|
35
36
|
pluginEvent,
|
|
36
37
|
collaborators
|
|
@@ -11,35 +11,38 @@ var _basicSdk = require("../basic-sdk");
|
|
|
11
11
|
var _errorBoundary = _interopRequireDefault(require("../components/error-boundary"));
|
|
12
12
|
const SeafileCommentEditor = _ref => {
|
|
13
13
|
let {
|
|
14
|
+
// Provider
|
|
14
15
|
type,
|
|
16
|
+
// comment or replay
|
|
15
17
|
userInfo,
|
|
16
|
-
pluginName = '',
|
|
17
18
|
className = '',
|
|
19
|
+
pluginName = '',
|
|
20
|
+
// sdoc or wiki or txt ...
|
|
21
|
+
pluginEventBus,
|
|
22
|
+
pluginEvent,
|
|
23
|
+
// Comment editor
|
|
18
24
|
content,
|
|
19
25
|
updateContent,
|
|
20
26
|
insertContent,
|
|
21
27
|
onContentChange,
|
|
22
|
-
commentContent,
|
|
23
28
|
hiddenUserInfo,
|
|
24
29
|
hiddenComment,
|
|
25
30
|
closeComment,
|
|
26
31
|
setIsEditing,
|
|
27
32
|
addParticipants,
|
|
28
|
-
|
|
29
|
-
pluginEvent,
|
|
33
|
+
// api
|
|
30
34
|
api
|
|
31
35
|
} = _ref;
|
|
32
36
|
_basicSdk.context.init(api);
|
|
33
37
|
return /*#__PURE__*/_react.default.createElement(_errorBoundary.default, null, /*#__PURE__*/_react.default.createElement(_basicSdk.CommentProvider, {
|
|
34
38
|
type: type,
|
|
35
39
|
userInfo: userInfo,
|
|
36
|
-
pluginName: pluginName,
|
|
37
40
|
className: className,
|
|
41
|
+
pluginName: pluginName,
|
|
38
42
|
pluginEventBus: pluginEventBus,
|
|
39
43
|
pluginEvent: pluginEvent
|
|
40
44
|
}, /*#__PURE__*/_react.default.createElement(_basicSdk.CommentEditor, {
|
|
41
45
|
content: content,
|
|
42
|
-
commentContent: commentContent,
|
|
43
46
|
updateContent: updateContent,
|
|
44
47
|
insertContent: insertContent,
|
|
45
48
|
onContentChange: onContentChange,
|