mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-30 20:49:20 +03:00
Drop cancelCommand in favor of closeCommand and improve AbstractViewPopup handling
This commit is contained in:
parent
06b5b83588
commit
2edd55f01f
36 changed files with 82 additions and 118 deletions
|
|
@ -28,11 +28,8 @@ export class PluginPopupView extends AbstractViewPopup {
|
|||
hasConfiguration: () => 0 < this.config().length
|
||||
});
|
||||
|
||||
this.bDisabeCloseOnEsc = true;
|
||||
this.keyScope.scope = Scope.All;
|
||||
|
||||
this.tryToClosePopup = this.tryToClosePopup.debounce(200);
|
||||
|
||||
decorateKoCommands(this, {
|
||||
saveCommand: self => self.hasConfiguration()
|
||||
});
|
||||
|
|
@ -64,7 +61,7 @@ export class PluginPopupView extends AbstractViewPopup {
|
|||
Remote.request('AdminPluginSettingsUpdate',
|
||||
iError => iError
|
||||
? this.saveError(getNotification(iError))
|
||||
: this.cancelCommand(),
|
||||
: this.closeCommand(),
|
||||
oConfig);
|
||||
}
|
||||
|
||||
|
|
@ -98,21 +95,13 @@ export class PluginPopupView extends AbstractViewPopup {
|
|||
}
|
||||
}
|
||||
|
||||
tryToClosePopup() {
|
||||
onClose() {
|
||||
if (AskPopupView.hidden()) {
|
||||
showScreenPopup(AskPopupView, [
|
||||
i18n('POPUPS_ASK/DESC_WANT_CLOSE_THIS_WINDOW'),
|
||||
() => this.modalVisibility() && this.cancelCommand()
|
||||
() => this.closeCommand()
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
onBuild() {
|
||||
shortcuts.add('escape', '', Scope.All, () => {
|
||||
if (this.modalVisibility()) {
|
||||
this.tryToClosePopup();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue