vanila-io / wireflow

Wireflow - user flow chart real-time collaborative tool
https://wireflow.co
MIT License
3.99k stars 376 forks source link

Copying doesn't copy the arrows #70

Open charliedua opened 3 years ago

charliedua commented 3 years ago

When copying and pasting the nodes the connections between them aren't getting copied.

How to reproduce

  1. Create a simple diagram (2+ nodes) with arrows connecting nodes. image

  2. Multi-Select all the nodes image

  3. Copy the selected shapes ( optional: and then delete these shapes [ for readability purposes ] )

  4. Now click on the Paste button to paste the copied design.

Observation: The nodes are not connected with arrows image

Used Chrome with latest master (8e0c0e73b96051b4a9aca4bc3ef033831ecda466) running in a virtualbox docker container.

Not sure if this is the expected behavior or not.

charliedua commented 3 years ago

Upon further research I have found that we are not handling the copy-paste operations ourselves, this is handled by gg-editor here So I am not sure if we can actually fix this 😕

shtefcs commented 3 years ago

That is good research. Well isn't that even better? It means that natively it is supported, but we just didn't do it.

I think this should be doable.

charliedua commented 3 years ago

Thoughts

No that is actually bad. We cannot change the functionality as it is handled by gg-editor. we are only setting the command in this file The rest is handled by gg-editor We can make changes if we try to clone and edit the gg-editor files but I think that would be too much work. IMO we should just leave the copy-paste functionality as is and consider it as a feature, not a bug?

Detailed explanation

Slight Possibility

If we still want to do it then ↓

Another Approach

We can also inherit from the copy.ts file to create a deepCopy.ts which has the same functionality but also saves the arrows. This approach has some benefits from the previous one as we are not reinventing the wheel.