mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-08-26 01:16:16 +00:00
Fixhancement: restore search highlighting and add for built-in viewer (#8885)
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { HttpClient } from '@angular/common/http'
|
||||
import { Component, Input, OnDestroy, ViewChild } from '@angular/core'
|
||||
import { NgbPopover, NgbPopoverModule } from '@ng-bootstrap/ng-bootstrap'
|
||||
import { PdfViewerModule } from 'ng2-pdf-viewer'
|
||||
import { PdfViewerComponent, PdfViewerModule } from 'ng2-pdf-viewer'
|
||||
import { NgxBootstrapIconsModule } from 'ngx-bootstrap-icons'
|
||||
import { first, Subject, takeUntil } from 'rxjs'
|
||||
import { Document } from 'src/app/data/document'
|
||||
@@ -57,6 +57,8 @@ export class PreviewPopupComponent implements OnDestroy {
|
||||
|
||||
@ViewChild('popover') popover: NgbPopover
|
||||
|
||||
@ViewChild('pdfViewer') pdfViewer: PdfViewerComponent
|
||||
|
||||
mouseOnPreview: boolean = false
|
||||
|
||||
popoverClass: string = 'shadow popover-preview'
|
||||
@@ -114,6 +116,18 @@ export class PreviewPopupComponent implements OnDestroy {
|
||||
}
|
||||
}
|
||||
|
||||
onPageRendered() {
|
||||
// Only triggered by the pngx pdf viewer
|
||||
if (this.documentService.searchQuery) {
|
||||
this.pdfViewer.eventBus.dispatch('find', {
|
||||
query: this.documentService.searchQuery,
|
||||
caseSensitive: false,
|
||||
highlightAll: true,
|
||||
phraseSearch: true,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
get previewUrl() {
|
||||
return this.documentService.getPreviewUrl(this.document.id)
|
||||
}
|
||||
|
Reference in New Issue
Block a user