mirror of
http://112.124.100.131/huang.ze/ebiz-dify-ai.git
synced 2025-12-11 03:46:52 +08:00
fix: node shortcuts active in input fields (#3438)
This commit is contained in:
@@ -721,8 +721,12 @@ export const useNodesInteractions = () => {
|
||||
|
||||
const {
|
||||
setClipboardElements,
|
||||
shortcutsDisabled,
|
||||
} = workflowStore.getState()
|
||||
|
||||
if (shortcutsDisabled)
|
||||
return
|
||||
|
||||
const {
|
||||
getNodes,
|
||||
} = store.getState()
|
||||
@@ -741,8 +745,12 @@ export const useNodesInteractions = () => {
|
||||
|
||||
const {
|
||||
clipboardElements,
|
||||
shortcutsDisabled,
|
||||
} = workflowStore.getState()
|
||||
|
||||
if (shortcutsDisabled)
|
||||
return
|
||||
|
||||
const {
|
||||
getNodes,
|
||||
setNodes,
|
||||
@@ -803,6 +811,13 @@ export const useNodesInteractions = () => {
|
||||
if (getNodesReadOnly())
|
||||
return
|
||||
|
||||
const {
|
||||
shortcutsDisabled,
|
||||
} = workflowStore.getState()
|
||||
|
||||
if (shortcutsDisabled)
|
||||
return
|
||||
|
||||
const {
|
||||
getNodes,
|
||||
} = store.getState()
|
||||
@@ -815,7 +830,7 @@ export const useNodesInteractions = () => {
|
||||
|
||||
for (const node of nodesToDelete)
|
||||
handleNodeDelete(node.id)
|
||||
}, [getNodesReadOnly, handleNodeDelete, store])
|
||||
}, [getNodesReadOnly, handleNodeDelete, store, workflowStore])
|
||||
|
||||
return {
|
||||
handleNodeDragStart,
|
||||
|
||||
@@ -331,6 +331,16 @@ export const useWorkflow = () => {
|
||||
return nodes.find(node => node.id === nodeId) || nodes.find(node => node.data.type === BlockEnum.Start)
|
||||
}, [store])
|
||||
|
||||
const enableShortcuts = useCallback(() => {
|
||||
const { setShortcutsDisabled } = workflowStore.getState()
|
||||
setShortcutsDisabled(false)
|
||||
}, [workflowStore])
|
||||
|
||||
const disableShortcuts = useCallback(() => {
|
||||
const { setShortcutsDisabled } = workflowStore.getState()
|
||||
setShortcutsDisabled(true)
|
||||
}, [workflowStore])
|
||||
|
||||
return {
|
||||
handleLayout,
|
||||
getTreeLeafNodes,
|
||||
@@ -345,6 +355,8 @@ export const useWorkflow = () => {
|
||||
renderTreeFromRecord,
|
||||
getNode,
|
||||
getBeforeNodeById,
|
||||
enableShortcuts,
|
||||
disableShortcuts,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user