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

Implement copy and pasting #1002

Open
7 tasks
Tracked by #987
vsgoulart opened this issue Jan 23, 2024 · 0 comments
Open
7 tasks
Tracked by #987

Implement copy and pasting #1002

vsgoulart opened this issue Jan 23, 2024 · 0 comments
Assignees
Labels
backlog Queued in backlog

Comments

@vsgoulart
Copy link
Contributor

vsgoulart commented Jan 23, 2024

What should we do?

In order to make easier to model forms, we should allow copy&pasting form components

TODO

  • The actions should trigger on the default copy and paste shortcuts
  • The user should be able to copy only a single component at a time
  • When pasting a component, it is added in a new row below the selected component's row (if any)
  • If a form doesn't have a selected component, then the copied component is added in a new row at the end of the form.
  • The pasted component has all properties inherited from the original component, except the Key and Path attributes where special rules apply:
    • If a form doesn't have a component with the original's component Key / Path attribute (e.g. pasting in a new form), then the component is pasted with the original Key / path attribute.

    • If a form has a component with the original's component Key attribute, then the pasted component's Key is the original's component key + increment by 1.

      • E.g. the original component's Key is name. The pasted component's Key is name2.
    • The suggestion is to not generate a random key but follow the naming convention defined by the user.

    • If the original component has a Path attribute with a nested structure (e.g. group.name), then the pasted component's Path attribute is updated recursively, starting from the root node.

      • E.g. the original component's path is group.name. The pasted component's path is group2.name.
  • When a new component is added (pasted) to a form, automatically select it and expand the General section in the properties panel.
  • We should run a validation on paste to check if the schema is valid, in the future we might want to show a toast notification to let users know that the schema pasted is not valid

Test cases:

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

No branches or pull requests

2 participants