Skip to content

Commit

Permalink
Merge pull request #25 from codealchemist/drop-text-support
Browse files Browse the repository at this point in the history
added drop text support
  • Loading branch information
feross authored Aug 4, 2016
2 parents c4d42a9 + 7ba61f8 commit cf16008
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,17 @@ function dragDrop (elem, listeners) {
y: e.clientY
}

// drop text support
var text = e.dataTransfer.getData('text')
if (text) {
if (listeners.onDrop) {
listeners.onDrop([text], pos)
}

return false
}

// file drop support
if (e.dataTransfer.items) {
// Handle directories in Chrome using the proprietary FileSystem API
var items = toArray(e.dataTransfer.items).filter(function (item) {
Expand Down

0 comments on commit cf16008

Please sign in to comment.