Skip to content

Commit 2efd859

Browse files
committed
fix(search): fix default config
1 parent 5153317 commit 2efd859

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

src/plugins/search/component.js

+1
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ function bindEvents () {
9191
if (!value) {
9292
$panel.classList.remove('show')
9393
$panel.innerHTML = ''
94+
return
9495
}
9596
const matchs = search(value)
9697

src/plugins/search/index.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const CONFIG = {
99

1010
const install = function (hook, vm) {
1111
const util = Docsify.util
12-
const opts = vm.config.search
12+
const opts = vm.config.search || CONFIG
1313

1414
if (Array.isArray(opts)) {
1515
CONFIG.paths = opts
@@ -23,11 +23,11 @@ const install = function (hook, vm) {
2323

2424
hook.mounted(_ => {
2525
initComponet(CONFIG)
26-
isAuto && initSearch(CONFIG, vm)
26+
!isAuto && initSearch(CONFIG, vm)
2727
})
2828
hook.doneEach(_ => {
2929
updateComponent(CONFIG, vm)
30-
!isAuto && initSearch(CONFIG, vm)
30+
isAuto && initSearch(CONFIG, vm)
3131
})
3232
}
3333

src/plugins/search/search.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export function genIndex (path, content = '') {
5252
INDEXS[slug] = { slug, title: '', body: '' }
5353
} else {
5454
if (INDEXS[slug].body) {
55-
INDEXS[slug].body += ('\n' + token.text)
55+
INDEXS[slug].body += '\n' + (token.text || '')
5656
} else {
5757
INDEXS[slug].body = token.text
5858
}

0 commit comments

Comments
 (0)