Prevent escape closing Discord and BetterDiscord menus/modals at the same time
This commit is contained in:
parent
d2f7e6142f
commit
7adf63dfa8
|
@ -45,6 +45,10 @@
|
||||||
if (this.$refs.settings.activeIndex !== -1) this.$refs.settings.closeContent();
|
if (this.$refs.settings.activeIndex !== -1) this.$refs.settings.closeContent();
|
||||||
else this.active = false;
|
else this.active = false;
|
||||||
e.stopImmediatePropagation();
|
e.stopImmediatePropagation();
|
||||||
|
},
|
||||||
|
prevent(e) {
|
||||||
|
if (this.active && e.which === 27)
|
||||||
|
e.stopImmediatePropagation();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
@ -68,12 +72,14 @@
|
||||||
Events.on('update-check-end', e => this.updating = 1);
|
Events.on('update-check-end', e => this.updating = 1);
|
||||||
Events.on('updates-available', e => this.updating = 2);
|
Events.on('updates-available', e => this.updating = 2);
|
||||||
window.addEventListener('keyup', this.keyupListener);
|
window.addEventListener('keyup', this.keyupListener);
|
||||||
|
window.addEventListener('keydown', this.prevent, true);
|
||||||
|
|
||||||
const menuKeybind = Settings.getSetting('core', 'default', 'menu-keybind');
|
const menuKeybind = Settings.getSetting('core', 'default', 'menu-keybind');
|
||||||
menuKeybind.on('keybind-activated', () => this.active = !this.active);
|
menuKeybind.on('keybind-activated', () => this.active = !this.active);
|
||||||
},
|
},
|
||||||
destroyed() {
|
destroyed() {
|
||||||
window.removeEventListener('keyup', this.keyupListener);
|
window.removeEventListener('keyup', this.keyupListener);
|
||||||
|
window.removeEventListener('keydown', this.prevent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue