mirror of
https://github.com/haiwen/seahub.git
synced 2025-08-31 22:54:11 +00:00
wiki-init-bug (#2325)
* wiki-init-bug * repair wiki init load bug * add wiki file
This commit is contained in:
committed by
Daniel Pan
parent
4b97e41be2
commit
18b3b68ae5
@@ -74,14 +74,13 @@ class Wiki extends Component {
|
||||
lastModified: '',
|
||||
permission: '',
|
||||
isFileLoading: false,
|
||||
currentFileNode: null,
|
||||
searchedPath: null,
|
||||
};
|
||||
window.onpopstate = this.onpopstate;
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.loadFile({path: initialFilePath});
|
||||
this.loadFile(initialFilePath);
|
||||
}
|
||||
|
||||
fileNameFromPath(filePath) {
|
||||
@@ -116,14 +115,14 @@ class Wiki extends Component {
|
||||
}
|
||||
|
||||
onSearchedClick = (path) => {
|
||||
if (this.state.currentFileNode.path !== path) {
|
||||
if (this.state.currentFilePath !== path) {
|
||||
this.setState({searchedPath : path});
|
||||
}
|
||||
}
|
||||
|
||||
onFileClick = (e, node) => {
|
||||
if (node.isMarkdown()) {
|
||||
this.loadFile(node);
|
||||
this.loadFile(node.path);
|
||||
} else {
|
||||
const w=window.open('about:blank');
|
||||
const url = serviceUrl + '/lib/' + repoID + '/file' + node.path;
|
||||
@@ -131,8 +130,7 @@ class Wiki extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
loadFile(node) {
|
||||
let filePath = node.path;
|
||||
loadFile(filePath) {
|
||||
this.setState({isFileLoading: true});
|
||||
seafileAPI.getWikiFileContent(slug, filePath)
|
||||
.then(res => {
|
||||
@@ -144,7 +142,6 @@ class Wiki extends Component {
|
||||
fileName: this.fileNameFromPath(filePath),
|
||||
filePath: filePath,
|
||||
isFileLoading: false,
|
||||
currentFileNode: node
|
||||
})
|
||||
})
|
||||
|
||||
@@ -180,7 +177,7 @@ class Wiki extends Component {
|
||||
onCloseSide ={this.onCloseSide}
|
||||
editorUtilities={editorUtilities}
|
||||
permission={this.state.permission}
|
||||
currentFileNode={this.state.currentFileNode}
|
||||
currentFilePath={this.state.filePath}
|
||||
searchedPath={this.state.searchedPath}
|
||||
/>
|
||||
<MainPanel
|
||||
|
Reference in New Issue
Block a user