From 7373f681725d34f6a35bab32cfc8979e5af6c2a8 Mon Sep 17 00:00:00 2001 From: zhaoying Date: Sat, 7 Mar 2026 14:52:00 +0800 Subject: [PATCH] fix(web): jinja2 editor bugfix --- .../components/Editor/plugin/InitialValuePlugin.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/web/src/views/Workflow/components/Editor/plugin/InitialValuePlugin.tsx b/web/src/views/Workflow/components/Editor/plugin/InitialValuePlugin.tsx index 481c61c2..b263120a 100644 --- a/web/src/views/Workflow/components/Editor/plugin/InitialValuePlugin.tsx +++ b/web/src/views/Workflow/components/Editor/plugin/InitialValuePlugin.tsx @@ -35,6 +35,12 @@ const InitialValuePlugin: React.FC = ({ value, options useEffect(() => { if (value !== prevValueRef.current || enableLineNumbers !== prevEnableLineNumbersRef.current) { + // Skip reset if the change was triggered by user input (avoid cursor jump) + if (isUserInputRef.current && enableLineNumbers === prevEnableLineNumbersRef.current) { + prevValueRef.current = value; + isUserInputRef.current = false; + return; + } queueMicrotask(() => { editor.update(() => { const root = $getRoot();