Skip to content

Commit

Permalink
fix(search): fix default config
Browse files Browse the repository at this point in the history
  • Loading branch information
QingWei-Li committed Feb 19, 2017
1 parent 5153317 commit 2efd859
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/plugins/search/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ function bindEvents () {
if (!value) {
$panel.classList.remove('show')
$panel.innerHTML = ''
return
}
const matchs = search(value)

Expand Down
6 changes: 3 additions & 3 deletions src/plugins/search/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const CONFIG = {

const install = function (hook, vm) {
const util = Docsify.util
const opts = vm.config.search
const opts = vm.config.search || CONFIG

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

hook.mounted(_ => {
initComponet(CONFIG)
isAuto && initSearch(CONFIG, vm)
!isAuto && initSearch(CONFIG, vm)
})
hook.doneEach(_ => {
updateComponent(CONFIG, vm)
!isAuto && initSearch(CONFIG, vm)
isAuto && initSearch(CONFIG, vm)
})
}

Expand Down
2 changes: 1 addition & 1 deletion src/plugins/search/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export function genIndex (path, content = '') {
INDEXS[slug] = { slug, title: '', body: '' }
} else {
if (INDEXS[slug].body) {
INDEXS[slug].body += ('\n' + token.text)
INDEXS[slug].body += '\n' + (token.text || '')
} else {
INDEXS[slug].body = token.text
}
Expand Down

0 comments on commit 2efd859

Please # to comment.