1
1
mirror of https://github.com/Fabio286/antares.git synced 2025-06-05 21:59:22 +02:00

feat: close modals pressing ESC

This commit is contained in:
2020-10-04 17:21:21 +02:00
parent 6ee4ef4b8b
commit d563cec70d
8 changed files with 76 additions and 5 deletions

View File

@ -164,6 +164,10 @@ export default {
this.localLocale = this.selectedLocale;
this.localTimeout = this.notificationsTimeout;
this.selectedTab = this.selectedSettingTab;
window.addEventListener('keydown', this.onKey);
},
beforeDestroy () {
window.removeEventListener('keydown', this.onKey);
},
methods: {
...mapActions({
@ -182,6 +186,11 @@ export default {
this.localTimeout = 10;
this.updateNotificationsTimeout(+this.localTimeout);
},
onKey (e) {
e.stopPropagation();
if (e.key === 'Escape')
this.closeModal();
}
}
};