Add button to input to allow opening of files using the file prompt.

This commit is contained in:
j433866 2019-01-18 15:07:19 +00:00
parent f600571c6d
commit 0c14bacea7
3 changed files with 25 additions and 0 deletions

View file

@ -251,6 +251,26 @@ class InputWaiter {
}
}
/**
* Handler for open input button events
* Loads the opened data into the input textarea
*
* @param {event} e
*/
inputOpen(e) {
e.preventDefault();
const file = e.srcElement.files[0];
if (file) {
this.closeFile();
this.loaderWorker = new LoaderWorker();
this.loaderWorker.addEventListener("message", this.handleLoaderMessage.bind(this));
this.loaderWorker.postMessage({"file": file});
this.set(file);
}
}
/**
* Handler for messages sent back by the LoaderWorker.