From e3e0c86aaf00bbc7a632eff8e9a347517bce9c20 Mon Sep 17 00:00:00 2001 From: lencx Date: Sun, 5 Mar 2023 10:12:46 +0800 Subject: [PATCH] feat: autofocus (#550) --- src-tauri/src/scripts/chat.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src-tauri/src/scripts/chat.js b/src-tauri/src/scripts/chat.js index 3ed89cb34..f3f6d1a89 100644 --- a/src-tauri/src/scripts/chat.js +++ b/src-tauri/src/scripts/chat.js @@ -9,6 +9,9 @@ async function init() { childList: true, subtree: true, }); + document.addEventListener('visibilitychange', () => + document.getElementsByTagName('textarea')[0]?.focus() + ); } function chatBtns() { @@ -92,6 +95,11 @@ function copyToClipboard(text, btn) { }, 1000); } +function focusOnInput() { + // This currently works because there is only a single `