From 1fcc95b138078c6310b8f3a562523963bbcd6cca Mon Sep 17 00:00:00 2001 From: Valentin Mihai Date: Tue, 15 Oct 2024 12:07:09 +0300 Subject: [PATCH] RED-9944 - Action Items don't appear in document area in webviewer when bulk-select is still unintenionally active --- .../annotations-list/annotations-list.component.ts | 1 + .../file-preview/services/pdf-proxy.service.ts | 7 +++++-- .../services/annotation-manager.service.ts | 13 ++++++++++++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/apps/red-ui/src/app/modules/file-preview/components/annotations-list/annotations-list.component.ts b/apps/red-ui/src/app/modules/file-preview/components/annotations-list/annotations-list.component.ts index a6827d447..0ed6fb918 100644 --- a/apps/red-ui/src/app/modules/file-preview/components/annotations-list/annotations-list.component.ts +++ b/apps/red-ui/src/app/modules/file-preview/components/annotations-list/annotations-list.component.ts @@ -69,6 +69,7 @@ export class AnnotationsListComponent extends HasScrollbarDirective { this._multiSelectService.activate(); } this._listingService.selectAnnotations(annotation); + this._annotationManager.setSelectedFromWorkload(); } referenceClicked(annotation: AnnotationWrapper): void { 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 976be8626..1ff0e64ef 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 @@ -1,4 +1,4 @@ -import { computed, effect, inject, Injectable, NgZone } from '@angular/core'; +import { computed, effect, inject, Injectable, NgZone, untracked } from '@angular/core'; import { getConfig, IqserPermissionsService } from '@iqser/common-ui'; import { getCurrentUser } from '@iqser/common-ui/lib/users'; import { isJustOne, shareDistinctLast, UI_ROOT_PATH_FN } from '@iqser/common-ui/lib/utils'; @@ -402,11 +402,14 @@ export class PdfProxyService { const annotationChangesAllowed = !this.#isDocumine || !this._state.file().excludedFromAutomaticAnalysis; const somePending = annotationWrappers.some(a => a.pending); + const selectedFromWorkload = untracked(this._annotationManager.selectedFromWorkload); + actions = - this._multiSelectService.inactive() && !this._documentViewer.selectedText.length && !somePending + (this._multiSelectService.inactive() || !selectedFromWorkload) && !this._documentViewer.selectedText.length && !somePending ? [...actions, ...this._pdfAnnotationActionsService.get(annotationWrappers, annotationChangesAllowed)] : []; this._pdf.instance.UI.annotationPopup.update(actions); + this._annotationManager.resetSelectedFromWorkload(); } #getTitle(type: ManualRedactionEntryType) { diff --git a/apps/red-ui/src/app/modules/pdf-viewer/services/annotation-manager.service.ts b/apps/red-ui/src/app/modules/pdf-viewer/services/annotation-manager.service.ts index a2457e199..cb09aab24 100644 --- a/apps/red-ui/src/app/modules/pdf-viewer/services/annotation-manager.service.ts +++ b/apps/red-ui/src/app/modules/pdf-viewer/services/annotation-manager.service.ts @@ -1,5 +1,5 @@ import { inject, Injectable, signal } from '@angular/core'; -import { bool, List } from '@iqser/common-ui/lib/utils'; +import { bool, Debounce, List } from '@iqser/common-ui/lib/utils'; import { AnnotationWrapper } from '@models/file/annotation.wrapper'; import { Core } from '@pdftron/webviewer'; import { getLast, urlFileId } from '@utils/functions'; @@ -20,6 +20,7 @@ const MOVE_OPTION = 'move'; @Injectable() export class REDAnnotationManager { readonly #hidden = signal(new Set()); + readonly #selectedFromWorkload = signal(false); #manager: AnnotationManager; readonly #logger = inject(NGXLogger); readonly #annotationSelected$ = new Subject<[Annotation[], string]>(); @@ -27,6 +28,7 @@ export class REDAnnotationManager { resizingAnnotationId?: string = undefined; annotationHasBeenResized?: boolean = false; readonly hidden = this.#hidden.asReadonly(); + readonly selectedFromWorkload = this.#selectedFromWorkload.asReadonly(); get selected() { return this.#manager.getSelectedAnnotations(); @@ -161,6 +163,15 @@ export class REDAnnotationManager { }); } + setSelectedFromWorkload() { + this.#selectedFromWorkload.set(true); + } + + @Debounce() + resetSelectedFromWorkload() { + this.#selectedFromWorkload.set(false); + } + #getById(annotation: AnnotationWrapper | string) { return this.#manager.getAnnotationById(getId(annotation)); }