Skip to content
read image/text data from clipboard (cross-browser)
CoffeeScript HTML Makefile
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore Update .gitignore Apr 17, 2019
LICENSE added missing license Jan 25, 2016
Makefile
README.md Add BrowserStack logo to README Aug 29, 2017
README_ru.md Latest Safari does support it Apr 20, 2017
bower.json 0.0.21 Sep 22, 2016
browserstack_logo.png Add BrowserStack logo to README Aug 29, 2017
index.html Persist pasted image filename, Added pasteTextRich and pasteTextHtml,… Nov 27, 2017
package.json Lock coffee-script version Aug 28, 2017
paste.coffee
paste.js Fixed the problem that cannot paste image in IE11 (#58) Apr 17, 2019
paste.js.sublime-project update usage Feb 10, 2014

README.md

paste.js

paste.js is an interface to read data ( text / image ) from clipboard in different browsers. It also contains several hacks.

browser compatibility

IE11 Firefox 33 Chrome 38 Safari(10.1) Opera
pasteText (non-inputable) ok ok ok ok ok
pasteText (textarea) ok ok ok ok ok
pasteText (contenteditable) ok ok ok ok ok
pasteImage (non-inputable) ok ok ok ok ok
pasteImage (textarea) ok ok ok ok ok
pasteImage (contenteditable) ok ok ok ok ok

usage

// jQuery needed
$('.mydiv').pastableNonInputable();

$('textarea').pastableTextarea();

$('div[contenteditable]').pastableContenteditable();

$('*').on('pasteImage', function (ev, data){
  console.log("dataURL: " + data.dataURL);
  console.log("width: " + data.width);
  console.log("height: " + data.height);
  console.log(data.blob);
}).on('pasteImageError', function(ev, data){
  alert('Oops: ' + data.message);
  if(data.url){
    alert('But we got its url anyway:' + data.url)
  }
}).on('pasteText', function (ev, data){
  console.log("text: " + data.text);
});

more

see this example

Thanks BrowserStack for providing cross-browser testing environment for this project.

browserstack_logo

license

The MIT License (MIT)

You can’t perform that action at this time.