()
| 92 | options: { keyboard: keyboardOptions }, |
| 93 | } = keyboard |
| 94 | const copy_node = () => { |
| 95 | CHILDREN_TRANSLATION_DISTANCE = TRANSLATION_DISTANCE |
| 96 | if (!keyboardOptions?.enabled) return true |
| 97 | if (graph.textEditElement) return true |
| 98 | const { guards } = lf.options |
| 99 | const elements = graph.getSelectElements(false) |
| 100 | const enabledClone = guards && guards.beforeClone ? guards.beforeClone(elements) : true |
| 101 | if (!enabledClone || (elements.nodes.length === 0 && elements.edges.length === 0)) { |
| 102 | selected = null |
| 103 | return true |
| 104 | } |
| 105 | const base_nodes = elements.nodes.filter( |
| 106 | (node: any) => node.type === WorkflowType.Start || node.type === WorkflowType.Base, |
| 107 | ) |
| 108 | if (base_nodes.length > 0) { |
| 109 | MsgError(base_nodes[0]?.properties?.stepName + t('workflow.tip.cannotCopy')) |
| 110 | return |
| 111 | } |
| 112 | selected = cloneDeep(elements) |
| 113 | selected.nodes.forEach((node: any) => translationNodeData(node, TRANSLATION_DISTANCE)) |
| 114 | selected.edges.forEach((edge: any) => translationEdgeData(edge, TRANSLATION_DISTANCE)) |
| 115 | copyClick(JSON.stringify(selected)) |
| 116 | return false |
| 117 | } |
| 118 | // 3. 求节点包围盒 |
| 119 | const getBounds = (nodes: any[]) => { |
| 120 | if (!nodes.length) { |
nothing calls this directly
no test coverage detected