@seafile/comment-editor 0.0.1-alpha.5 → 0.0.1-alpha.6
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,29 +38,28 @@ const getSubmitTip = (type, content) => {
|
|
|
38
38
|
const DEFAULT_PLACEHOLDER = 'Enter_comment_shift_enter_for_new_line_Enter_to_send';
|
|
39
39
|
const CommentEditor = _ref => {
|
|
40
40
|
let {
|
|
41
|
-
type,
|
|
42
41
|
content,
|
|
43
42
|
commentContent,
|
|
44
43
|
placeholder = DEFAULT_PLACEHOLDER,
|
|
45
44
|
insertContent,
|
|
46
45
|
updateContent,
|
|
46
|
+
onContentChange,
|
|
47
47
|
setIsEditing,
|
|
48
48
|
hiddenComment,
|
|
49
49
|
hiddenUserInfo,
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
closeComment
|
|
50
|
+
closeComment,
|
|
51
|
+
addParticipants
|
|
53
52
|
} = _ref;
|
|
54
53
|
const commentWrapperRef = (0, _react.useRef)();
|
|
55
54
|
const {
|
|
56
55
|
t
|
|
57
56
|
} = (0, _reactI18next.useTranslation)('sdoc-editor');
|
|
58
57
|
const {
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
className,
|
|
59
|
+
userInfo,
|
|
60
|
+
type
|
|
61
61
|
} = (0, _useComment.useComment)();
|
|
62
62
|
const submitTip = (0, _react.useMemo)(() => getSubmitTip(type, content), [content, type]);
|
|
63
|
-
const userInfo = _context.default.getUserInfo();
|
|
64
63
|
const document = (0, _react.useMemo)(() => {
|
|
65
64
|
const cursor = {};
|
|
66
65
|
let elements = null;
|
|
@@ -17,6 +17,8 @@ const CommentContext = /*#__PURE__*/_react.default.createContext(null);
|
|
|
17
17
|
const CommentProvider = _ref => {
|
|
18
18
|
let {
|
|
19
19
|
children,
|
|
20
|
+
type,
|
|
21
|
+
userInfo,
|
|
20
22
|
pluginName = '',
|
|
21
23
|
className = '',
|
|
22
24
|
pluginEventBus,
|
|
@@ -27,14 +29,10 @@ const CommentProvider = _ref => {
|
|
|
27
29
|
t
|
|
28
30
|
} = (0, _reactI18next.useTranslation)('sdoc-editor');
|
|
29
31
|
const [collaborators, setCollaborators] = (0, _react.useState)([]);
|
|
30
|
-
|
|
31
|
-
// Mount
|
|
32
|
-
(0, _react.useEffect)(() => {
|
|
33
|
-
|
|
34
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
35
|
-
}, []);
|
|
36
32
|
return /*#__PURE__*/_react.default.createElement(CommentContext.Provider, {
|
|
37
33
|
value: {
|
|
34
|
+
type,
|
|
35
|
+
userInfo,
|
|
38
36
|
pluginName,
|
|
39
37
|
className,
|
|
40
38
|
api,
|
|
@@ -11,32 +11,36 @@ var _basicSdk = require("../basic-sdk");
|
|
|
11
11
|
var _errorBoundary = _interopRequireDefault(require("../components/error-boundary"));
|
|
12
12
|
const SeafileCommentEditor = _ref => {
|
|
13
13
|
let {
|
|
14
|
+
type,
|
|
15
|
+
userInfo,
|
|
14
16
|
pluginName = '',
|
|
15
17
|
className = '',
|
|
16
|
-
type,
|
|
17
18
|
commentContent,
|
|
18
19
|
hiddenUserInfo,
|
|
19
20
|
insertContent,
|
|
20
21
|
hiddenComment,
|
|
21
22
|
onContentChange,
|
|
23
|
+
addParticipants,
|
|
22
24
|
pluginEventBus,
|
|
23
25
|
pluginEvent,
|
|
24
26
|
api
|
|
25
27
|
} = _ref;
|
|
26
28
|
_basicSdk.context.init();
|
|
27
29
|
return /*#__PURE__*/_react.default.createElement(_errorBoundary.default, null, /*#__PURE__*/_react.default.createElement(_basicSdk.CommentProvider, {
|
|
30
|
+
type: type,
|
|
31
|
+
userInfo: userInfo,
|
|
28
32
|
pluginName: pluginName,
|
|
29
33
|
className: className,
|
|
30
34
|
pluginEventBus: pluginEventBus,
|
|
31
35
|
pluginEvent: pluginEvent,
|
|
32
36
|
api: api
|
|
33
37
|
}, /*#__PURE__*/_react.default.createElement(_basicSdk.CommentEditor, {
|
|
34
|
-
type: type,
|
|
35
38
|
commentContent: commentContent,
|
|
36
39
|
hiddenUserInfo: hiddenUserInfo,
|
|
37
40
|
insertContent: insertContent,
|
|
38
41
|
hiddenComment: hiddenComment,
|
|
39
|
-
onContentChange: onContentChange
|
|
42
|
+
onContentChange: onContentChange,
|
|
43
|
+
addParticipants: addParticipants
|
|
40
44
|
})));
|
|
41
45
|
};
|
|
42
46
|
var _default = exports.default = (0, _reactI18next.withTranslation)('sdoc-editor')(SeafileCommentEditor);
|