mirror of
https://github.com/haiwen/seahub.git
synced 2025-08-31 22:54:11 +00:00
wiki search (#2278)
This commit is contained in:
committed by
Daniel Pan
parent
c24d527a03
commit
0105e8e8ef
@@ -12,6 +12,7 @@ import './assets/css/fontawesome.css';
|
||||
import 'seafile-ui';
|
||||
import './css/side-panel.css';
|
||||
import './css/wiki.css';
|
||||
import './css/search.css';
|
||||
|
||||
// init seafileAPI
|
||||
let seafileAPI = new SeafileAPI();
|
||||
@@ -46,7 +47,8 @@ class Wiki extends Component {
|
||||
filePath: '',
|
||||
latestContributor: '',
|
||||
lastModified: '',
|
||||
permission: ''
|
||||
permission: '',
|
||||
isFileLoading: false
|
||||
};
|
||||
window.onpopstate = this.onpopstate;
|
||||
}
|
||||
@@ -84,6 +86,12 @@ class Wiki extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
onSearchedClick = (path) => {
|
||||
if (path) {
|
||||
this.loadFile(path);
|
||||
}
|
||||
}
|
||||
|
||||
onFileClick = (e, node) => {
|
||||
if (node.isMarkdown()) {
|
||||
this.loadFile(node.path);
|
||||
@@ -91,6 +99,9 @@ class Wiki extends Component {
|
||||
}
|
||||
|
||||
loadFile(filePath) {
|
||||
this.setState({
|
||||
isFileLoading: true
|
||||
})
|
||||
seafileAPI.getWikiFileContent(slug, filePath)
|
||||
.then(res => {
|
||||
this.setState({
|
||||
@@ -99,7 +110,8 @@ class Wiki extends Component {
|
||||
lastModified: moment.unix(res.data.last_modified).fromNow(),
|
||||
permission: res.data.permission,
|
||||
fileName: this.fileNameFromPath(filePath),
|
||||
filePath: filePath
|
||||
filePath: filePath,
|
||||
isFileLoading: false
|
||||
})
|
||||
})
|
||||
|
||||
@@ -140,10 +152,12 @@ class Wiki extends Component {
|
||||
filePath={this.state.filePath}
|
||||
onLinkClick={this.onLinkClick}
|
||||
onMenuClick={this.onMenuClick}
|
||||
onSearchedClick={this.onSearchedClick}
|
||||
latestContributor={this.state.latestContributor}
|
||||
lastModified={this.state.lastModified}
|
||||
seafileAPI={seafileAPI}
|
||||
permission={this.state.permission}
|
||||
isFileLoading={this.state.isFileLoading}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
|
Reference in New Issue
Block a user