Skip to content

Commit

Permalink
Add key bindings to bookmark ambiguous modal (one tap modal) #2622
Browse files Browse the repository at this point in the history
  • Loading branch information
tuomas2 committed Oct 12, 2023
1 parent 0a57c36 commit 194fe5a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
15 changes: 15 additions & 0 deletions app/bibleview-js/src/components/AmbiguousActionButtons.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
})
</script>

<style scoped lang="scss">
Expand Down
6 changes: 4 additions & 2 deletions app/bibleview-js/src/components/modals/AmbiguousSelection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -355,10 +355,12 @@ function help() {
setupDocumentEventListener("keydown", (e: KeyboardEvent) => {
if (!showModal.value) return
if (e.key === "+") {
else if (e.key === "+") {
multiSelectionButtonClicked()
e.preventDefault()
e.stopPropagation()
}
if (e.ctrlKey && e.code === "KeyC") {
else if (e.ctrlKey && e.code === "KeyC") {
if (selectionInfo.value?.verseInfo) {
console.log("Ctrl + c pressed. Copying (book initial, start ordinal, end ordinal)", selectionInfo.value?.verseInfo.bookInitials, startOrdinal.value, endOrdinal.value)
android.copyVerse(selectionInfo.value.verseInfo.bookInitials, startOrdinal.value!, endOrdinal.value!)
Expand Down

0 comments on commit 194fe5a

Please sign in to comment.