From fa4fbc5421875b04e0c5d71b58ff3c9e3fffa5c5 Mon Sep 17 00:00:00 2001 From: Saya <117558001+fuwako@users.noreply.github.com> Date: Fri, 2 Feb 2024 20:13:17 -0500 Subject: [PATCH] in settings, implement pressing Escape key to exit settings (#29) --- src/pages/Settings.vue | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/pages/Settings.vue b/src/pages/Settings.vue index a00cdf33..593e84b0 100644 --- a/src/pages/Settings.vue +++ b/src/pages/Settings.vue @@ -172,11 +172,21 @@ export default { this.update_available = true }) } + + window.addEventListener('keydown', this.handleKeyDown) + }, + unmounted() { + window.removeEventListener('keydown', this.handleKeyDown) }, methods: { open_external(link: string) { window.open(link, '_blank') }, + handleKeyDown(event: KeyboardEvent) { + if (event.key === 'Escape') { + this.$router.push({ path: '/' }) + } + }, }, }