# Selecting code when people paste code here

**URL:** https://discourse.nodered.org/t/selecting-code-when-people-paste-code-here/26471
**Category:** General
**Created:** [11 May 2020 09:17 UTC](https://discourse.nodered.org/t/selecting-code-when-people-paste-code-here/26471 "2020-05-11T09:17:19Z")
**Posts on this page:** 19
**Page:** 1

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [11 May 2020 09:17 UTC](https://discourse.nodered.org/t/selecting-code-when-people-paste-code-here/26471/1 "2020-05-11T09:17:19Z")

</div>

(I've got to ask, because I can't believe no one else is thinking it)

I appreciate that when you post code you put it like this:

```auto
example code

```

But if it is several k bytes in size, how is it done?

For me, I have to click the left most part of the line, **drag select** it all - which means moving the mouse right beyond the end of the line and ........ waiting. (and waiting and waiting)

Any slight movement up or down, you get the other stuff selected as well.  
Not a bit deal as the _thing_ is still scrolling to the right.  
Then when at the end, you have to position the mouse at the end of the line ( **while holding the button down** ) then only select the code.

Press `^c` to copy it.

There must be an easier way.

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [11 May 2020 09:18 UTC](https://discourse.nodered.org/t/selecting-code-when-people-paste-code-here/26471/2 "2020-05-11T09:18:26Z")

</div>

type three back ticks

paste code

type three back ticks

`````  
` paste`  
`````

---

<div class="post-metadata">

### Author: ![afelix](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/afelix/32/9743_2.png) [@afelix](https://discourse.nodered.org/u/afelix)
#### Post date: [11 May 2020 09:19 UTC](https://discourse.nodered.org/t/selecting-code-when-people-paste-code-here/26471/3 "2020-05-11T09:19:05Z")

</div>

I start dragging at the start of the line, then drag down to the next line. So dragging vertically rather than horizontally. On import, remove anything I copied too much if needed.

---

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [11 May 2020 09:19 UTC](https://discourse.nodered.org/t/selecting-code-when-people-paste-code-here/26471/4 "2020-05-11T09:19:41Z")

</div>

Steve, I am saying for taking the code others have posted.

Not putting code here.

Wrong way around. Sorry.

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [11 May 2020 09:20 UTC](https://discourse.nodered.org/t/selecting-code-when-people-paste-code-here/26471/5 "2020-05-11T09:20:25Z")

</div>

triple click inside the code

OR

highlight 1st part then press shift + end

---

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [11 May 2020 09:20 UTC](https://discourse.nodered.org/t/selecting-code-when-people-paste-code-here/26471/6 "2020-05-11T09:20:37Z")

</div>

If you _take_ more than the code, how to you _clean it up_ before importing it to node red?

Seems to introduce another step/phase.

---

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [11 May 2020 09:23 UTC](https://discourse.nodered.org/t/selecting-code-when-people-paste-code-here/26471/7 "2020-05-11T09:23:06Z")

</div>

> [@Steve-Mcl](#):
>
> triple click inside the code

Ah!  
(Is that mentioned anywhere in the _docs_ for this place?)  
Noobs would/may find it handy.

Never thought of that. Shall have to try it and hope I remember next time I am looking at a lot of code.

(Second option)

Oh yeah. Ok. That's fair enough.

Some other forums which are 99% like this have a `copy` button above any posted code which is handy.

But _tripple click_ does seem like a handy one to remember, as I have my hand on the mouse at that stage of things.

The second one means hand relocation.

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [11 May 2020 09:24 UTC](https://discourse.nodered.org/t/selecting-code-when-people-paste-code-here/26471/8 "2020-05-11T09:24:54Z")

</div>

> [@Trying\_to\_learn](#):
>
> The second one means hand relocation.

Use you other hand? 😃 😃 😃

Some further clarification...

SINGLE LINE CODE ...  
triple click inside the code  
OR  
highlight 1st part then press shift + end

MULTI LINE CODE...  
highlight 1st part  
scroll to end  
hold shift + click at the end of code

---

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [11 May 2020 09:27 UTC](https://discourse.nodered.org/t/selecting-code-when-people-paste-code-here/26471/9 "2020-05-11T09:27:54Z")

</div>

Thanks Steve.

I went off and found a bit of big code.

**tripple click** works.

Woo hoo! Now I need to remember it.

---

<div class="post-metadata">

### Author: ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)
#### Post date: [11 May 2020 09:40 UTC](https://discourse.nodered.org/t/selecting-code-when-people-paste-code-here/26471/10 "2020-05-11T09:40:25Z")

</div>

@Trying_to_learn I've just enabled an option in the forum that adds a copy-to-clipboard button to the top right corner of any code block when your mouse hovers over it:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/c/7caae3d0cca637e5f3f259d4bf63a2b294568852.png)

This is a new feature that got added in the most recent version of the forum software and I had been waiting for our forum to be upgraded to it. Your post reminded me to go check, and sure enough, the option was there.

I hope that helps.

---

<div class="post-metadata">

### Author: ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)
#### Post date: [11 May 2020 09:43 UTC](https://discourse.nodered.org/t/selecting-code-when-people-paste-code-here/26471/11 "2020-05-11T09:43:51Z")

</div>

And another... If you have two windows open - one with flow and one with the forum (or other source of code) - if you use the triple click - you can then just drag the code onto the flow editor desktop to import it.

---

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [11 May 2020 09:45 UTC](https://discourse.nodered.org/t/selecting-code-when-people-paste-code-here/26471/12 "2020-05-11T09:45:47Z")

</div>

Thanks Nick.

But the (afore mentioned) triple click when the code is one line seems to be the only way.

As said, other forums which look 99% like this put a `copy` button above the one line of code.  
See picture for example for what it kind of looks like.

 ![Screenshot from 2020-05-11 19-44-02](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/5/b50671feb1386802566a4ccae379baca35969be9.png)

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [11 May 2020 09:46 UTC](https://discourse.nodered.org/t/selecting-code-when-people-paste-code-here/26471/13 "2020-05-11T09:46:37Z")

</div>

Ah man, i didn't know you handled contextual drag n drop. ❤

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [11 May 2020 09:47 UTC](https://discourse.nodered.org/t/selecting-code-when-people-paste-code-here/26471/14 "2020-05-11T09:47:36Z")

</div>

its already done Andrew 🙂

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/e/aed56d532d6cf8684f8566070ca4ccbc4ba0b46c.png)

---

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [11 May 2020 09:48 UTC](https://discourse.nodered.org/t/selecting-code-when-people-paste-code-here/26471/15 "2020-05-11T09:48:48Z")

</div>

> [@dceejay](#):
>
> And another... If you have two windows open - one with flow and one with the forum (or other source of code) - if you use the triple click - you can then just drag the code onto the flow editor desktop to import it.

Super cool!

I shall have to try to remember that too...... (So much to remember!)

---

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [11 May 2020 09:50 UTC](https://discourse.nodered.org/t/selecting-code-when-people-paste-code-here/26471/16 "2020-05-11T09:50:06Z")

</div>

> [@Steve-Mcl](#):
>
> its already done Andrew

~~I beg to differ...... There isn't a button visible on the screen shot I posted.~~

~~Maybe for short bits of code. But 20k sizes.... I don't see the button.  
 ~~

Sorry.

It is only visible when I moved the mouse over the code.

And I would say it is a new thing.

---

<div class="post-metadata">

### Author: ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)
#### Post date: [11 May 2020 09:53 UTC](https://discourse.nodered.org/t/selecting-code-when-people-paste-code-here/26471/17 "2020-05-11T09:53:25Z")

</div>

> [@Trying\_to\_learn](#):
>
> As said, other forums which look 99% like this put a `copy` button above the one line of code.  
> See picture for example for what it kind of looks like.

I just said - I have enabled exactly this option in response to your post... you should see it right here

```auto
Can you see the copy button when you hover over this text?

```

I said:

> I've **just enabled** an option in the forum that adds a copy-to-clipboard button to the top right corner of any code block **when your mouse hovers over it** :

---

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [11 May 2020 09:55 UTC](https://discourse.nodered.org/t/selecting-code-when-people-paste-code-here/26471/18 "2020-05-11T09:55:57Z")

</div>

Yes I can.

Sorry. I saw @Steve-Mcl's post, and shot myself in the foot.

What caught me was I didn't have the mouse over the code.

And when I was going back to get another screen shot to show him, I noticed it started to show up.

Again, thanks.  
It is very much appreciated.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [25 May 2020 09:56 UTC](https://discourse.nodered.org/t/selecting-code-when-people-paste-code-here/26471/19 "2020-05-25T09:56:06Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
