Can I copy/duplicate a code block


#1

I would like to copy a block of code and reuse it. I don’t see any way to do this. Am I missing something obvious?


#2

If you have the handles on the side visible for drag and drop, click the handle of the beginning of the code block you want and then right click.


#3

While editing, click here up top to turn on the feature:
temp

Once enabled, you can select a block by clicking in the yellow region…
(clicking in different spots will change what code is selected)

temp2

The blue numbers on the left is what is selected.
You can drag by grabbing the maroon arrows…
(and dropping it in the text region once in the right spot)

Holding down Ctrl while dragging will make a copy.

NOTE :
This works to copy within the same piston. If you want to copy the block into a DIFFERENT piston, follow @eibyer’s tips above.


Edit March 2020:

I have created a Wiki page showing all the tips here, plus many more.


Is there a easy way to insert new code in piston other than at the bottom?
Edit piston manually and also location mode
Getting started
#4

Thank you both!


#5

I get this part - “copy/duplicate/cut/delete this statement” in the first piston (for certain actions), but right-clicking anywhere in the second piston just gets “clear clipboard”. It worked within the same piston, but that wasn’t the question, so maybe I am missing something. Also, I read this post in hopes of being able to cut/copy and paste variables from one piston to another and the sidebar select isn’t available for these except individual “moves”


#6

First, you have to left click to select some text, and then you can right click to copy. Once it is on webCoRE’s clipboard, it can be pasted into any other piston with a similar container.


#7

I have two tabs open in chrome, editing two different pistons (on the same hub) and I cannot get “paste” to appear in the right-click menu on the destination pistion. I can copy and past within a single piston, but the clipboard doesn’t seem to be shared between the two chrome tabs. Can someone please explain it to me like I’m a 6 year old?


#8

Use one tab to copy… then save (or cancel) the piston… You will be able to use the same tab to edit the other piston… Go to the right section, and then paste.

For more details, check out the last section on this Wiki page


Note: It may not work if you are in a Private or Incognito browser…


#9

For what it’s worth, when I need to see two pistons simultaneously, I use two different browsers.
(When I say “see two pistons”, I mean seeing one piston while editing another)

It would probably be wise to never Edit two pistons (on the same hub) at the same moment.
(We don’t want to increase the risk of a corrupted piston)

One Dashboard per browser also helps keeps the cookies properly set.
(which could explain your missing clipboard)


If I ever need to see three pistons simultaneously, I may cheat and make one of them a screenshot.jpg.
(although it is still my preferred method to use a browser on another nearby screen)