From 194fe5a63e047568a99ec0ffb35acd61e047d3e8 Mon Sep 17 00:00:00 2001 From: Tuomas Airaksinen Date: Thu, 12 Oct 2023 19:06:59 +0300 Subject: [PATCH] Add key bindings to bookmark ambiguous modal (one tap modal) #2622 --- .../src/components/AmbiguousActionButtons.vue | 15 +++++++++++++++ .../src/components/modals/AmbiguousSelection.vue | 6 ++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/app/bibleview-js/src/components/AmbiguousActionButtons.vue b/app/bibleview-js/src/components/AmbiguousActionButtons.vue index d5db71a529..f1163448fa 100644 --- a/app/bibleview-js/src/components/AmbiguousActionButtons.vue +++ b/app/bibleview-js/src/components/AmbiguousActionButtons.vue @@ -57,6 +57,7 @@ import {useCommon} from "@/composables"; import {androidKey, modalKey} from "@/types/constants"; import {SelectionInfo} from "@/types/common"; import {BibleModalButtonId, GenericModalButtonId} from "@/composables/config"; +import {setupDocumentEventListener} from "@/utils"; const props = withDefaults(defineProps<{ selectionInfo: SelectionInfo @@ -136,6 +137,20 @@ function speak() { } closeModals() } + +setupDocumentEventListener("keydown", (e: KeyboardEvent) => { + if (e.key.toLowerCase() === "b") { + addBookmark(); + } else if (e.key.toLowerCase() === "n") { + addNote(); + } else if (e.code === "Space") { + speak(); + } else { + return; + } + e.preventDefault() + e.stopPropagation() +})