mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-12 09:29:02 +08:00
fix: workflow context menu popup issue (#7530)
This commit is contained in:
parent
a71fc18530
commit
9618f86980
@ -1,5 +1,6 @@
|
|||||||
import {
|
import {
|
||||||
memo,
|
memo,
|
||||||
|
useEffect,
|
||||||
useRef,
|
useRef,
|
||||||
} from 'react'
|
} from 'react'
|
||||||
import { useClickAway } from 'ahooks'
|
import { useClickAway } from 'ahooks'
|
||||||
@ -9,13 +10,18 @@ import type { Node } from './types'
|
|||||||
import { useStore } from './store'
|
import { useStore } from './store'
|
||||||
import { usePanelInteractions } from './hooks'
|
import { usePanelInteractions } from './hooks'
|
||||||
|
|
||||||
const PanelContextmenu = () => {
|
const NodeContextmenu = () => {
|
||||||
const ref = useRef(null)
|
const ref = useRef(null)
|
||||||
const nodes = useNodes()
|
const nodes = useNodes()
|
||||||
const { handleNodeContextmenuCancel } = usePanelInteractions()
|
const { handleNodeContextmenuCancel, handlePaneContextmenuCancel } = usePanelInteractions()
|
||||||
const nodeMenu = useStore(s => s.nodeMenu)
|
const nodeMenu = useStore(s => s.nodeMenu)
|
||||||
const currentNode = nodes.find(node => node.id === nodeMenu?.nodeId) as Node
|
const currentNode = nodes.find(node => node.id === nodeMenu?.nodeId) as Node
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (nodeMenu)
|
||||||
|
handlePaneContextmenuCancel()
|
||||||
|
}, [nodeMenu, handlePaneContextmenuCancel])
|
||||||
|
|
||||||
useClickAway(() => {
|
useClickAway(() => {
|
||||||
handleNodeContextmenuCancel()
|
handleNodeContextmenuCancel()
|
||||||
}, ref)
|
}, ref)
|
||||||
@ -42,4 +48,4 @@ const PanelContextmenu = () => {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export default memo(PanelContextmenu)
|
export default memo(NodeContextmenu)
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import {
|
import {
|
||||||
memo,
|
memo,
|
||||||
|
useEffect,
|
||||||
useRef,
|
useRef,
|
||||||
} from 'react'
|
} from 'react'
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
@ -23,11 +24,16 @@ const PanelContextmenu = () => {
|
|||||||
const clipboardElements = useStore(s => s.clipboardElements)
|
const clipboardElements = useStore(s => s.clipboardElements)
|
||||||
const setShowImportDSLModal = useStore(s => s.setShowImportDSLModal)
|
const setShowImportDSLModal = useStore(s => s.setShowImportDSLModal)
|
||||||
const { handleNodesPaste } = useNodesInteractions()
|
const { handleNodesPaste } = useNodesInteractions()
|
||||||
const { handlePaneContextmenuCancel } = usePanelInteractions()
|
const { handlePaneContextmenuCancel, handleNodeContextmenuCancel } = usePanelInteractions()
|
||||||
const { handleStartWorkflowRun } = useWorkflowStartRun()
|
const { handleStartWorkflowRun } = useWorkflowStartRun()
|
||||||
const { handleAddNote } = useOperator()
|
const { handleAddNote } = useOperator()
|
||||||
const { exportCheck } = useDSL()
|
const { exportCheck } = useDSL()
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (panelMenu)
|
||||||
|
handleNodeContextmenuCancel()
|
||||||
|
}, [panelMenu, handleNodeContextmenuCancel])
|
||||||
|
|
||||||
useClickAway(() => {
|
useClickAway(() => {
|
||||||
handlePaneContextmenuCancel()
|
handlePaneContextmenuCancel()
|
||||||
}, ref)
|
}, ref)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user