Merge branch 'RED-8755' into 'master'

RED-8755: deselect all annotations on esc even when user is unassigned.

See merge request redactmanager/red-ui!376
This commit is contained in:
Dan Percic 2024-04-04 12:11:24 +02:00
commit 30c7dfcb65
3 changed files with 19 additions and 3 deletions

View File

@ -316,9 +316,6 @@ export class FilePreviewScreenComponent
@Bind()
handleEscInsideViewer($event: KeyboardEvent) {
$event.preventDefault();
if (this._multiSelectService.active()) {
this._multiSelectService.deactivate();
}
if (!!this._annotationManager.selected[0]) {
const doesHaveWrapper = this._fileDataService.find(this._annotationManager.selected[0]?.Id);
if (!doesHaveWrapper) {
@ -327,6 +324,14 @@ export class FilePreviewScreenComponent
this._annotationManager.deselect(this._annotationManager.selected[0]?.Id);
}
}
if (this._annotationManager.selected.length) {
this._annotationManager.deselectAll();
}
if (this._multiSelectService.active()) {
this._multiSelectService.deactivate();
}
}
async ngOnAttach(previousRoute: ActivatedRouteSnapshot) {
@ -425,9 +430,15 @@ export class FilePreviewScreenComponent
.find(annotation => annotation.id === this._annotationManager.resizingAnnotationId);
this._annotationActionsService.cancelResize(resizedAnnotation).then();
}
if (this._annotationManager.selected.length) {
this._annotationManager.deselectAll();
}
if (this._multiSelectService.active()) {
this._multiSelectService.deactivate();
}
this.fullScreen = false;
this.closeFullScreen();
this._changeRef.markForCheck();

View File

@ -98,6 +98,10 @@ export class REDAnnotationManager {
this.#manager.deselectAnnotations(ann);
}
deselectAll() {
this.deselect(this.selected.map(annotation => annotation.Id));
}
hide(annotations: Annotation[]): void {
this.#manager.hideAnnotations(annotations);
}

View File

@ -274,6 +274,7 @@ export class PdfViewer {
this.#instance.UI.hotkeys.on('esc', {
keydown: e => {
e.preventDefault();
this.#clickSelectToolButton();
},
keyup: e => {
e.preventDefault();