diff --git a/scripts/popup.js b/scripts/popup.js index a912fce..9ed6649 100644 --- a/scripts/popup.js +++ b/scripts/popup.js @@ -260,7 +260,7 @@ document.addEventListener("DOMContentLoaded", async () => { }); input.addEventListener("keydown", e => { if (e.key === "Enter") { - log("按下回车键"); + e.preventDefault(); triggerSearch(); } }); @@ -301,8 +301,11 @@ document.addEventListener("DOMContentLoaded", async () => { fetchLLMAnswer(val, llmResultContainer, llmResultContent); }); - llmInput.addEventListener("keydown", (e) => { - if (e.key === "Enter") llmSendBtn.click(); + llmInput.addEventListener("keydown", e => { + if (e.key === "Enter") { + e.preventDefault(); + document.getElementById("llmSendBtn").click(); + } }); openTabBtn.onclick = () => {