From 9e85552d8966f7408e2ae61b92b91d0b3ae40e59 Mon Sep 17 00:00:00 2001 From: liuweiqing Date: Tue, 13 Feb 2024 14:13:40 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=AE=B0=E5=BD=95selection=E4=BD=8D?= =?UTF-8?q?=E7=BD=AE=E4=BB=A5=E5=8F=8A=E8=87=AA=E5=8A=A8=E6=B8=85=E7=A9=BA?= =?UTF-8?q?UserInput=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/QuillEditor.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/components/QuillEditor.tsx b/components/QuillEditor.tsx index c40c96c..c109197 100644 --- a/components/QuillEditor.tsx +++ b/components/QuillEditor.tsx @@ -79,8 +79,11 @@ const QEditor = ({ lng }) => { //询问ai,用户输入 const [userInput, setUserInput] = useState(""); //quill编辑器鼠标位置 - const [cursorPosition, setCursorPosition] = useState(null); - + const [cursorPosition, setCursorPosition] = useLocalStorage( + "光标位置", + null + ); + // // 初始化 Quill 编辑器 const isMounted = useRef(false); const editor = useRef(null); @@ -236,6 +239,8 @@ const QEditor = ({ lng }) => { upsreamUrl, prompt ); + // 清空input内容 + setUserInput(""); // 重新获取更新后的内容并更新 Redux store const updatedContent = quill.root.innerHTML; dispatch(setEditorContent(updatedContent));