@seafile/comment-editor 0.0.1-alpha.7 → 0.0.1-alpha.8
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.
- package/dist/basic-sdk/context.js +2 -1
- package/dist/basic-sdk/extension/plugins/image/helpers.js +1 -0
- package/dist/basic-sdk/extension/plugins/image/use-copy-image.js +1 -0
- package/dist/basic-sdk/extension/plugins/image/use-upload-image.js +1 -0
- package/dist/basic-sdk/hooks/use-comment.js +1 -3
- package/dist/pages/seafile-comment-editor.js +2 -3
- package/package.json +1 -1
|
@@ -55,8 +55,9 @@ class Context {
|
|
|
55
55
|
this.api = null;
|
|
56
56
|
this.config = null;
|
|
57
57
|
}
|
|
58
|
-
init() {
|
|
58
|
+
init(api) {
|
|
59
59
|
this.initSettings(); // lazy init context class
|
|
60
|
+
this.api = api;
|
|
60
61
|
// const server = this.getSetting('serviceUrl');
|
|
61
62
|
// const token = this.getSetting('accessToken');
|
|
62
63
|
// this.api = new SeafileAPI(server, token);
|
|
@@ -291,6 +291,7 @@ const handleBase64Image = (editor, path, imgData) => {
|
|
|
291
291
|
const file = new File([blob], `${_slugid.default.nice()}.jpg`, {
|
|
292
292
|
type: unit8Array.mime
|
|
293
293
|
});
|
|
294
|
+
console.log(111);
|
|
294
295
|
_context.default.uploadLocalImage([file]).then(res => {
|
|
295
296
|
const _data = {
|
|
296
297
|
...imgData,
|
|
@@ -51,6 +51,7 @@ const useCopyImage = _ref => {
|
|
|
51
51
|
const file = new File([blob], 'downloaded_image.png', {
|
|
52
52
|
type: blob.type
|
|
53
53
|
});
|
|
54
|
+
console.log(222);
|
|
54
55
|
const imageUrl = await _context.default.uploadLocalImage([file]);
|
|
55
56
|
if (imageUrl && imageUrl[0]) {
|
|
56
57
|
updateImageNode(editor, element, imageUrl[0]);
|
|
@@ -42,6 +42,7 @@ const useUploadImage = _ref => {
|
|
|
42
42
|
const uploadCurrentImage = async () => {
|
|
43
43
|
try {
|
|
44
44
|
const fileItem = _imageCache.default.getImage(file_uuid);
|
|
45
|
+
console.log(333, _context.default);
|
|
45
46
|
const imageUrl = await _context.default.uploadLocalImage([fileItem]);
|
|
46
47
|
if (imageUrl && imageUrl[0]) {
|
|
47
48
|
updateImageNode(editor, element, imageUrl[0]);
|
|
@@ -22,8 +22,7 @@ const CommentProvider = _ref => {
|
|
|
22
22
|
pluginName = '',
|
|
23
23
|
className = '',
|
|
24
24
|
pluginEventBus,
|
|
25
|
-
pluginEvent
|
|
26
|
-
api
|
|
25
|
+
pluginEvent
|
|
27
26
|
} = _ref;
|
|
28
27
|
const {
|
|
29
28
|
t
|
|
@@ -35,7 +34,6 @@ const CommentProvider = _ref => {
|
|
|
35
34
|
userInfo,
|
|
36
35
|
pluginName,
|
|
37
36
|
className,
|
|
38
|
-
api,
|
|
39
37
|
pluginEventBus,
|
|
40
38
|
pluginEvent,
|
|
41
39
|
collaborators
|
|
@@ -25,15 +25,14 @@ const SeafileCommentEditor = _ref => {
|
|
|
25
25
|
pluginEvent,
|
|
26
26
|
api
|
|
27
27
|
} = _ref;
|
|
28
|
-
_basicSdk.context.init();
|
|
28
|
+
_basicSdk.context.init(api);
|
|
29
29
|
return /*#__PURE__*/_react.default.createElement(_errorBoundary.default, null, /*#__PURE__*/_react.default.createElement(_basicSdk.CommentProvider, {
|
|
30
30
|
type: type,
|
|
31
31
|
userInfo: userInfo,
|
|
32
32
|
pluginName: pluginName,
|
|
33
33
|
className: className,
|
|
34
34
|
pluginEventBus: pluginEventBus,
|
|
35
|
-
pluginEvent: pluginEvent
|
|
36
|
-
api: api
|
|
35
|
+
pluginEvent: pluginEvent
|
|
37
36
|
}, /*#__PURE__*/_react.default.createElement(_basicSdk.CommentEditor, {
|
|
38
37
|
commentContent: commentContent,
|
|
39
38
|
hiddenUserInfo: hiddenUserInfo,
|