mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-01 15:09:14 +00:00
update onlyoffice convert
This commit is contained in:
@@ -369,28 +369,16 @@ class DirentListItem extends React.Component {
|
||||
}
|
||||
|
||||
onConvertWithONLYOFFICE = ()=> {
|
||||
|
||||
let repoID = this.props.repoID;
|
||||
let user = username;
|
||||
let fileUri = this.getDirentPath(this.props.dirent)
|
||||
fetch(siteRoot+'onlyoffice/convert', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
username: user,
|
||||
fileUri: fileUri,
|
||||
repo_id: repoID,
|
||||
}),
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
}).then(res => {
|
||||
if(res.status >= 400) throw new Error()
|
||||
//Replace with changes in the state
|
||||
//like this one => this.addNodeToTree(name, parentPath, 'file');
|
||||
window.location.reload();
|
||||
})
|
||||
.catch(() => {
|
||||
toaster.danger('Could not convert the file');
|
||||
})
|
||||
let filePath = this.getDirentPath(this.props.dirent)
|
||||
|
||||
seafileAPI.onlyofficeConvert(repoID, filePath).then(res => {
|
||||
this.props.loadDirentList(res.data.parent_dir)
|
||||
}).catch(error => {
|
||||
let errMessage = Utils.getErrorMsg(error);
|
||||
toaster.danger(errMessage);
|
||||
});
|
||||
}
|
||||
|
||||
onItemDownload = (e) => {
|
||||
|
@@ -49,6 +49,7 @@ const propTypes = {
|
||||
isGroupOwnedRepo: PropTypes.bool.isRequired,
|
||||
userPerm: PropTypes.string,
|
||||
showDirentDetail: PropTypes.func.isRequired,
|
||||
loadDirentList: PropTypes.func.isRequired,
|
||||
};
|
||||
|
||||
class DirentListView extends React.Component {
|
||||
@@ -645,6 +646,7 @@ class DirentListView extends React.Component {
|
||||
showDirentDetail={this.props.showDirentDetail}
|
||||
onItemsMove={this.props.onItemsMove}
|
||||
onShowDirentsDraggablePreview={this.onShowDirentsDraggablePreview}
|
||||
loadDirentList={this.props.loadDirentList}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
|
Reference in New Issue
Block a user