(file, i)
| 1669 | if (files && files.length && window.FileReader && window.File) { |
| 1670 | var n = files.length, text = Array(n), read = 0; |
| 1671 | var loadFile = function(file, i) { |
| 1672 | var reader = new FileReader; |
| 1673 | reader.onload = function() { |
| 1674 | text[i] = reader.result; |
| 1675 | if (++read == n) { |
| 1676 | pos = clipPos(cm.doc, pos); |
| 1677 | replaceRange(cm.doc, text.join(""), pos, "around", "paste"); |
| 1678 | } |
| 1679 | }; |
| 1680 | reader.readAsText(file); |
| 1681 | }; |
| 1682 | for (var i = 0; i < n; ++i) loadFile(files[i], i); |
| 1683 | } else { |
| 1684 | // Don't do a replace if the drop happened inside of the selected text. |
no test coverage detected