From 599e547b03763293fcbcb9a948b5d7cbbbaff749 Mon Sep 17 00:00:00 2001 From: Dan Percic Date: Tue, 15 Jun 2021 13:55:22 +0300 Subject: [PATCH] delete dossier on enter --- .../confirmation-dialog/confirmation-dialog.component.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/apps/red-ui/src/app/modules/shared/dialogs/confirmation-dialog/confirmation-dialog.component.ts b/apps/red-ui/src/app/modules/shared/dialogs/confirmation-dialog/confirmation-dialog.component.ts index 6c826afcb..bc1bfa48f 100644 --- a/apps/red-ui/src/app/modules/shared/dialogs/confirmation-dialog/confirmation-dialog.component.ts +++ b/apps/red-ui/src/app/modules/shared/dialogs/confirmation-dialog/confirmation-dialog.component.ts @@ -1,4 +1,4 @@ -import { Component, Inject } from '@angular/core'; +import { Component, HostListener, Inject } from '@angular/core'; import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; import { TranslateService } from '@ngx-translate/core'; @@ -52,6 +52,13 @@ export class ConfirmationDialogComponent { this.translate(this._inputLabelKey) + ` '${this.config.confirmationText}'`; } + @HostListener('window:keyup.enter') + onKeyupEnter() { + if (this.config.requireInput && !this.confirmationDoesNotMatch()) { + this.confirm(); + } + } + get isDeleteAction() { return this.config?.titleColor === TitleColors.PRIMARY; }