(file, i)
| 1911 | if (files && files.length && window.FileReader && window.File) { |
| 1912 | var n = files.length, text = Array(n), read = 0; |
| 1913 | var loadFile = function(file, i) { |
| 1914 | var reader = new FileReader; |
| 1915 | reader.onload = function() { |
| 1916 | text[i] = reader.result; |
| 1917 | if (++read == n) { |
| 1918 | pos = clipPos(cm.doc, pos); |
| 1919 | makeChange(cm.doc, {from: pos, to: pos, text: splitLines(text.join("\n")), origin: "paste"}, "around"); |
| 1920 | } |
| 1921 | }; |
| 1922 | reader.readAsText(file); |
| 1923 | }; |
| 1924 | for (var i = 0; i < n; ++i) loadFile(files[i], i); |
| 1925 | } else { |
| 1926 | // Don't do a replace if the drop happened inside of the selected text. |
no test coverage detected