# paste.js

> read image/text data from clipboard (cross-browser)

Latest version **0.0.21** (published 2017-07-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install paste.js
pnpm add paste.js
yarn add paste.js
bun add paste.js
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.21 |
| Published | 2017-07-13 |
| First published | 2015-11-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 461 |
| Author | Michael Yin |
| Maintainers | layerssss |
| Keywords | copy, paste, jQuery |

## Links

- npm: https://www.npmjs.com/package/paste.js
- Repository: https://github.com/layerssss/paste.js
- Homepage: https://github.com/layerssss/paste.js#readme
- Issues: https://github.com/layerssss/paste.js/issues
- npm.io page: https://npm.io/package/paste.js

## Alternatives

- [gamedig](https://npm.io/package/gamedig.md) — 29.3K weekly downloads
- [join-monster](https://npm.io/package/join-monster.md) — 12.8K weekly downloads
- [masked](https://npm.io/package/masked.md) — 5.5K weekly downloads
- [@comunica/actor-query-process-explain-logical](https://npm.io/package/@comunica/actor-query-process-explain-logical.md) — 4.7K weekly downloads
- [@veracity/vui](https://npm.io/package/@veracity/vui.md) — 4.6K weekly downloads

## Recent versions

- 0.0.21 (latest) — 2017-07-13
- 0.0.10 — 2015-11-30

## README

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](http://layerssss.github.io/paste.js/)

license
-----

[The MIT License (MIT)](LICENSE)

---
_Source: https://npm.io/package/paste.js · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
