Skip to content

Element copy/paste support #16888

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

Merged
merged 8 commits into from
Mar 17, 2025
Merged

Conversation

brandonkelly
Copy link
Member

Description

Adds the ability to “copy” entries and addresses, and paste them elsewhere.

There are three ways to trigger an element copy:

  • via a “Copy [type]” element action available in chips, cards, and edit screen toolbars
  • via a “Copy” bulk element action within element indexes
  • via a “Copy all [type]” Matrix field action (when in cards or inline-editable blocks view modes)

An element chip with its action menu opened, revealing a “Copy entry” item within it.

When an element(s) is copied, a special toast notification will appear that identifies the copied element(s), and “Paste [type]” buttons will appear throughout the control panel wherever pasting the copied element(s) is supported.

A snippet of the Craft control panel, showing an element copy notification hovering over an Addresses field. The Addresses field has a “Paste address” button with special styling to match the notification.

The notification will persist across all browser tabs and across page loads, until either the element is pasted somewhere, or the notification is explicitly closed.

Other tidbits:

  • It’s possible to copy addresses between separate Addresses fields, or even between an Addresses field and a user’s addresses.
  • It’s possible to copy entries between separate sections or Matrix fields, or even between a section and a Matrix field, so long as the target section/field allows the copied entry type(s).
  • It’s possible to copy entries to different sites.

Related issues

Copy link

linear bot commented Mar 13, 2025

@thupsi
Copy link

thupsi commented Mar 13, 2025

Excellent! Thank you so much Brandon!

Copy link
Contributor

@gcamacho079 gcamacho079 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything is looking great so far, @brandonkelly. The only issue I found manually testing is that after activating the Paste button, focus is dropped when the button is removed. (I tested this for inline editable Matrix items only, but I expect it probably happens in the other contexts you mention.) In these cases, we should make sure that focus is moved to a logical element, like the first focusable item in the pasted content.

@brandonkelly brandonkelly merged commit f766a2f into 5.7 Mar 17, 2025
@brandonkelly brandonkelly deleted the feature/cms-1320-element-copypaste-support branch March 17, 2025 19:11
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

Successfully merging this pull request may close these issues.

3 participants