(e)
| 458 | selectWordAt(start); |
| 459 | } |
| 460 | function onDrop(e) { |
| 461 | if (options.onDragEvent && options.onDragEvent(instance, addStop(e))) return; |
| 462 | e.preventDefault(); |
| 463 | var pos = posFromMouse(e, true), files = e.dataTransfer.files; |
| 464 | if (!pos || options.readOnly) return; |
| 465 | if (files && files.length && window.FileReader && window.File) { |
| 466 | function loadFile(file, i) { |
| 467 | var reader = new FileReader; |
| 468 | reader.onload = function() { |
| 469 | text[i] = reader.result; |
| 470 | if (++read == n) { |
| 471 | pos = clipPos(pos); |
| 472 | operation(function() { |
| 473 | var end = replaceRange(text.join(""), pos, pos); |
| 474 | setSelectionUser(pos, end); |
| 475 | })(); |
| 476 | } |
| 477 | }; |
| 478 | reader.readAsText(file); |
| 479 | } |
| 480 | var n = files.length, text = Array(n), read = 0; |
| 481 | for (var i = 0; i < n; ++i) loadFile(files[i], i); |
| 482 | } |
| 483 | else { |
| 484 | try { |
| 485 | var text = e.dataTransfer.getData("Text"); |
| 486 | if (text) { |
| 487 | compoundChange(function() { |
| 488 | var curFrom = sel.from, curTo = sel.to; |
| 489 | setSelectionUser(pos, pos); |
| 490 | if (draggingText) replaceRange("", curFrom, curTo); |
| 491 | replaceSelection(text); |
| 492 | focusInput(); |
| 493 | }); |
| 494 | } |
| 495 | } |
| 496 | catch(e){} |
| 497 | } |
| 498 | } |
| 499 | function onDragStart(e) { |
| 500 | var txt = getSelection(); |
| 501 | e.dataTransfer.setData("Text", txt); |
nothing calls this directly
no test coverage detected