Merge pull request #82 from JsSucks/fullscreen-modals

Merge
This commit is contained in:
Alexei Stukov 2018-02-04 14:22:06 +02:00 committed by GitHub
commit 2befa12cc4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 0 deletions

View File

@ -40,6 +40,7 @@
hideSettings() { this.active = false },
toggleSettings() { this.active = !this.active },
keyupListener(e) {
if (document.getElementsByClassName('bd-backdrop').length) return;
if (this.active && e.which === 27) return this.hideSettings();
if (!e.metaKey && !e.ctrlKey || e.key !== 'b') return;
this.toggleSettings();

View File

@ -44,6 +44,19 @@
return {
scrolled: false
};
},
beforeMount() {
window.addEventListener('keyup', this.keyupListener);
},
destroyed() {
window.removeEventListener('keyup', this.keyupListener);
},
methods: {
keyupListener(e) {
if (e.which === 27) {
this.close();
}
}
}
}
</script>