layerssss / paste.js

read image/text data from clipboard (cross-browser)
http://layerssss.github.io/paste.js/
MIT License
463 stars 94 forks source link

get clipboard text from a function #1

Closed krakas closed 10 years ago

krakas commented 10 years ago

hey how can I call paste.js to get the content of the clipboard from another function ?

I want to paste when the user clicks on a javascript button. thanks..

layerssss commented 10 years ago

Hi, krakas

hey how can I call paste.js to get the content of the clipboard from another function ?

The content of clipboard will only be available within the (very) first moment of the paste event. i.e. when you pressing the paste keys (ctrl + v/cmd + v). So you need to delegate the paste event into the paste.js div element. A fine example of this is http://jsfiddle.net/layerssss/59YWx/light/

I want to paste when the user clicks on a javascript button.

paste.js does not cover this functionality, I recommend you using ZeroClipboard to achieve this.