From 4f44afeec4216f8150b0ba160ed9e9924e212b5d Mon Sep 17 00:00:00 2001 From: kangfenmao Date: Fri, 17 Jan 2025 09:50:22 +0800 Subject: [PATCH] feat: auto focs input textarea #759 close #759 --- src/renderer/src/pages/home/Inputbar/Inputbar.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/renderer/src/pages/home/Inputbar/Inputbar.tsx b/src/renderer/src/pages/home/Inputbar/Inputbar.tsx index 0c0e3a9c..8d7a3154 100644 --- a/src/renderer/src/pages/home/Inputbar/Inputbar.tsx +++ b/src/renderer/src/pages/home/Inputbar/Inputbar.tsx @@ -388,6 +388,12 @@ const Inputbar: FC = ({ assistant: _assistant, setActiveTopic }) => { } }, []) + useEffect(() => { + window.addEventListener('focus', () => { + textareaRef.current?.focus() + }) + }, []) + const textareaRows = window.innerHeight >= 1000 || isBubbleStyle ? 2 : 1 const handleKnowledgeBaseSelect = (base?: KnowledgeBase) => {