File tree 2 files changed +11
-3
lines changed
2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change 1
1
/* 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' ;
3
3
import { init as initSearch } from './search' ;
4
4
5
5
const CONFIG = {
@@ -32,7 +32,7 @@ const install = function(hook, vm) {
32
32
const isAuto = CONFIG . paths === 'auto' ;
33
33
34
34
hook . mounted ( _ => {
35
- initComponet ( CONFIG , vm ) ;
35
+ initComponent ( CONFIG , vm ) ;
36
36
! isAuto && initSearch ( CONFIG , vm ) ;
37
37
} ) ;
38
38
hook . doneEach ( _ => {
Original file line number Diff line number Diff line change @@ -170,7 +170,10 @@ export function search(query) {
170
170
'...' +
171
171
escapeHtml ( postContent )
172
172
. 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
+ ) +
174
177
'...' ;
175
178
176
179
resultStr += matchContent ;
@@ -213,6 +216,11 @@ export function init(config, vm) {
213
216
const len = paths . length ;
214
217
let count = 0 ;
215
218
219
+ // Fix search error when exist translations documents
220
+ if ( INDEXS !== null && ! INDEXS [ paths [ 0 ] ] ) {
221
+ INDEXS = { } ;
222
+ }
223
+
216
224
paths . forEach ( path => {
217
225
if ( INDEXS [ path ] ) {
218
226
return count ++ ;
You can’t perform that action at this time.
0 commit comments