File tree Expand file tree Collapse file tree 3 files changed +12
-8
lines changed
Expand file tree Collapse file tree 3 files changed +12
-8
lines changed Original file line number Diff line number Diff line change 99
1010 - 重写Electron后端,将书籍管理放入 ` book.backend.ts ` 的类中
1111 - 将Electron的` index.ts ` 修改为类的形式
12- - 给图片重新加上了` findup ` 方法,将` images ` 插件修改为异步方式
12+ - 给图片重新加上了` findup ` 方法,将` images ` 插件修改为异步方式,实现图片自动查找
1313 - 发现` router.service.ts ` 中的判断 ` homepage ` 方法有问题,加以修改
14+ - 修正了 ` src/app/book/markdown-elements/toc-pagination.component.ts ` 中的几个问题,分页正常工作
1415 - 继续实现书籍删除、类别编辑
1516
1617+ 2020-12-12
Original file line number Diff line number Diff line change @@ -27,6 +27,8 @@ export class ContentSearchDirective {
2727 ] ;
2828 const el = elRef . nativeElement ;
2929
30+ this . searchService . init ( ) ;
31+
3032 const changeEvent = fromEvent ( el , 'change' ) ;
3133 const enterEvent = fromEvent ( el , 'keydown.enter' ) ;
3234
Original file line number Diff line number Diff line change @@ -54,7 +54,6 @@ export class SearchService {
5454 . use ( stringify ) ;
5555 }
5656
57-
5857 get bookPath ( ) {
5958 return this . settings . bookPath ;
6059 }
@@ -95,14 +94,16 @@ export class SearchService {
9594 } ) ;
9695 }
9796
98- async search ( query : string ) {
97+ init = ( ) => {
9998 if ( ! this . searchIndex ) {
100- this . loadSummary ( ) . subscribe ( paths => {
101- this . generateSearchIndex ( paths ) . then ( ( ) => {
102- this . search ( query ) ;
103- } ) ;
104- } ) ;
99+ this . loadSummary ( ) . subscribe ( paths => this . generateSearchIndex ( paths ) ) ;
100+
101+ return null ;
105102 }
103+ }
104+
105+ async search ( query : string ) {
106+ this . init ( ) ;
106107
107108 if ( typeof query !== 'string' || query . trim ( ) === '' ) {
108109 return null ;
You can’t perform that action at this time.
0 commit comments