Skip to content

Commit

Permalink
added drop text support; will be useful in WebTorrent Desktop to drop…
Browse files Browse the repository at this point in the history
… magnet links.
  • Loading branch information
codealchemist committed Jun 24, 2016
1 parent c4d42a9 commit bc6effe
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 bc6effe

Please sign in to comment.