简体   繁体   English

Go.js复制粘贴无效

[英]Go.js Copy Paste not work

I am using go.js library for diagrams. 我正在使用go.js库进行图表绘制。 I want to implement the copy paste functionality. 我要实现复制粘贴功能。 I have tried builtin functions for copy and paste. 我尝试了用于复制和粘贴的内置函数。

The problem with these methods are that they only copy selected node from canvas. 这些方法的问题在于它们仅从画布复制选定的节点。 But i want to copy also childNodes of that selected node. 但我也要复制该选定节点的childNodes。

Anyone here for help? 有人在这里寻求帮助吗?

First, do you know about the CommandHandler.copiesTree property? 首先,您是否了解CommandHandler.copiesTree属性? Setting this to true may be sufficient for your purposes. 将其设置为true可能足以满足您的目的。 http://gojs.net/latest/api/symbols/CommandHandler.html#copiesTree http://gojs.net/latest/api/symbols/CommandHandler.html#copiesTree

  $(go.Diagram, ...,
    { ...,
      "commandHandler.copiesTree": true
    })

The CommandHandler.copiesParentKey might also be useful if you are working with a TreeModel and want the copied subtree to be added to the current parent. 如果您正在使用TreeModel并希望将复制的子树添加到当前父树,则CommandHandler.copiesParentKey可能也很有用。

Second, if you want to copy nodes and links programmatically, you can call Node.findTreeParts and Diagram.copyParts. 其次,如果要以编程方式复制节点和链接,则可以调用Node.findTreeParts和Diagram.copyParts。 http://gojs.net/latest/api/symbols/Node.html#findTreeParts http://gojs.net/latest/api/symbols/Diagram.html#copyParts http://gojs.net/latest/api/symbols/Node.html#findTreeParts http://gojs.net/latest/api/symbols/Diagram.html#copyParts

Reference http://forum.nwoods.com/t/go-js-copy-paste-tree-not-work/6412/2 参考 http://forum.nwoods.com/t/go-js-copy-paste-tree-not-work/6412/2

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM