file-drops
A simple in-browser file drop utility
Last updated a month ago by nikku .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install file-drops 
SYNC missed versions from official npm registry.

file-drops

A simple in-browser file drop utility.

Usage

import fileDrop from 'file-drops';

const element = document.querySelector('#container');

const dropHandler = fileDrop('Drop a file', function(files) {
  // files = [ { name, contents }, ... ]
});

element.addEventListener('dragover', dropHandler);

Styling

On drop over, the utility will attach the following overlay to the element for which the drop handler got registered:

<div class="drop-overlay">
  <div class="box">
    <div class="label">{label}</div>
  </div>
</div>

Style it as you wish. :heart:

License

MIT

Current Tags

  • 0.4.0                                ...           latest (a month ago)

5 Versions

  • 0.4.0                                ...           a month ago
  • 0.3.0                                ...           a year ago
  • 0.2.0                                ...           2 years ago
  • 0.1.1                                ...           2 years ago
  • 0.1.0                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 12
Last Month 20
Dependencies (1)
Dev Dependencies (6)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |