(file, i)
| 557 | if (files && files.length && window.FileReader && window.File) { |
| 558 | var n = files.length, text = Array(n), read = 0; |
| 559 | var loadFile = function(file, i) { |
| 560 | var reader = new FileReader; |
| 561 | reader.onload = function() { |
| 562 | text[i] = reader.result; |
| 563 | if (++read == n) { |
| 564 | pos = clipPos(pos); |
| 565 | operation(function() { |
| 566 | var end = replaceRange(text.join(""), pos, pos); |
| 567 | setSelectionUser(pos, end); |
| 568 | })(); |
| 569 | } |
| 570 | }; |
| 571 | reader.readAsText(file); |
| 572 | }; |
| 573 | for (var i = 0; i < n; ++i) loadFile(files[i], i); |
| 574 | } else { |
| 575 | // Don't do a replace if the drop happened inside of the selected text. |
no test coverage detected
searching dependent graphs…