Repository navigation
feat(editor): copy and paste all selected fields - #3390
Open
ephraimduncan wants to merge 7 commits into
Open
ephraimduncan wants to merge 7 commits into
ephraimduncan wants to merge 7 commits into
Conversation
Ctrl+C copies all the fields in the selection. Before this change, it copied a field only when one field was selected. The editor keeps the ids of the selected fields. When the author selects fields on one page, the editor clears the selection on the other pages.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
Contributor
|
Important Review skippedAuto reviews are limited based on label configuration. 🏷️ Required labels (at least one): 1
Please check the settings in the CodeRabbit UI or the
|
3 of 5 tasks
5 tasks done
#3395 moved the canvas selection out of the page renderer and into `useEnvelopeCanvasSelection` and `useEditorFormArray`. The selection changes of this branch applied to code that #3395 removed. This merge keeps the page renderer and `useEditorFields` of branch main, and keeps the shortcuts for one field from #3389. The next commit adds the copy of all selected fields to the new canvas hooks.
Before this change, each page kept its own canvas selection. The editor state held a field only when one field was selected. Fields on page 1 stayed selected after the author selected fields on page 2. `useEditorFormArray` keeps the ids of all selected items and returns `selectedItems`. `selectedItem` is set only when one item is selected. The page renderer sends the full canvas selection to `editorFields.setSelectedFields`. When the editor selection moves to a different page, the fields layer calls `selection.release`. This function clears the canvas selection of the page and does not call `onChange`, because `onChange` clears the new selection.
Ctrl+C copies each field in the selection, and Ctrl+V adds a copy of each field. Before this change, the shortcut copied a field only when one field was selected. The toast shows the number of copied fields.
The flow ran on the document editor and the template editor only. It runs on embedded create and embedded edit also. The flow makes sure that the toast shows the number of copied fields.
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Ctrl+C (Cmd+C on macOS) copies all the selected fields. Before this change, the shortcut copied a field only when one field was selected. For example, when the author uses a drag selection on a Signature field and a Name field, Ctrl+C shows "Copied 2 fields". Then Ctrl+V adds a copy of the two fields.
The editor keeps one selection for all pages. Before this change, each page kept its own selection. Fields on page 1 could stay selected, with their floating toolbar, after the author selected fields on page 2. With this change, a selection on one page clears the selection on the other pages. As a result, Ctrl+C copies only the fields that the author selected last.
Related Issue
Related: documenso/backlog-internal#840
Changes Made
useEditorFormArraykeeps the ids of all selected items.useEditorFieldsaddsselectedFieldsandsetSelectedFields, andselectedFieldis set only when one field is selected.useEnvelopeCanvasSelectionaddsrelease(), which clears the selection of a page without a call toonChange. A page uses it when the editor selection moves to a different page.Testing Performed
packages/app-tests/e2e/envelope-editor-v2/envelope-fields.spec.tspass in CI.Checklist
Additional Notes
This PR depends on #3389, which adds the copy and paste shortcuts for one field. Merge #3389 before this PR.
Copy and paste applies to fields only. It does not apply to the text, shapes and images of the Contents tab.