1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-07 09:51:26 +00:00

use inner link

This commit is contained in:
Michael An
2019-04-24 16:37:42 +08:00
parent abff0ecad5
commit e95a2cedb8
3 changed files with 6 additions and 16 deletions

View File

@@ -645,19 +645,9 @@ class MarkdownEditor extends React.Component {
}
getInsertLink = (repoID, filePath) => {
seafileAPI.getShareLink(repoID, filePath).then((res) => {
if (res.data.length !== 0) {
let fileLink = res.data[0];
window.richMarkdownEditor.addLink(fileLink.obj_name, fileLink.link);
} else {
let permissions = { 'can_edit': false, 'can_download': true };
permissions = JSON.stringify(permissions);
seafileAPI.createShareLink(repoID, filePath, null, null, permissions).then((res) => {
let fileLink = res.data;
window.richMarkdownEditor.addLink(fileLink.obj_name, fileLink.link);
});
}
});
const innerURL = serviceUrl + '/lib/' + repoID + '/file' + Utils.encodePath(filePath);
const fileName = Utils.getFileName(filePath);
window.richMarkdownEditor.addLink(fileName, innerURL);
}
onContentChanged = (value) => {