forked from p96170835/amis
commit
d628d71a97
|
@ -27,6 +27,7 @@ export default class DocSearch extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
onSearch(query) {
|
onSearch(query) {
|
||||||
|
query = query.toLowerCase();
|
||||||
if (query === '') {
|
if (query === '') {
|
||||||
this.setState({searchResults: []});
|
this.setState({searchResults: []});
|
||||||
return;
|
return;
|
||||||
|
@ -43,7 +44,13 @@ export default class DocSearch extends React.Component {
|
||||||
.substring(Math.max(0, index - 20), index + 60)
|
.substring(Math.max(0, index - 20), index + 60)
|
||||||
.replace(query, `<strong>${query}</strong>`)
|
.replace(query, `<strong>${query}</strong>`)
|
||||||
});
|
});
|
||||||
} else if (doc.title.indexOf(query) !== -1) {
|
} else if (doc.title.toLowerCase().indexOf(query) !== -1) {
|
||||||
|
results.push({
|
||||||
|
title: doc.title,
|
||||||
|
path: doc.path,
|
||||||
|
abstract: ''
|
||||||
|
});
|
||||||
|
} else if (doc.path.toLowerCase().indexOf(query) !== -1) {
|
||||||
results.push({
|
results.push({
|
||||||
title: doc.title,
|
title: doc.title,
|
||||||
path: doc.path,
|
path: doc.path,
|
||||||
|
|
Loading…
Reference in New Issue