try fix doc root not found errors
This commit is contained in:
parent
a2717c377e
commit
d067f4dd78
@ -20,7 +20,6 @@ export class FileDataModel {
|
||||
allAnnotations: AnnotationWrapper[] = [];
|
||||
readonly hasChangeLog$ = new BehaviorSubject<boolean>(false);
|
||||
missingTypes = new Set<string>();
|
||||
_textHighlightResponse: TextHighlightResponse;
|
||||
textHighlightAnnotations: AnnotationWrapper[] = [];
|
||||
|
||||
constructor(
|
||||
@ -43,8 +42,6 @@ export class FileDataModel {
|
||||
}
|
||||
|
||||
set textHighlights(textHighlightResponse: TextHighlightResponse) {
|
||||
this._textHighlightResponse = textHighlightResponse;
|
||||
|
||||
const highlights = [];
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
||||
for (const color of Object.keys(textHighlightResponse.redactionPerColor)) {
|
||||
@ -60,6 +57,7 @@ export class FileDataModel {
|
||||
if (viewMode === 'TEXT_HIGHLIGHTS') {
|
||||
return this.textHighlightAnnotations;
|
||||
}
|
||||
|
||||
return this.allAnnotations.filter(annotation => {
|
||||
if (viewMode === 'STANDARD') {
|
||||
return !annotation.isChangeLogRemoved;
|
||||
|
||||
@ -24,7 +24,6 @@ import {
|
||||
shareDistinctLast,
|
||||
shareLast,
|
||||
} from '@iqser/common-ui';
|
||||
import { PermissionsService } from '@services/permissions.service';
|
||||
import { BehaviorSubject, combineLatest, Observable } from 'rxjs';
|
||||
import { map, tap } from 'rxjs/operators';
|
||||
import { File } from '@red/domain';
|
||||
@ -35,7 +34,6 @@ import { SkippedService } from '../../services/skipped.service';
|
||||
import { FilePreviewStateService } from '../../services/file-preview-state.service';
|
||||
import { ViewModeService } from '../../services/view-mode.service';
|
||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||
import { PdfViewer } from '../../services/pdf-viewer.service';
|
||||
|
||||
const COMMAND_KEY_ARRAY = ['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown', 'Escape'];
|
||||
const ALL_HOTKEY_ARRAY = ['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown'];
|
||||
@ -72,7 +70,6 @@ export class FileWorkloadComponent {
|
||||
@ViewChild('quickNavigation') private readonly _quickNavigationElement: ElementRef;
|
||||
|
||||
constructor(
|
||||
private readonly _pdf: PdfViewer,
|
||||
readonly filterService: FilterService,
|
||||
readonly skippedService: SkippedService,
|
||||
readonly state: FilePreviewStateService,
|
||||
@ -81,7 +78,6 @@ export class FileWorkloadComponent {
|
||||
readonly excludedPagesService: ExcludedPagesService,
|
||||
private readonly _viewModeService: ViewModeService,
|
||||
private readonly _changeDetectorRef: ChangeDetectorRef,
|
||||
private readonly _permissionsService: PermissionsService,
|
||||
private readonly _annotationProcessingService: AnnotationProcessingService,
|
||||
) {
|
||||
this.displayedAnnotations$ = this._displayedAnnotations$;
|
||||
|
||||
@ -684,7 +684,9 @@ export class PdfViewerComponent extends AutoUnsubscribe implements OnInit, OnCha
|
||||
return entry;
|
||||
}
|
||||
|
||||
private _loadDocument(blob: Blob, file: File) {
|
||||
private async _loadDocument(blob: Blob, file: File) {
|
||||
const document = await this.instance.Core.documentViewer.getDocument()?.getPDFDoc();
|
||||
await document?.lock();
|
||||
this.instance.UI.loadDocument(blob, { filename: file?.filename ?? 'document.pdf' });
|
||||
this._pageRotationService.clearRotationsHideActions();
|
||||
}
|
||||
|
||||
@ -486,7 +486,12 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
|
||||
return;
|
||||
}
|
||||
|
||||
await clearStamps(pdfDoc, this._pdf.PDFNet, allPages);
|
||||
try {
|
||||
await clearStamps(pdfDoc, this._pdf.PDFNet, allPages);
|
||||
} catch (e) {
|
||||
console.log('Error clearing stamps: ', e);
|
||||
return;
|
||||
}
|
||||
|
||||
if (this._viewModeService.isRedacted) {
|
||||
const dossier = await this.stateService.dossier;
|
||||
|
||||
@ -86,10 +86,13 @@ export class AnnotationDrawService {
|
||||
}
|
||||
|
||||
private async _drawAnnotations(annotationWrappers: AnnotationWrapper[]) {
|
||||
if (!this._pdf.ready) {
|
||||
const document = await this._pdf.documentViewer.getDocument()?.getPDFDoc();
|
||||
if (!this._pdf.ready || !document) {
|
||||
return;
|
||||
}
|
||||
|
||||
await document.lock();
|
||||
|
||||
const annotations = annotationWrappers.map(annotation => this._computeAnnotation(annotation)).filter(a => !!a);
|
||||
this._pdf.instance.Core.annotationManager.addAnnotations(annotations, { imported: true });
|
||||
await this._pdf.instance.Core.annotationManager.drawAnnotationsFromList(annotations);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user