Make it easy to copy whole code blocks

Right now, if a code block is so long that it has a vertical scroll bar, selecting the whole code section is not that easy. Especially given that Discourse does something strange to the blocks so that they lose all selection if you scroll that too fast.

Can we have a “Copy” button for each code block? Perhaps this could be used: https://meta.discourse.org/t/copy-option-for-code-blocks-in-discourse/60961

I definitely don’t have any objection to trying it. As an aside @p-himik would you be interested in being an admin for the site?

I’ve never had to work with Discourse but sure, why not.

OK so after reading and thinking a bit more I decided to hold off on that and in fact revoked admin for most everyone that already had it. :slight_smile: (cc @core) There is just a lot of user PII in the database and we really need to enumerate an actual written privacy and roles policy first, and then we can figure out who should be what, within an accountable framework. I did add you as a moderator for now. I will take a look at the link above this weekend.

As an aside I’d like to make a post here like this one one the Julia Forms:

1 Like

Appears to be functioning:

2 Likes

Thanks! The button covers the vertical scroll bar (and my scrollbars are wider than yours by about 50%), which makes it look a bit strange. But the button is on top of the whole block, so it works perfectly either way!

Yah I noticed it looked a bit wonky (but was functional). Unfortunately hand-edits in the admin panel would get blown away by any theme updates so I didn’t want to go that route. We could fork that theme component repo and tweak the CSS more permanently if we really wanted to.

This unofficial plugin has been removed due to a bad incompatibility with latest discourse versions.

However, it was added as an official built-in feature in the previous beta, so I have enabled it in settings.