PDF search improvements

This commit is contained in:
Adina Țeudan 2021-01-12 17:53:18 +02:00
parent 2e8bf93aca
commit ae637ec4a1
3 changed files with 28 additions and 3 deletions

View File

@ -1,3 +1,5 @@
<div class="page">
<div #viewer [id]="fileStatus.fileId" class="viewer"></div>
</div>
<mat-spinner class="searching" *ngIf="searching" diameter="20"></mat-spinner>

View File

@ -8,3 +8,9 @@
.viewer {
height: 100%;
}
.searching {
position: absolute;
bottom: 30px;
right: 30px;
}

View File

@ -1,4 +1,17 @@
import { AfterViewInit, Component, ElementRef, EventEmitter, Input, NgZone, OnChanges, OnInit, Output, SimpleChanges, ViewChild } from '@angular/core';
import {
AfterViewInit,
ChangeDetectorRef,
Component,
ElementRef,
EventEmitter,
Input,
NgZone,
OnChanges,
OnInit,
Output,
SimpleChanges,
ViewChild
} from '@angular/core';
import { AppConfigService } from '../../../app-config/app-config.service';
import { ManualRedactionEntry, Rectangle } from '@redaction/red-ui-http';
import WebViewer, { Annotations, WebViewerInstance } from '@pdftron/webviewer';
@ -34,6 +47,8 @@ export class PdfViewerComponent implements OnInit, AfterViewInit, OnChanges {
private _viewerState: ViewerState = null; // no initial state
private _selectedText = '';
public searching = false;
@Input() fileData: Blob;
@Input() fileStatus: FileStatusWrapper;
@Input() canPerformActions = false;
@ -63,7 +78,8 @@ export class PdfViewerComponent implements OnInit, AfterViewInit, OnChanges {
private readonly _ngZone: NgZone,
private readonly _userPreferenceService: UserPreferenceService,
private readonly _annotationDrawService: AnnotationDrawService,
private readonly _annotationActionsService: AnnotationActionsService
private readonly _annotationActionsService: AnnotationActionsService,
private readonly _changeDetectorRef: ChangeDetectorRef
) {}
ngOnInit() {
@ -111,7 +127,8 @@ export class PdfViewerComponent implements OnInit, AfterViewInit, OnChanges {
});
instance.docViewer.on('searchInProgress', (inProgress) => {
console.log(inProgress);
this.searching = inProgress;
this._changeDetectorRef.detectChanges();
});
instance.docViewer.on('pageNumberUpdated', (p) => {