(file, i)
| 2789 | if (files && files.length && window.FileReader && window.File) { |
| 2790 | var n = files.length, text = Array(n), read = 0; |
| 2791 | var loadFile = function(file, i) { |
| 2792 | var reader = new FileReader; |
| 2793 | reader.onload = operation(cm, function() { |
| 2794 | text[i] = reader.result; |
| 2795 | if (++read == n) { |
| 2796 | pos = clipPos(cm.doc, pos); |
| 2797 | var change = {from: pos, to: pos, text: splitLines(text.join("\n")), origin: "paste"}; |
| 2798 | makeChange(cm.doc, change); |
| 2799 | setSelectionReplaceHistory(cm.doc, simpleSelection(pos, changeEnd(change))); |
| 2800 | } |
| 2801 | }); |
| 2802 | reader.readAsText(file); |
| 2803 | }; |
| 2804 | for (var i = 0; i < n; ++i) loadFile(files[i], i); |
| 2805 | } else { // Normal drop |
| 2806 | // Don't do a replace if the drop happened inside of the selected text. |
no test coverage detected
searching dependent graphs…