Skip to content

Scripture: "Convert to show" has low shortcut precedence, keeps input focused #2822

@ktprograms

Description

@ktprograms

On 1.5.7-beta.2 (fb6390b).

After searching for a scripture, pressing Ctrl+N will "create" almost anything else (e.g. show sections, slides, etc.) rather than triggering the "Convert to show" action.

Looking at the code, this appears to be caused by the createScriptureShow handler being at the very bottom of the handler tree

else if (get(activePage) === "show" && get(activeDrawerTab) === "scripture") createScriptureShow()

I was able to fix it by moving that line to the top (above this first handler)

diff --git a/src/frontend/utils/shortcuts.ts b/src/frontend/utils/shortcuts.ts
index 0744bf3c..1a1b0888 100644
--- a/src/frontend/utils/shortcuts.ts
+++ b/src/frontend/utils/shortcuts.ts
@@ -414,7 +414,8 @@ export function closeContextMenu() {
 function createNew() {
     const selectId = get(selected)?.id || get(focusedArea)
 
-    if (selectId === "slide")
+    if (get(activePage) === "show" && get(activeDrawerTab) === "scripture") createScriptureShow()
+    else if (selectId === "slide")
         history({ id: "SLIDES" }) // show
     else if (selectId === "show")
         addSection() // project
@@ -429,7 +430,6 @@ function createNew() {
     else if (["action", "variable", "trigger"].includes(selectId)) activePopup.set(selectId as any)
     else if (get(activePage) === "edit") addItem("text")
     else if (get(activePage) === "stage") history({ id: "UPDATE", location: { page: "stage", id: "stage" } })
-    else if (get(activePage) === "show" && get(activeDrawerTab) === "scripture") createScriptureShow()
     else {
         console.info("CREATE NEW:", selectId)
         activePopup.set("show")

I presume this being at the very top of the handler precedence isn't desired, but I hope this can be fixed to an appropriate position where pressing Ctrl+N after searching for a scripture (the search box is focused), will create the show.


A related issue, after the "Convert to show" action, the search box remains focused, which means that pressing Space to present the show isn't possible.

Fixed with the following:

diff --git a/src/frontend/components/drawer/bible/scripture.ts b/src/frontend/components/drawer/bible/scripture.ts
index 37ea09d0..aded6de0 100644
--- a/src/frontend/components/drawer/bible/scripture.ts
+++ b/src/frontend/components/drawer/bible/scripture.ts
@@ -1422,6 +1422,8 @@ export async function createScriptureShow() {
     const show = await getScriptureShow(biblesContent)
     if (!show) return
 
+    ;(document.activeElement as any)?.blur()
+
     history({ id: "UPDATE", newData: { data: show, remember: { project: get(activeProject) } }, location: { page: "show", id: "show" } })
 }

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions