Thanks for the info. I didn't make it clear, but my requirement is to be able to intercept a cut/paste command like ctrl-C and provide the clipboard with arbitrary data from javascript. The solutions you refer to only apply to text that is already selected in the browser. I think the W3 recommendation applies to providing events when the browser does the copy/paste and how the text is formatted.
I have found a comment on stackoverflow that claims google docs has a hidden textarea and that they intercept the ctrl-C keypress and focus that textarea before passing the event along. In any case I can reverse engineer what google does. I really hate to have to do such a kludge. BTW, the reason I have to provide the text from javascript is that I am showing the text in a canvas and obviously the browser can't select that. On Tue, Feb 4, 2014 at 8:22 PM, Jukka Jylänki <[email protected]> wrote: > There exists these two HTML5 apis: > > Clipboard API and Events: > http://dev.w3.org/2006/webapi/clipops/clipops.html > and HTML5 Drag and Drop: > http://www.whatwg.org/specs/web-apps/current-work/multipage/dnd.html > > The first one looks relevant? I haven't tried it though, but > caniuse.comsuggests it's widely available: > http://caniuse.com/#feat=clipboard > > > 2014-02-05 Mark Hahn <[email protected]>: > > I'm porting an app to emscripten that is something like a word processor. >> The desktop version of the app supports cutting and pasting from the >> desktop clipboard that somehow involves GDI. >> >> From what I have read browsers don't support cut/paste without annoying >> pop-ups. This is unacceptable. However, I checked google docs and they >> support it just fine. I will have to study their technique. >> >> To make a long story short, can anyone suggest the best way to handle >> this? Has anyone run into this problem before? >> >> -- >> You received this message because you are subscribed to the Google Groups >> "emscripten-discuss" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> For more options, visit https://groups.google.com/groups/opt_out. >> > > -- > You received this message because you are subscribed to the Google Groups > "emscripten-discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
