News for hackers. Stuff that matters.
Re:How does Trello access the user's clipboard? by arsenerei on Saturday August 03, 2013 @11:15PM (#6154479)
> There is a way to trigger the events from JS via document.execCommand('copy'/'cut'/'paste'), but the default is to deny.

When you say, deny, does that mean the user must go to their browser settings and set it manually? If so, what bearing does that have on what we're discussing?

As for setting the clipboard data, I have seen no way of setting that through the copy, paste or cut events.

edit: fix some words

Re:How does Trello access the user's clipboard? by zetafunction on Saturday August 03, 2013 @11:56PM (#6154576)
> When you say, deny, to me the user must go to their browser settings and set it manually?

AFAIK: Safari does not expose a setting for this (but I didn't look). Chrome uses Chrome app/extension permissions to control this setting. I'm not sure how Firefox does it.

> If so, what bearing does that have on what we're discussing?

You asked "Is there a way to trigger the copy, cut, and paste events?". You don't need to trigger them in this case since the browser automatically fires them when the user invokes the corresponding edit action.

> As for setting the clipboard data, I have seen no way of setting that through the copy, paste or cut events.

Here is a quick sample that works in everything except IE. I'm too impatient to figure out why it doesn't work in IE but http://msdn.microsoft.com/en-us/library/hh772145(v=vs.85).as... provides IE-centric documentation.

Re:How does Trello access the user's clipboard? by arsenerei on Sunday August 04, 2013 @01:19AM (#6154730)
> AFAIK: Safari does not expose a setting for this (but I didn't look). Chrome uses Chrome app/extension permissions to control this setting. I'm not sure how Firefox does it.

Okay, so for all intents and purposes it cannot be done programmatically without user assistance.

> You asked "Is there a way to trigger the copy, cut, and paste events?". You don't need to trigger them in this case since the browser automatically fires them when the user invokes the corresponding edit action.

You're right, I apologize.

> Here is a quick sample that works in everything except IE. I'm too impatient to figure out why it doesn't work in IE but http://msdn.microsoft.com/en-us/library/hh772145(v=vs.85).as.... provides IE-centric documentation.

As I mentioned in a previous comment, I've seen nothing that suggest this event allows you to change the contents of what's copied to the clipboard before it happens. From what I can tell this is an notification that it has happened. The link you have provided does not indicate anything to the contrary.

I'm not ruling out that what you're saying, but I still haven't seen something that definitively shows it's possible. Looking at all the hacks and alternatives to make it as close to "click-to-copy" a possible strong suggests it's not.

Re:How does Trello access the user's clipboard? by zetafunction on Sunday August 04, 2013 @03:51AM (#6155005)
Oh oops. I left out the link to the sample in my last post: http://jsfiddle.net/BE6bR/1

Try it out =)

Re:How does Trello access the user's clipboard? by arsenerei on Sunday August 04, 2013 @11:27AM (#6155904)
I stand corrected! Firefox, Chrome and Safari had no issues with this. I could cmd-c without highlighting and it still copied.

I finally found something indicating browser-support for this.[0] I have to think it wasn't supported in earlier versions of certain browsers and that's why Trello decided not to go this route. I'm definitely going to play around with this. This is pretty darn cool, thanks for sticking with me. :)

0: http://www.quirksmode.org/dom/events/cutcopypaste.html