Skip to content

Commit

Permalink
in settings, implement pressing Escape key to exit settings (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
fuwako authored Feb 3, 2024
1 parent 9b52b02 commit fa4fbc5
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/pages/Settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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: '/' })
}
},
},
}
</script>
Expand Down

0 comments on commit fa4fbc5

Please sign in to comment.