diff --git a/app/src/dialog/index.ts b/app/src/dialog/index.ts index ff02e57e4..6954e7bdc 100644 --- a/app/src/dialog/index.ts +++ b/app/src/dialog/index.ts @@ -66,9 +66,9 @@ export class Dialog { }); } - public bindInput(inputElement: HTMLInputElement, enterEvent?: () => void) { + public bindInput(inputElement: HTMLInputElement | HTMLTextAreaElement, enterEvent?: () => void) { inputElement.focus(); - inputElement.addEventListener("keydown", (event) => { + inputElement.addEventListener("keydown", (event: KeyboardEvent) => { if (event.isComposing) { event.preventDefault(); return; diff --git a/app/src/util/history.ts b/app/src/util/history.ts index 7232d21e7..fbb89f611 100644 --- a/app/src/util/history.ts +++ b/app/src/util/history.ts @@ -423,6 +423,9 @@ export const openHistory = () => { const textareaElement = genRepoDialog.element.querySelector("textarea"); textareaElement.focus(); const btnsElement = genRepoDialog.element.querySelectorAll(".b3-button"); + genRepoDialog.bindInput(textareaElement, () => { + (btnsElement[1] as HTMLButtonElement).click(); + }); btnsElement[0].addEventListener("click", () => { genRepoDialog.destroy(); }); @@ -475,6 +478,9 @@ export const openHistory = () => { btnsElement[0].addEventListener("click", () => { genTagDialog.destroy(); }); + genTagDialog.bindInput(inputElement, () => { + (btnsElement[1] as HTMLButtonElement).click(); + }); btnsElement[1].addEventListener("click", () => { fetchPost("/api/repo/tagSnapshot", { id: target.parentElement.getAttribute("data-id"),