nl_tokens: setupClipboard : bind to clipboard events ( intended for document . body )
pl_tokens: function setupClipboard ( element , opts ) { if ( ! FileReaderJS . enabled ) { return ; } var instanceOptions = extend ( extend ( { } , FileReaderJS . opts ) , opts ) ; element . addEventListener ( "paste" , onpaste , false ) ; function onpaste ( e ) { var files = [ ] ; var clipboardData = e . clipboardData || { } ; var items = clipboardData . items || [ ] ; for ( var i = 0 ; i < items . length ; i ++ ) { var file = items [ i ] . getAsFile ( ) ; if ( file ) { // Create a fake file name for images from clipboard, since this data doesn't get sent var matches = new RegExp ( "/\(.*\)" ) . exec ( file . type ) ; if ( ! file . name && matches ) { var extension = matches [ 1 ] ; file . name = "clipboard" + i + "." + extension ; } files . push ( file ) ; } } if ( files . length ) { processFileList ( e , <mask> , instanceOptions ) ; e . preventDefault ( ) ; e . stopPropagation ( ) ; } } }