mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-11 00:14:50 +03:00
Centralize tryToClose() for all popups
This commit is contained in:
parent
fa15742edb
commit
c33dd8f856
5 changed files with 8 additions and 13 deletions
|
|
@ -298,7 +298,7 @@ export class ComposePopupView extends AbstractViewPopup {
|
|||
]
|
||||
});
|
||||
|
||||
this.tryToClose = this.tryToClose.debounce(200);
|
||||
this.doClose = this.doClose.debounce(200);
|
||||
|
||||
this.iTimer = 0;
|
||||
|
||||
|
|
@ -665,7 +665,7 @@ export class ComposePopupView extends AbstractViewPopup {
|
|||
this.saveCommand();
|
||||
}
|
||||
|
||||
this.tryToClose();
|
||||
this.doClose();
|
||||
}
|
||||
|
||||
contactsCommand() {
|
||||
|
|
@ -1072,7 +1072,7 @@ export class ComposePopupView extends AbstractViewPopup {
|
|||
}, 100);
|
||||
}
|
||||
|
||||
tryToClose() {
|
||||
doClose() {
|
||||
if (AskPopupView.hidden()) {
|
||||
if (ComposePopupView.inEdit() || (this.isEmptyForm() && !this.draftUid())) {
|
||||
this.close();
|
||||
|
|
@ -1218,7 +1218,7 @@ export class ComposePopupView extends AbstractViewPopup {
|
|||
});
|
||||
|
||||
addShortcut('escape,close', 'shift', ScopeCompose, () => {
|
||||
this.tryToClose();
|
||||
this.doClose();
|
||||
return false;
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -314,10 +314,6 @@ export class ContactsPopupView extends AbstractViewPopup {
|
|||
}
|
||||
}
|
||||
|
||||
tryToClose() {
|
||||
(false === this.onClose()) || this.close();
|
||||
}
|
||||
|
||||
onClose() {
|
||||
const contact = this.contact();
|
||||
if (AskPopupView.hidden() && contact?.hasChanges()) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue