fix RED-2977

This commit is contained in:
Dan Percic 2021-12-09 17:40:59 +02:00
parent 01f2309375
commit c498065338

View File

@ -404,7 +404,7 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
async viewerReady($event: WebViewerInstance) {
this._instance = $event;
await this._stampPDF();
await this._cleanupAndRedrawManualAnnotations$().toPromise();
await this._cleanupAndRedrawManualAnnotations();
this._setExcludedPageStyles();
this._instance.Core.documentViewer.addEventListener('pageComplete', () => {
@ -554,7 +554,7 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
await this._loadFileData(file, !this._reloadFileOnReanalysis);
this._reloadFileOnReanalysis = false;
this._loadingService.stop();
await this._cleanupAndRedrawManualAnnotations$().toPromise();
await this._cleanupAndRedrawManualAnnotations();
});
}
@ -584,13 +584,19 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
this._workloadComponent?.scrollAnnotations();
}
/* Get the documentElement (<html>) to display the page in fullscreen */
private async _cleanupAndRedrawManualAnnotations() {
const currentAnnotations = this.annotations;
this.fileData.redactionLog = await this._fileDownloadService.loadRedactionLogFor(this.dossierId, this.fileId).toPromise();
this.rebuildFilters();
private _cleanupAndRedrawManualAnnotations$() {
return this._fileDownloadService.loadRedactionLogFor(this.dossierId, this.fileId).pipe(
tap(redactionLog => (this.fileData.redactionLog = redactionLog)),
switchMap(() => this._redrawAnnotations()),
);
if (this.viewModeService.viewMode === 'STANDARD') {
currentAnnotations.forEach(annotation => {
this._findAndDeleteAnnotation(annotation.id);
});
const newAnnotations = this.annotations;
this._handleDeltaAnnotationFilters(currentAnnotations, newAnnotations);
await this._redrawAnnotations(newAnnotations);
}
}
private async _cleanupAndRedrawManualAnnotationsForEntirePage(page: number) {
@ -643,7 +649,7 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
}
private _findAndDeleteAnnotation(id: string) {
const viewerAnnotation = this._instance.Core.annotationManager.getAnnotationById(id);
const viewerAnnotation = this._instance?.Core.annotationManager.getAnnotationById(id);
if (viewerAnnotation) {
this._instance.Core.annotationManager.deleteAnnotation(viewerAnnotation, {
imported: true,