1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-08-31 22:54:11 +00:00

optimize code detail

This commit is contained in:
LeoSirius
2019-04-22 11:31:39 +08:00
parent e8185211f3
commit 571eb92766
3 changed files with 17 additions and 17 deletions

View File

@@ -42,21 +42,21 @@ class ViewFileText extends React.Component {
super(props);
this.state = {
content: fileContent,
isContentChangedButNotSaved: false,
needSave: false,
isSaving: false,
};
this.onSaveChangedContent=this.onSaveChangedContent.bind(this);
this.onSave=this.onSave.bind(this);
}
updateContent = (newContent) => {
this.setState({
isContentChangedButNotSaved: true,
needSave: true,
content: newContent,
});
}
onSaveChangedContent () {
onSave () {
let dirPath = '/';
return (
seafileAPI.getUpdateLink(repoID, dirPath).then((res) => {
@@ -75,7 +75,7 @@ class ViewFileText extends React.Component {
});
this.setState({
isSaving: false,
isContentChangedButNotSaved: false
needSave: false
});
});
})
@@ -92,8 +92,8 @@ class ViewFileText extends React.Component {
/>
}
isSaving={this.state.isSaving}
isContentChangedButNotSaved={this.state.isContentChangedButNotSaved}
onSaveChangedContent={this.onSaveChangedContent}
needSave={this.state.needSave}
onSave={this.onSave}
/>
);
}