paste-img
v1.0.9
Published
React Component
Readme
React Component
Live Demo
A simple example that works in all major browsers.
How use
npm install paste-imgimport React, { Fragment, Component } from 'react';
import { PasteImage } from 'paste-img';
class Home extends Component {
onChange = (base64) => {
console.log(base64);
};
render() {
return (
<Fragment>
<PasteImage onChang={this.onChange} />
</Fragment>
);
}
}
Provide tools
import { getBase64 } from 'paste-img';getBase64('https://something.com').then(base => {
console.log(base)
})API
| Arguments | Description | Type | Default | |----------|------------------------------------------|-------------|-------| | defaultBase64 | defaultBase64 | string|- | | base64 | base64 | string | - | | style | style | object | - | | className | className | string | - | | onChang | function(base64){ } | function | - | | tip | tips when pasted content is not a picture | string | |
Development
clone locally:
$ git clone https://github.com/acuariol/paste-img.git
$ cd paste-img
$ npm install
$ npm startOpen your browser and visit http://localhost:8080 ,
