mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-03 05:11:31 -05:00
only apply keybind when visible
This commit is contained in:
@@ -128,18 +128,20 @@ export default defineComponent({
|
|||||||
mounted() {
|
mounted() {
|
||||||
// add keyhandlers
|
// add keyhandlers
|
||||||
window.addEventListener('keydown', (e) => {
|
window.addEventListener('keydown', (e) => {
|
||||||
if (e.key == 'ArrowUp') {
|
if (this.dialog) {
|
||||||
this.selected_result = Math.max(0, this.selected_result - 1)
|
if (e.key == 'ArrowUp') {
|
||||||
}
|
this.selected_result = Math.max(0, this.selected_result - 1)
|
||||||
if (e.key == 'ArrowDown') {
|
}
|
||||||
this.selected_result = Math.min(this.search_results.length, this.selected_result + 1)
|
if (e.key == 'ArrowDown') {
|
||||||
}
|
this.selected_result = Math.min(this.search_results.length, this.selected_result + 1)
|
||||||
if (e.key == 'Enter') {
|
}
|
||||||
this.goToSelectedRecipe()
|
if (e.key == 'Enter') {
|
||||||
}
|
this.goToSelectedRecipe()
|
||||||
if (e.key == 'k' && e.ctrlKey) {
|
}
|
||||||
this.dialog = true
|
if (e.key == 'k' && e.ctrlKey) {
|
||||||
e.preventDefault()
|
this.dialog = true
|
||||||
|
e.preventDefault()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user