How does Google Docs manage to get paste on click to work?

I would like to implement a stick on click function similar to the one found in Google Docs.

I can get paste to work when it is initiated by the user via the context menu or with a keyboard shortcut (using the onpaste and friends event), but I can't figure out how to get the paste-on-click style to force the contents of the system clipboard to paste - and , from what I've read it shouldn't be possible!

Does anyone know how Google makes this work? :-)

+3


source to share


2 answers


Have you read this article that seems to explain clipboard access across different browsers? Google Docs and Clipboard Access



+2


source


I know this is actually not a solution, but more of a workaround. But maybe you will find it worthy and will suit your needs.

Wouldn't it be possible to emulate a key press for [Ctrl] + [V]? It will work on most browsers and OS, but always keep in mind that these keys can be changed at the OS level at any time.



Any solution more than a workaround like this might be too cumbersome for your script multiple times, and there are times when you just don't want to have too many events / listeners.

0


source







All Articles