fix: Update getAllPath query selector (#653)
Closes https://github.com/docsifyjs/docsify/issues/614
This commit is contained in:
parent
50c2434ab5
commit
f6f4e32485
1 changed files with 2 additions and 5 deletions
|
|
@ -1,5 +1,4 @@
|
||||||
let INDEXS = {}
|
let INDEXS = {}
|
||||||
let helper
|
|
||||||
|
|
||||||
function escapeHtml(string) {
|
function escapeHtml(string) {
|
||||||
const entityMap = {
|
const entityMap = {
|
||||||
|
|
@ -17,7 +16,7 @@ function escapeHtml(string) {
|
||||||
function getAllPaths(router) {
|
function getAllPaths(router) {
|
||||||
const paths = []
|
const paths = []
|
||||||
|
|
||||||
helper.dom.findAll('a:not([data-nosearch])').forEach(node => {
|
document.querySelectorAll('.sidebar-nav a:not(.section-link):not([data-nosearch])').forEach(node => {
|
||||||
const href = node.href
|
const href = node.href
|
||||||
const originHref = node.getAttribute('href')
|
const originHref = node.getAttribute('href')
|
||||||
const path = router.parse(href).path
|
const path = router.parse(href).path
|
||||||
|
|
@ -149,8 +148,6 @@ export function search(query) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function init(config, vm) {
|
export function init(config, vm) {
|
||||||
helper = Docsify
|
|
||||||
|
|
||||||
const isAuto = config.paths === 'auto'
|
const isAuto = config.paths === 'auto'
|
||||||
const isExpired = localStorage.getItem('docsify.search.expires') < Date.now()
|
const isExpired = localStorage.getItem('docsify.search.expires') < Date.now()
|
||||||
|
|
||||||
|
|
@ -171,7 +168,7 @@ export function init(config, vm) {
|
||||||
return count++
|
return count++
|
||||||
}
|
}
|
||||||
|
|
||||||
helper
|
Docsify
|
||||||
.get(vm.router.getFile(path), false, vm.config.requestHeaders)
|
.get(vm.router.getFile(path), false, vm.config.requestHeaders)
|
||||||
.then(result => {
|
.then(result => {
|
||||||
INDEXS[path] = genIndex(path, result, vm.router, config.depth)
|
INDEXS[path] = genIndex(path, result, vm.router, config.depth)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue