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

Wiki sidebar bug (#2321)

* repair rename bug

* modify rename module and  search module

* add hight-light style for tree-node
This commit is contained in:
shanshuirenjia
2018-09-01 11:34:27 +08:00
committed by Daniel Pan
parent 285fa43387
commit 99e9c8b1c0
6 changed files with 79 additions and 35 deletions

View File

@@ -73,13 +73,15 @@ class Wiki extends Component {
latestContributor: '',
lastModified: '',
permission: '',
isFileLoading: false
isFileLoading: false,
currentFileNode: null,
searchedPath: null,
};
window.onpopstate = this.onpopstate;
}
componentDidMount() {
this.loadFile(initialFilePath);
this.loadFile({path: initialFilePath});
}
fileNameFromPath(filePath) {
@@ -114,14 +116,14 @@ class Wiki extends Component {
}
onSearchedClick = (path) => {
if (path) {
this.loadFile(path);
if (this.state.currentFileNode.path !== path) {
this.setState({searchedPath : path});
}
}
onFileClick = (e, node) => {
if (node.isMarkdown()) {
this.loadFile(node.path);
this.loadFile(node);
} else {
const w=window.open('about:blank');
const url = serviceUrl + '/lib/' + repoID + '/file' + node.path;
@@ -129,10 +131,9 @@ class Wiki extends Component {
}
}
loadFile(filePath) {
this.setState({
isFileLoading: true
})
loadFile(node) {
let filePath = node.path;
this.setState({isFileLoading: true});
seafileAPI.getWikiFileContent(slug, filePath)
.then(res => {
this.setState({
@@ -142,7 +143,8 @@ class Wiki extends Component {
permission: res.data.permission,
fileName: this.fileNameFromPath(filePath),
filePath: filePath,
isFileLoading: false
isFileLoading: false,
currentFileNode: node
})
})
@@ -178,6 +180,8 @@ class Wiki extends Component {
onCloseSide ={this.onCloseSide}
editorUtilities={editorUtilities}
permission={this.state.permission}
currentFileNode={this.state.currentFileNode}
searchedPath={this.state.searchedPath}
/>
<MainPanel
content={this.state.content}