From 40591b219682440bafd72fb9d8beaba603310861 Mon Sep 17 00:00:00 2001 From: Joel Date: Tue, 26 Aug 2025 17:35:25 +0800 Subject: [PATCH] fix: not choose vars --- .../prompt-editor/plugins/shortcuts-popup-plugin/index.tsx | 4 ++-- .../nodes/_base/components/variable/var-reference-vars.tsx | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/web/app/components/base/prompt-editor/plugins/shortcuts-popup-plugin/index.tsx b/web/app/components/base/prompt-editor/plugins/shortcuts-popup-plugin/index.tsx index 19ff08e536..0fc7419dbf 100644 --- a/web/app/components/base/prompt-editor/plugins/shortcuts-popup-plugin/index.tsx +++ b/web/app/components/base/prompt-editor/plugins/shortcuts-popup-plugin/index.tsx @@ -258,8 +258,8 @@ export default function ShortcutsPopupPlugin({ if (!portalRef.current.contains(e.target as Node)) closePortal() } - document.addEventListener('mousedown', onMouseDown, true) - return () => document.removeEventListener('mousedown', onMouseDown, true) + document.addEventListener('mousedown', onMouseDown, false) + return () => document.removeEventListener('mousedown', onMouseDown, false) }, [open, closePortal]) const handleInsert = useCallback((command: LexicalCommand, params: any) => { diff --git a/web/app/components/workflow/nodes/_base/components/variable/var-reference-vars.tsx b/web/app/components/workflow/nodes/_base/components/variable/var-reference-vars.tsx index fe4de8e244..4fe9e69bce 100644 --- a/web/app/components/workflow/nodes/_base/components/variable/var-reference-vars.tsx +++ b/web/app/components/workflow/nodes/_base/components/variable/var-reference-vars.tsx @@ -150,6 +150,7 @@ const Item: FC = ({ }, [isHovering]) const handleChosen = (e: React.MouseEvent) => { e.stopPropagation() + e.nativeEvent.stopImmediatePropagation() if (!isSupportFileVar && isFile) return @@ -186,7 +187,10 @@ const Item: FC = ({ ) } onClick={handleChosen} - onMouseDown={e => e.preventDefault()} + onMouseDown={(e) => { + e.stopPropagation() + e.nativeEvent.stopImmediatePropagation() + }} >
{!isFlat &&