File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change 11/* eslint-disable no-unused-vars */
2- import { init as initComponet , update as updateComponent } from './component' ;
2+ import { init as initComponent , update as updateComponent } from './component' ;
33import { init as initSearch } from './search' ;
44
55const CONFIG = {
@@ -32,7 +32,7 @@ const install = function(hook, vm) {
3232 const isAuto = CONFIG . paths === 'auto' ;
3333
3434 hook . mounted ( _ => {
35- initComponet ( CONFIG , vm ) ;
35+ initComponent ( CONFIG , vm ) ;
3636 ! isAuto && initSearch ( CONFIG , vm ) ;
3737 } ) ;
3838 hook . doneEach ( _ => {
Original file line number Diff line number Diff line change @@ -170,7 +170,10 @@ export function search(query) {
170170 '...' +
171171 escapeHtml ( postContent )
172172 . substring ( start , end )
173- . replace ( regEx , `<em class="search-keyword">${ keyword } </em>` ) +
173+ . replace (
174+ regEx ,
175+ word => `<em class="search-keyword">${ word } </em>`
176+ ) +
174177 '...' ;
175178
176179 resultStr += matchContent ;
@@ -213,6 +216,11 @@ export function init(config, vm) {
213216 const len = paths . length ;
214217 let count = 0 ;
215218
219+ // Fix search error when exist translations documents
220+ if ( INDEXS !== null && ! INDEXS [ paths [ 0 ] ] ) {
221+ INDEXS = { } ;
222+ }
223+
216224 paths . forEach ( path => {
217225 if ( INDEXS [ path ] ) {
218226 return count ++ ;
You can’t perform that action at this time.
0 commit comments