(file, i)
| 6514 | } |
| 6515 | }; |
| 6516 | var readTextFromFile = function (file, i) { |
| 6517 | if (cm.options.allowDropFileTypes && |
| 6518 | indexOf(cm.options.allowDropFileTypes, file.type) == -1) { |
| 6519 | markAsReadAndPasteIfAllFilesAreRead(); |
| 6520 | return |
| 6521 | } |
| 6522 | var reader = new FileReader; |
| 6523 | reader.onerror = function () { return markAsReadAndPasteIfAllFilesAreRead(); }; |
| 6524 | reader.onload = function () { |
| 6525 | var content = reader.result; |
| 6526 | if (/[\x00-\x08\x0e-\x1f]{2}/.test(content)) { |
| 6527 | markAsReadAndPasteIfAllFilesAreRead(); |
| 6528 | return |
| 6529 | } |
| 6530 | text[i] = content; |
| 6531 | markAsReadAndPasteIfAllFilesAreRead(); |
| 6532 | }; |
| 6533 | reader.readAsText(file); |
| 6534 | }; |
| 6535 | for (var i = 0; i < files.length; i++) { readTextFromFile(files[i], i); } |
| 6536 | } else { // Normal drop |
| 6537 | // Don't do a replace if the drop happened inside of the selected text. |
no test coverage detected