Reputation: 449
I try to add a copy paste option in my program but links doesn't come with. All my blocks are well copied but my links aren't.
var copied;
$("#copy").click(function(){
var papa = block_menu.model; //clicked element
var copied_cells=papa.clone({deep:true}); //take all embedded cells
copied=graph.getSubgraph(copied_cells, {deep:true}); //copy
});
$("#paste").click(function(){
graph.addCells(copied); //paste (add on graph)
});
I've tried to add this before "copied = ...."
but that doesn't change anything :
var copied_cells = graph.getSubgraph(copied_cells) `
Does someone nows how to copy my links with? Thanks.
Upvotes: 1
Views: 837
Reputation: 81
cells should be sorted before you're putting them back into graph. Elements first, then links. addCells
has been adding cells as it is, so if there is link whose target/source is not in the graph yet, this link won't be added.
Upvotes: 1