(file, i)
| 43 | } |
| 44 | } |
| 45 | const readTextFromFile = (file, i) => { |
| 46 | if (cm.options.allowDropFileTypes && |
| 47 | indexOf(cm.options.allowDropFileTypes, file.type) == -1) { |
| 48 | markAsReadAndPasteIfAllFilesAreRead() |
| 49 | return |
| 50 | } |
| 51 | let reader = new FileReader |
| 52 | reader.onerror = () => markAsReadAndPasteIfAllFilesAreRead() |
| 53 | reader.onload = () => { |
| 54 | let content = reader.result |
| 55 | if (/[\x00-\x08\x0e-\x1f]{2}/.test(content)) { |
| 56 | markAsReadAndPasteIfAllFilesAreRead() |
| 57 | return |
| 58 | } |
| 59 | text[i] = content |
| 60 | markAsReadAndPasteIfAllFilesAreRead() |
| 61 | } |
| 62 | reader.readAsText(file) |
| 63 | } |
| 64 | for (let i = 0; i < files.length; i++) readTextFromFile(files[i], i) |
| 65 | } else { // Normal drop |
| 66 | // Don't do a replace if the drop happened inside of the selected text. |
no test coverage detected