notes panel auto toggle
This commit is contained in:
parent
b7850bc496
commit
98a689de2e
@ -8,7 +8,7 @@
|
||||
</mat-button-toggle-group>
|
||||
</div>
|
||||
</div>
|
||||
<redaction-pdf-viewer [fileId]="fileId" [fileType]="group.value"></redaction-pdf-viewer>
|
||||
<redaction-pdf-viewer [fileId]="fileId" [fileType]="group.value" [fileStatus]="appStateService.activeFile"></redaction-pdf-viewer>
|
||||
|
||||
<button (click)="showDetailsDialog($event)" aria-label="details" class="details-button" color="primary" mat-fab>
|
||||
<mat-icon svgIcon="red:info"></mat-icon>
|
||||
|
||||
@ -4,8 +4,8 @@ import {AppConfigService} from "../../../app-config/app-config.service";
|
||||
import {FileStatus, FileUploadControllerService} from "@redaction/red-ui-http";
|
||||
import {Observable, of} from "rxjs";
|
||||
import {tap} from "rxjs/operators";
|
||||
import WebViewer, {WebViewerInstance} from "@pdftron/webviewer";
|
||||
|
||||
declare const WebViewer: any;
|
||||
|
||||
export enum FileType {
|
||||
ORIGINAL = 'ORIGINAL',
|
||||
@ -25,7 +25,7 @@ export class PdfViewerComponent implements OnInit, AfterViewInit, OnChanges {
|
||||
@Input() fileStatus: FileStatus;
|
||||
|
||||
@ViewChild('viewer', {static: true}) viewer: ElementRef;
|
||||
wvInstance: any;
|
||||
wvInstance: WebViewerInstance;
|
||||
|
||||
_annotatedFileData: Blob;
|
||||
_originalFileData: Blob;
|
||||
@ -42,8 +42,10 @@ export class PdfViewerComponent implements OnInit, AfterViewInit, OnChanges {
|
||||
}
|
||||
|
||||
wvDocumentLoadedHandler(): void {
|
||||
const docViewer = this.wvInstance;
|
||||
const annotManager = this.wvInstance.annotManager;
|
||||
this.wvInstance.setFitMode('FitWidth');
|
||||
if(this.fileType === FileType.ANNOTATED){
|
||||
this.wvInstance.toggleElement('notesPanel')
|
||||
}
|
||||
}
|
||||
|
||||
ngAfterViewInit(): void {
|
||||
@ -55,7 +57,7 @@ export class PdfViewerComponent implements OnInit, AfterViewInit, OnChanges {
|
||||
ngOnChanges(changes: SimpleChanges): void {
|
||||
if (this.wvInstance) {
|
||||
this._loadFile().subscribe(data => {
|
||||
this.wvInstance.loadDocument(data, {filename: 'myfile.pdf'});
|
||||
this.wvInstance.loadDocument(data, {filename: this.fileStatus.filename});
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -66,7 +68,7 @@ export class PdfViewerComponent implements OnInit, AfterViewInit, OnChanges {
|
||||
}, this.viewer.nativeElement).then(instance => {
|
||||
this.wvInstance = instance;
|
||||
instance.docViewer.on('documentLoaded', this.wvDocumentLoadedHandler)
|
||||
instance.loadDocument(pdfBlob, {filename: 'myfile.pdf'});
|
||||
instance.loadDocument(pdfBlob, {filename: this.fileStatus.filename});
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user