From 2990779d5913108ab1cd96773e48e399304f1294 Mon Sep 17 00:00:00 2001 From: FatMii <39074672+FatMii@users.noreply.github.com> Date: Thu, 26 Jun 2025 19:28:46 +0800 Subject: [PATCH] =?UTF-8?q?fix(prompt-editor):=20resolve=20initial=20curso?= =?UTF-8?q?r=20position=20and=20auto-newline=20=E2=80=A6=20(#8511)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### What problem does this PR solve? In web folder's prompt-editor component, when entering content for the first time, the cursor position is abnormal and it will automatically wrap ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) Co-authored-by: leonlai --- web/src/components/prompt-editor/variable-picker-plugin.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/web/src/components/prompt-editor/variable-picker-plugin.tsx b/web/src/components/prompt-editor/variable-picker-plugin.tsx index 7aeb798b6..6e92d14f9 100644 --- a/web/src/components/prompt-editor/variable-picker-plugin.tsx +++ b/web/src/components/prompt-editor/variable-picker-plugin.tsx @@ -224,6 +224,9 @@ export default function VariablePickerMenuPlugin({ } $getRoot().clear().append(paragraph); + if ($isRangeSelection($getSelection())) { + $getRoot().selectEnd(); + } }, [findLabelByValue], );