mirror of
https://github.com/langgenius/dify.git
synced 2026-05-06 02:18:08 +08:00
comment input mode click empty place can close
This commit is contained in:
@ -4,10 +4,10 @@ import { useWorkflowComment } from './hooks/use-workflow-comment'
|
|||||||
|
|
||||||
const CommentManager = () => {
|
const CommentManager = () => {
|
||||||
const workflowStore = useWorkflowStore()
|
const workflowStore = useWorkflowStore()
|
||||||
const { handleCreateComment } = useWorkflowComment()
|
const { handleCreateComment, handleCommentCancel } = useWorkflowComment()
|
||||||
|
|
||||||
useEventListener('click', (e) => {
|
useEventListener('click', (e) => {
|
||||||
const { controlMode, mousePosition } = workflowStore.getState()
|
const { controlMode, mousePosition, pendingComment } = workflowStore.getState()
|
||||||
|
|
||||||
if (controlMode === 'comment') {
|
if (controlMode === 'comment') {
|
||||||
const target = e.target as HTMLElement
|
const target = e.target as HTMLElement
|
||||||
@ -20,7 +20,10 @@ const CommentManager = () => {
|
|||||||
if (!isInDropdown && !isInCommentInput && isOnCanvasPane) {
|
if (!isInDropdown && !isInCommentInput && isOnCanvasPane) {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
handleCreateComment(mousePosition)
|
if (pendingComment)
|
||||||
|
handleCommentCancel()
|
||||||
|
else
|
||||||
|
handleCreateComment(mousePosition)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user