Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Anybody created an issue. See original summary.

anybody’s picture

Issue summary: View changes
johnpitcairn’s picture

I think I'd want to be able to copy and paste entire layouts.

I recently trialled a page-builder service that did this, and used the copy-paste paradigm to implement a very crude library functionality, in that it "remembered" which page slices (layouts) you had recently copied (up to about 20 I think). It also let you choose at paste time whether what you were pasting would remain "linked" with the original (ie a library item, but editable in any location) or whether it would become a separate instance. In practice, that was a bit confusing.

I can't see the browser copy/paste commands working reliably for this, so it would need dedicated copy/paste buttons somewhere, no? In which case, isn't that pretty much equivalent to "promote to library" then "add from library" followed by "make editable" then (optional) "delete from library"?

thomas.frobieter’s picture

I also think its a good idea to (re-)use the promote to library functionality somehow, at least technically. So there's no need to reinvent the wheel and it might be a solid base for this "clipboard" function.

anybody’s picture

Well, I'm not sure if the library might not be a too different approach. Technically, it's very different. Library paragraphs are not owned by their parent entity, while all other paragraphs are.

Furthermore, you'd want to put items into the library, which you want to re-use 1:1, for example elements you want to place onto several pages. The copy / paste functionality might be used for different things, for example to copy something and change it afterwards.
There are use-cases for both things, so this is not an XOR.

Still I think technically this should be different things, while it would be important to have a clever UI / UX for users to choose the right approach for their case. Copy vs. reference isn't self-explaining for anyone! ;)

But it's good to discuss this first. Once we have maintainer feedback, perhaps the first step should be to scribble the UI / UX.

inversed’s picture

I've seen this done in WordPress with the "Elementor" plugin. I think what it's doing is, essentially, providing a custom copy / paste command which fetches the JSON they use to export and import their templates.

anybody’s picture

Priority: Minor » Normal

Just came across this idea again and I think it would be really brilliant to be able to copy whole layouts including their content to other pages or projects. It's a game-changer! But it's not simple.

In constrast to Wordpress Elementor, Drupal uses structured database data, while Elementor and Gutenberg both are kind of WYSIWYG textfield-based.

But still I think if we'll one day have an export / import icon on layouts and paragraphs, that will be wonderful!

drupaldope’s picture

I agree that this functionality would be very practical.

Copy single paragraphs or paragraph containers, such as a layout paragraph (along with their contents) into a clipboard, and then insert them into another page with paragraphs.

yorchperaza made their first commit to this issue’s fork.

yorchperaza’s picture

Issue summary: View changes
StatusFileSize
new72.68 KB

I've developed a preliminary patch in response to this issue. This patch lays the groundwork for the desired feature, addressing the core functionality.

While the current implementation is operational, I want to emphasize that it is in an early stage. Additional testing is required to ensure robustness and compatibility. I welcome feedback and testing from the community to refine and improve this patch.

Please find attached the patch file. I'm looking forward to your insights and suggestions to enhance this contribution to the Drupal project.

drupaldope’s picture

@yorchperaza thank you for your work, I will test it.
This will be a very neat functionality if it works.

andy inman’s picture

Now paragraph copy/paste exists as a module: https://www.drupal.org/project/paragraphs_clipboard

yorchperaza’s picture

@andy-inman seems like not is compatible with layout_paragraphs

andy inman’s picture

@ yorchperaza

> seems like not is compatible with layout_paragraphs

Correct - I spoke/wrote too soon. But they're in the process of adding that as a submodule.

hhvardan’s picture

Added Layout Paragraphs Clipboard submodule to the Paragraphs Clipboard module to extend the functionality of the Layout Paragraphs (layout_paragraphs) module by adding copy-paste functionality.

hhvardan’s picture

Status: Active » Needs review