1.0.0 ā€¢ Published 5 years ago

@charliewilco/gluejar v1.0.0

Weekly downloads
126
License
MIT
Repository
github
Last release
5 years ago

React Gluejar

Collects the images you paste from your clipboard.

Demo using `react-gluejar`

Installation

yarn add @charliewilco/gluejar

Example

import React, { Component } from 'react'
import { Gluejar } from '@charliewilco/gluejar'

class App extends Component {
  render() {
    return (
      <Gluejar onPaste={files => console.log(files)} onError={err => console.error(err)}>
        {({ images }) =>
          images.length > 0 &&
          images.map(image => <img src={image} key={image} alt={`Pasted: ${image}`} />)
        }
      </Gluejar>
    )
  }
}

Run this example locally by cloning the repo and running yarn example in the root directory. You can visit the example here.

Usage

Available Props

PropTypeDescriptionDefault
onPasteFunctionreturns Array of image Blobs, responds to events() => null
onErrorFunctionreturns error messages() => null
childrenFunctionreturns Array of history of pasted imagesN/A
acceptedFilesArray<String>Array of accepted files to check for['image/gif', 'image/png', 'image/jpeg', 'image/bmp']
containerElementElement object to listen onwindow

Browser Support

BrowserSupport
ChromešŸ‘
IEšŸ‘Ž
FirefoxšŸ™„
EdgešŸ‘
SafarišŸ‘
OperašŸ‘

šŸ™„ = Look there's something going on in Firefox for a while. You can read the tracking issue here, but I don't insight into their timeline or priority.