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

feat(ui): adds support for copy pasting complex fields #11513

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

akhrarovsaid
Copy link
Contributor

@akhrarovsaid akhrarovsaid commented Mar 3, 2025

What?

This PR introduces support for copy + pasting complex fields such as Arrays and Blocks. These changes introduce a new ClipboardAction component that houses logic for copy + pasting to and from the clipboard to supported fields. I've scoped this PR to include only Blocks & Arrays, however the structure of the components introduced lend themselves to be easily extended to other field types. I've limited the scope because there may be design & functional blockers that make it unclear how to add actions to particular fields.

Supported fields:

Fields that may be supported in the future with minimal effort by adopting the changes introduced here:

  • Tabs
  • Groups
  • Collapsible
  • Relationships

This PR also encompasses e2e tests that check both field and row-level copy/pasting.

Why?

To make it simpler and faster to copy complex fields over between documents and rows within those docs.

How?

Introduces a new ClipboardAction component with helper utilities to aid in copy/pasting and validating field data.

Addresses #2977 & #10703

Notes:

  • There seems to be an issue with Blocks & Arrays that contain RichText fields where the RichText field dissappears from the dom upon replacing form state. These fields are resurfaced after either saving the data or dragging/dropping the row containing them.
  • Copying a Row and then pasting it at the field-level will overwrite the field to include only that one row. This is intended however can be changed if requested.
  • Clipboard permissions are required to use this feature. See Clipboard API caniuse.

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

Successfully merging this pull request may close these issues.

1 participant