1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-01 15:09:14 +00:00

fix add reviewer&upload image bug

This commit is contained in:
ilearnit
2018-11-05 14:03:13 +00:00
parent 46889e9608
commit d8dae806e1
2 changed files with 21 additions and 1 deletions

View File

@@ -94,6 +94,22 @@ class EditorUtilities {
);
}
uploadLocalImage = (imageFile) => {
return (
seafileAPI.getUploadLink(repoID, dirPath).then((res) => {
const uploadLink = res.data + '?ret-json=1';
const newFile = new File([imageFile], imageFile.name, {type: imageFile.type});
const formData = new FormData();
formData.append('parent_dir', '/');
formData.append('relative_path', 'images');
formData.append('file', newFile);
return seafileAPI.uploadImage(uploadLink, formData);
}).then ((res) => {
return this._getImageURL(res.data[0].name);
})
);
}
getFileURL(fileNode) {
var url;
if (fileNode.type === 'file') {