Skip to content
read image/text data from clipboard (cross-browser)
Branch: master
Clone or download
Latest commit 3d3efc9 Aug 29, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore Add make watch Sep 3, 2016
LICENSE added missing license Jan 25, 2016
Makefile Ament make file Sep 11, 2016
README.md
README_ru.md Latest Safari does support it Apr 20, 2017
bower.json
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
paste.coffee
paste.js
paste.js.sublime-project

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.