(file, i)
| 3719 | if (files && files.length && window.FileReader && window.File) { |
| 3720 | var n = files.length, text = Array(n), read = 0; |
| 3721 | var loadFile = function(file, i) { |
| 3722 | var reader = new FileReader; |
| 3723 | reader.onload = operation(cm, function() { |
| 3724 | text[i] = reader.result; |
| 3725 | if (++read == n) { |
| 3726 | pos = clipPos(cm.doc, pos); |
| 3727 | var change = {from: pos, to: pos, text: splitLines(text.join("\n")), origin: "paste"}; |
| 3728 | makeChange(cm.doc, change); |
| 3729 | setSelectionReplaceHistory(cm.doc, simpleSelection(pos, changeEnd(change))); |
| 3730 | } |
| 3731 | }); |
| 3732 | reader.readAsText(file); |
| 3733 | }; |
| 3734 | for (var i = 0; i < n; ++i) loadFile(files[i], i); |
| 3735 | } else { // Normal drop |
| 3736 | // Don't do a replace if the drop happened inside of the selected text. |
no test coverage detected
searching dependent graphs…