From a5ec05acbca9f71f375facd55f70460d0953616d Mon Sep 17 00:00:00 2001 From: hjlarry Date: Wed, 5 Nov 2025 17:41:10 +0800 Subject: [PATCH] comment input mode click empty place can close --- web/app/components/workflow/comment-manager.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/web/app/components/workflow/comment-manager.tsx b/web/app/components/workflow/comment-manager.tsx index 03dbe583f2..e5817eb6b1 100644 --- a/web/app/components/workflow/comment-manager.tsx +++ b/web/app/components/workflow/comment-manager.tsx @@ -4,10 +4,10 @@ import { useWorkflowComment } from './hooks/use-workflow-comment' const CommentManager = () => { const workflowStore = useWorkflowStore() - const { handleCreateComment } = useWorkflowComment() + const { handleCreateComment, handleCommentCancel } = useWorkflowComment() useEventListener('click', (e) => { - const { controlMode, mousePosition } = workflowStore.getState() + const { controlMode, mousePosition, pendingComment } = workflowStore.getState() if (controlMode === 'comment') { const target = e.target as HTMLElement @@ -20,7 +20,10 @@ const CommentManager = () => { if (!isInDropdown && !isInCommentInput && isOnCanvasPane) { e.preventDefault() e.stopPropagation() - handleCreateComment(mousePosition) + if (pendingComment) + handleCommentCancel() + else + handleCreateComment(mousePosition) } } })