Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: 快照回车绑定

Vanessa7ee9691a8c5b
diff --git a/app/src/dialog/index.ts b/app/src/dialog/index.ts
index ff02e57e40..6954e7bdce 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 7232d21e7b..fbb89f6115 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"),