RED-9944 - Action Items don't appear in document area in webviewer when bulk-select is still unintenionally active

This commit is contained in:
Valentin Mihai 2024-10-15 12:07:09 +03:00
parent aa171f992b
commit 1fcc95b138
3 changed files with 18 additions and 3 deletions

View File

@ -69,6 +69,7 @@ export class AnnotationsListComponent extends HasScrollbarDirective {
this._multiSelectService.activate();
}
this._listingService.selectAnnotations(annotation);
this._annotationManager.setSelectedFromWorkload();
}
referenceClicked(annotation: AnnotationWrapper): void {

View File

@ -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) {

View File

@ -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<string>());
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));
}