Skip to content

Commit cbc4adc

Browse files
author
Kang Cheng
committed
Update getAllPath query selector
Closes docsifyjs#614
1 parent 1897bb6 commit cbc4adc

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/plugins/search/search.js

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
let INDEXS = {}
2-
let helper
32

43
function escapeHtml(string) {
54
const entityMap = {
@@ -17,7 +16,7 @@ function escapeHtml(string) {
1716
function getAllPaths(router) {
1817
const paths = []
1918

20-
helper.dom.findAll('a:not([data-nosearch])').forEach(node => {
19+
document.querySelectorAll('.sidebar-nav a:not(.section-link):not([data-nosearch])').forEach(node => {
2120
const href = node.href
2221
const originHref = node.getAttribute('href')
2322
const path = router.parse(href).path
@@ -149,8 +148,6 @@ export function search(query) {
149148
}
150149

151150
export function init(config, vm) {
152-
helper = Docsify
153-
154151
const isAuto = config.paths === 'auto'
155152
const isExpired = localStorage.getItem('docsify.search.expires') < Date.now()
156153

@@ -171,7 +168,7 @@ export function init(config, vm) {
171168
return count++
172169
}
173170

174-
helper
171+
Docsify
175172
.get(vm.router.getFile(path), false, vm.config.requestHeaders)
176173
.then(result => {
177174
INDEXS[path] = genIndex(path, result, vm.router, config.depth)

0 commit comments

Comments
 (0)