Skip to content

Updating Custom Attribute IDs in Links During Copy Operation #2791

Answered by kumilingus
goyaljai1 asked this question in Q&A
Discussion options

You must be logged in to vote

I assume you use the ui.Clipboard plugin.

Can you just update the ids when you paste them? For instance:

// first paste the clipboard to a tmp graph
const cells = clipboard.pasteElements(new dia.Graph());
updateCustomIds(cells);
// now add modified cells into actual graph
graph.addCells(cells);

Note: If you need a map of the original cells to the cloned elements, you could use graph.cloneSubgraph() method.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@goyaljai1
Comment options

@kumilingus
Comment options

Answer selected by goyaljai1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants