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)

This commit is contained in:
shaohuzhang1 2025-12-09 15:10:48 +08:00 committed by GitHub
parent e97ded9dc7
commit 32e5b3273f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -4,6 +4,7 @@ import { type GraphModel } from '@logicflow/core'
import { MsgSuccess, MsgError, MsgConfirm } from '@/utils/message'
import { WorkflowType } from '@/enums/application'
import { t } from '@/locales'
import { getMenuNodes } from './data'
let selected: any | null = null
function translationNodeData(nodeData: any, distance: any) {
@ -73,6 +74,9 @@ export function initDefaultShortcut(lf: LogicFlow, graph: GraphModel) {
const paste_node = () => {
if (!keyboardOptions?.enabled) return true
if (graph.textEditElement) return true
const menus = getMenuNodes(lf.graphModel.get_provide(null, null).workflowMode)
const nodes = menus?.flatMap((m: any) => m.list).map((n) => n.type)
selected.nodes = selected.nodes.filter((n: any) => nodes?.includes(n.type))
if (selected && (selected.nodes || selected.edges)) {
lf.clearSelectElements()
const addElements = lf.addElements(selected, CHILDREN_TRANSLATION_DISTANCE)