Skip to content

Commit 32e5b32

Browse files
authored
fix: The loop nodes in the canvas are prohibited from being copied into the loop body, and the continue and break nodes inside the loop body are also prohibited from being copied into the loop body (#4470)
1 parent e97ded9 commit 32e5b32

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

ui/src/workflow/common/shortcut.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { type GraphModel } from '@logicflow/core'
44
import { MsgSuccess, MsgError, MsgConfirm } from '@/utils/message'
55
import { WorkflowType } from '@/enums/application'
66
import { t } from '@/locales'
7+
import { getMenuNodes } from './data'
78
let selected: any | null = null
89

910
function translationNodeData(nodeData: any, distance: any) {
@@ -73,6 +74,9 @@ export function initDefaultShortcut(lf: LogicFlow, graph: GraphModel) {
7374
const paste_node = () => {
7475
if (!keyboardOptions?.enabled) return true
7576
if (graph.textEditElement) return true
77+
const menus = getMenuNodes(lf.graphModel.get_provide(null, null).workflowMode)
78+
const nodes = menus?.flatMap((m: any) => m.list).map((n) => n.type)
79+
selected.nodes = selected.nodes.filter((n: any) => nodes?.includes(n.type))
7680
if (selected && (selected.nodes || selected.edges)) {
7781
lf.clearSelectElements()
7882
const addElements = lf.addElements(selected, CHILDREN_TRANSLATION_DISTANCE)

0 commit comments

Comments
 (0)