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

Wiki mode improve (#3100)

* repair internal link bug

* add tags for path

* add share&editTag feature

* add related-file for column-mode

* repair edit tag bug

* update implement logic
This commit is contained in:
杨顺强
2019-03-15 10:10:24 +08:00
committed by Daniel Pan
parent 81c131ba07
commit 7502ce83df
7 changed files with 288 additions and 49 deletions

View File

@@ -46,6 +46,8 @@ class LibContentView extends React.Component {
selectedDirentList: [],
isDraft: false,
hasDraft: false,
fileTags: [],
relatedFiles: [],
draftID: '',
draftCounts: 0,
usedRepoTags: [],
@@ -287,6 +289,27 @@ class LibContentView extends React.Component {
showFile = (filePath) => {
let repoID = this.props.repoID;
if (this.state.currentMode === 'column') {
seafileAPI.listFileTags(repoID, filePath).then(res => {
let fileTags = res.data.file_tags.map(item => {
return new FileTag(item);
});
this.setState({fileTags: fileTags});
});
seafileAPI.listRelatedFiles(repoID, filePath).then(res => {
let relatedFiles = res.data.related_files.map((relatedFile) => {
return relatedFile;
});
this.setState({relatedFiles: relatedFiles});
}).catch((error) => {
if (error.response.status === 500) {
this.setState({relatedFiles: []});
}
});
}
// update state
this.setState({
isFileLoading: true,
@@ -1151,6 +1174,34 @@ class LibContentView extends React.Component {
this.uploader.onFolderUpload();
}
onToolbarFileTagChanged = () => {
let repoID = this.props.repoID;
let filePath = this.state.path;
seafileAPI.listFileTags(repoID, filePath).then(res => {
let fileTags = res.data.file_tags.map(item => {
return new FileTag(item);
});
this.setState({fileTags: fileTags});
});
}
onToolbarRelatedFileChange = () => {
let repoID = this.props.repoID;
let filePath = this.state.path;
seafileAPI.listRelatedFiles(repoID, filePath).then(res => {
let relatedFiles = res.data.related_files.map((relatedFile) => {
return relatedFile;
});
this.setState({relatedFiles: relatedFiles});
}).catch((error) => {
if (error.response.status === 500) {
this.setState({relatedFiles: []});
}
});
}
render() {
if (this.state.libNeedDecrypt) {
@@ -1203,6 +1254,10 @@ class LibContentView extends React.Component {
filePermission={this.state.filePermission}
isDraft={this.state.isDraft}
hasDraft={this.state.hasDraft}
fileTags={this.state.fileTags}
relatedFiles={this.state.relatedFiles}
onFileTagChanged={this.onToolbarFileTagChanged}
onRelatedFileChange={this.onToolbarRelatedFileChange}
onSideNavMenuClick={this.props.onMenuClick}
repoID={this.props.repoID}
path={this.state.path}
@@ -1245,6 +1300,8 @@ class LibContentView extends React.Component {
hash={this.state.hash}
isDraft={this.state.isDraft}
hasDraft={this.state.hasDraft}
fileTags={this.state.fileTags}
relatedFiles={this.state.relatedFiles}
goDraftPage={this.goDraftPage}
isFileLoading={this.state.isFileLoading}
isFileLoadedErr={this.state.isFileLoadedErr}