polacode icon indicating copy to clipboard operation
polacode copied to clipboard

allow copying to clipboard instead of saving as a file

Open luisrudge opened this issue 7 years ago • 17 comments

luisrudge avatar Feb 16 '18 12:02 luisrudge

Just tried out Polacode and while it is cool, this was my immediate thought as well.

ericcirone avatar Feb 16 '18 13:02 ericcirone

Absolutely, a must have functionality!

nodeful avatar Feb 16 '18 13:02 nodeful

Yep, had it in mind but didn't make it for MVP.

octref avatar Feb 16 '18 18:02 octref

This seems impossible with the current API. The Electron webview can't do it per this Chromium Bug. On macOS, pbcopy does not take image input. Electron does have an API but VS Code does not expose it.

I'm asking for it: https://github.com/Microsoft/vscode/issues/217#issuecomment-366495874

octref avatar Feb 18 '18 06:02 octref

@octref I tried to implement it this with the electron nativeImage + clipboard modules but can't get it running. I think we have to wait for Microsoft to expose the clipboard API via vscode.

seveves avatar Feb 19 '18 07:02 seveves

I don't think this solves this issue but can we have like a toggle to preview the image and right-click that and have Chrome's copy image functionality? Is that possible in VS Code right now? I checked the image previewer in Code but that doesn't allow me to copy the image being previewed.

runofthemillgeek avatar Feb 21 '18 15:02 runofthemillgeek

Random thought: has anyone tried using Canvas?

From image, use drawImage.

In Chrome, right-clicking canvas allows you to copy image.

kamranayub avatar Feb 21 '18 21:02 kamranayub

@kamranayub On the same lines as I was wondering which I posted above but right-clicking doesn't seem to popup any context menus inside VS Code.

runofthemillgeek avatar Feb 21 '18 21:02 runofthemillgeek

I implemented it by spawn another electron process in vscode... At least it can work. 😅 https://github.com/maple3142/polacode

maple3142 avatar Oct 13 '18 10:10 maple3142

+1, I want to use this extension to copy paste code into emails. I'm not going to go through saving a file and importing for that.

travisbaratcart avatar May 15 '19 23:05 travisbaratcart

Someone made a fork that fixes a bunch of things, so I'd use that for the time being.

adi518 avatar May 16 '19 08:05 adi518

duplicate of #70? I'd really like this feature too!

duartealexf avatar Oct 10 '19 17:10 duartealexf

I created an npm library for copying images to clipboard that you're free to use:

https://www.npmjs.com/package/img-clipboard

kufii avatar Nov 27 '19 19:11 kufii

This is definitely cool feature, will raise an PR for it when I'm not so busy.

JounQin avatar Dec 18 '19 02:12 JounQin

Awesome feature, very useful

GalDayan avatar May 08 '20 23:05 GalDayan

Hi, any updates on this?

MathBunny avatar Aug 14 '20 04:08 MathBunny

I found an extension that already implements this very useful feature. https://marketplace.visualstudio.com/items?itemName=adpyke.codesnap

mreduar avatar Aug 28 '21 02:08 mreduar