fssnippets / fssnip-website

Source code for the F# Snippets web site
http://fssnip.net
100 stars 35 forks source link

Copy link and copy source buttons in snippet details #9

Open tpetricek opened 9 years ago

tpetricek commented 9 years ago

... are not implemented! They should copy the thing into clipboard (if we can do that without ugly hacks - if no, we should remove the buttons)

abjrcode commented 9 years ago

I have been looking around for a way to do this smoothly but it seems there is no "clean" way to do it.

Google Chrome has removed all APIs that grant access the clipboard and there is no standard API for the others browsers too.

There are two hacks that people are using to work around this.

Let me know what you think Tomas.

tpetricek commented 9 years ago

Yeah, the current version of www.fssnip.net uses the Flash trick, but I don't think that's a very good solution. I quite like the idea of just doing a pop up dialog (perhaps some nice Bootstrap way) with a textbox where people can copy it, so I'd go for that option!

abjrcode commented 9 years ago

Okay. I am on it.

abjrcode commented 9 years ago

I am almost done but I honestly don't like the way things came up at last.
Anyway I will create a pull request soon and you could see for your self.

tpetricek commented 8 years ago

This works in Chrome, but it seems to be broken in IE (on my machine at least).

Also, I'm not particularly keen on the blueish label in the dialog, so if we can make that white, that would be nicer (I think!)

tpetricek commented 8 years ago

I couldn't figure out how to make this work in IE, so I added exception handler...

abjrcode commented 8 years ago

Oh sorry I totally forgot about this in the mid of all the work I have, but yes I remember that accessing the clipboard in a uniform way across browsers is really hard. I miss F# and I hope to be able to participate again although I can't see it happening soon. Good luck

kunjee17 commented 8 years ago

@tpetricek have a look at clipboard.js whenever you have time. It is having decent browser support.