diff --git a/apps/red-ui/src/app/modules/file-preview/services/pdf-proxy.service.ts b/apps/red-ui/src/app/modules/file-preview/services/pdf-proxy.service.ts index d75331b30..efc7871cf 100644 --- a/apps/red-ui/src/app/modules/file-preview/services/pdf-proxy.service.ts +++ b/apps/red-ui/src/app/modules/file-preview/services/pdf-proxy.service.ts @@ -58,7 +58,11 @@ export class PdfProxyService { readonly currentUser = getCurrentUser(); readonly pageChanged$ = this._pdf.pageChanged$.pipe( tap(() => this.#handleExcludedPageActions()), - tap(() => this._pdf.resetAnnotationActions()), + tap(() => { + if (this._multiSelectService.inactive()) { + this._annotationManager.deselect(); + } + }), shareDistinctLast(), ); readonly canPerformActions = computed(() => { @@ -143,7 +147,7 @@ export class PdfProxyService { onClick: () => this._ngZone.run(() => this.#addRectangleManualRedaction()), }; - this._pdf.instance.UI.annotationPopup.add([addRectangleButton]); + this._pdf.instance.UI.annotationPopup.update([addRectangleButton]); } } @@ -280,7 +284,6 @@ export class PdfProxyService { #processSelectedAnnotations(annotations: Annotation[], action: string) { let nextAnnotations: Annotation[]; - this._pdf.resetAnnotationActions(); if (action === 'deselected') { this.#cancelResizeIfIsResizing(annotations); @@ -360,6 +363,7 @@ export class PdfProxyService { return this.#configureRectangleAnnotationPopup(viewerAnnotations[0]); } + let actions = []; // Add hide action as last item const allAreImage = annotationWrappers.reduce((acc, next) => acc && next.isImage, true); if (allAreImage && !this._annotationManager.resizingAnnotationId) { @@ -383,11 +387,11 @@ export class PdfProxyService { }, }; - this._pdf.instance.UI.annotationPopup.add([visibilityButton]); + actions.push(visibilityButton); } - const actions = this._pdfAnnotationActionsService.get(annotationWrappers); - this._pdf.instance.UI.annotationPopup.add(actions); + actions = this._multiSelectService.inactive() ? [...actions, ...this._pdfAnnotationActionsService.get(annotationWrappers)] : []; + this._pdf.instance.UI.annotationPopup.update(actions); } #getTitle(type: ManualRedactionEntryType) { diff --git a/apps/red-ui/src/app/modules/pdf-viewer/services/pdf-viewer.service.ts b/apps/red-ui/src/app/modules/pdf-viewer/services/pdf-viewer.service.ts index c18823d15..5e31cd85a 100644 --- a/apps/red-ui/src/app/modules/pdf-viewer/services/pdf-viewer.service.ts +++ b/apps/red-ui/src/app/modules/pdf-viewer/services/pdf-viewer.service.ts @@ -124,13 +124,6 @@ export class PdfViewer { this.#instance.UI.closeElements(['searchPanel']); } - resetAnnotationActions() { - if (this.#instance.UI.annotationPopup.getItems().length) { - this.#logger.info('[PDF] Reset annotation actions'); - this.#instance.UI.annotationPopup.update([]); - } - } - navigateTo(page: string | number) { const parsedNumber = typeof page === 'string' ? parseInt(page, 10) : page; const paginationOffset = this.#paginationOffset; diff --git a/package.json b/package.json index 65fc01539..c051e8488 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "@ngx-translate/core": "15.0.0", "@ngx-translate/http-loader": "8.0.0", "@nx/angular": "16.10.0", - "@pdftron/webviewer": "10.3.0", + "@pdftron/webviewer": "10.5.0", "chart.js": "4.4.0", "dayjs": "1.11.10", "file-saver": "^2.0.5",