From 57c23131b27ae53f37e3c1b36d092ff39e088920 Mon Sep 17 00:00:00 2001 From: yyhhyyyyyy Date: Fri, 1 Aug 2025 20:22:17 +0800 Subject: [PATCH] refactor: remove redundant nextTick in editor setText method --- src/renderer/src/components/ChatInput.vue | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/renderer/src/components/ChatInput.vue b/src/renderer/src/components/ChatInput.vue index 74b32e855..ae60c6d37 100644 --- a/src/renderer/src/components/ChatInput.vue +++ b/src/renderer/src/components/ChatInput.vue @@ -1023,13 +1023,11 @@ defineExpose({ inputText.value = text nextTick(() => { editor.chain().clearContent().insertContent(text).run() - nextTick(() => { - editor.view.updateState(editor.state) - setTimeout(() => { - const docSize = editor.state.doc.content.size - editor.chain().focus().setTextSelection(docSize).run() - }, 10) - }) + editor.view.updateState(editor.state) + setTimeout(() => { + const docSize = editor.state.doc.content.size + editor.chain().focus().setTextSelection(docSize).run() + }, 10) }) } })