Skip to content

Commit

Permalink
feat(module:modal): support disable the esc key to close (#567)
Browse files Browse the repository at this point in the history
  • Loading branch information
hsuanxyz authored and vthinkxie committed Nov 16, 2017
1 parent b4824d9 commit 75bc6b6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/components/modal/nz-confirm.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,9 @@ export class NzConfirmComponent implements OnInit, OnDestroy {

@HostListener('keydown.esc', [ '$event' ])
onEsc(e): void {
this.subject.next('onCancel');
if (this._maskClosable) {
this.subject.next('onCancel');
}
}

@HostListener('keydown.enter', [ '$event' ])
Expand Down
4 changes: 3 additions & 1 deletion src/components/modal/nz-modal.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,9 @@ export class NzModalComponent implements OnInit, OnDestroy, AfterViewInit {

@HostListener('keydown.esc', [ '$event' ])
onEsc(e): void {
this.clickCancel(e);
if (this._maskClosable) {
this.clickCancel(e);
}
}

setStyles(origin?): void {
Expand Down

0 comments on commit 75bc6b6

Please sign in to comment.