|
@@ -159,18 +159,11 @@ |
|
|
input.type = 'file'; |
|
|
input.type = 'file'; |
|
|
|
|
|
|
|
|
input.onchange = e => { |
|
|
input.onchange = e => { |
|
|
|
|
|
|
|
|
// getting a hold of the file reference |
|
|
|
|
|
var file = e.target.files[0]; |
|
|
var file = e.target.files[0]; |
|
|
|
|
|
|
|
|
// setting up the reader |
|
|
|
|
|
var reader = new FileReader(); |
|
|
var reader = new FileReader(); |
|
|
reader.readAsText(file,'UTF-8'); |
|
|
reader.readAsText(file,'UTF-8'); |
|
|
|
|
|
|
|
|
// here we tell the reader what to do when it's done reading... |
|
|
|
|
|
reader.onload = readerEvent => { |
|
|
reader.onload = readerEvent => { |
|
|
var content = readerEvent.target.result; // this is the content! |
|
|
|
|
|
editor.setValue(content); |
|
|
|
|
|
|
|
|
editor.setValue(readerEvent.target.result); |
|
|
editor.clearSelection(); |
|
|
editor.clearSelection(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|