Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copying doesn't copy the arrows #70

Open
charliedua opened this issue Feb 19, 2021 · 3 comments
Open

Copying doesn't copy the arrows #70

charliedua opened this issue Feb 19, 2021 · 3 comments

Comments

@charliedua
Copy link
Contributor

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 (8e0c0e7) running in a virtualbox docker container.

Not sure if this is the expected behavior or not.

@charliedua
Copy link
Contributor Author

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
Copy link
Collaborator

shtefcs commented Feb 27, 2021

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
Copy link
Contributor Author

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

  • In the file copy.ts line 20 gg-editor is copying the nodes to the clipboard.
  • As the arrows are not nodes they are not copied.
  • So when we paste from the clipboard the arrows are not pasted.

Slight Possibility

If we still want to do it then ↓

  • Some research shows that they are using the command design pattern which makes it easy to add extra commands.
  • The BaseCommand interface can be used to inherit and change the functionality of various commands.
  • even if we make a class inheriting from the BaseCommand interface we might not find a way to integrate it with gg-editor. (Needs research)

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants