Centralize tryToClose() for all popups

This commit is contained in:
the-djmaze 2024-08-06 21:41:52 +02:00
parent fa15742edb
commit c33dd8f856
5 changed files with 8 additions and 13 deletions

View file

@ -60,10 +60,9 @@ export class AbstractViewPopup extends AbstractView
this.keyScope.scope = name;
this.modalVisible = ko.observable(false).extend({ rateLimit: 0 });
this.close = () => this.modalVisible(false);
this.tryToClose = () => (false === this.onClose()) || this.close();
addShortcut('escape,close', '', name, () => {
if (this.modalVisible() && false !== this.onClose()) {
this.close();
}
this.modalVisible() && this.tryToClose();
return false;
// return true; Issue with supported modal close
});