Browse Source

Hidden File Input reset after loading a project.

dev
Bryan Miller 5 years ago
parent
commit
97c0a73619
2 changed files with 10 additions and 4 deletions
  1. +7
    -3
      app/js/ctrls/CTRLIO.js
  2. +3
    -1
      views/header.html

+ 7
- 3
app/js/ctrls/CTRLIO.js View File

@@ -75,11 +75,15 @@ function HANDLE_LoadProjectRequest(){
function HANDLE_LoadProject(e){
if (this.files && this.files.length > 0){
var reader = new FileReader();
reader.onload = function(e) {
reader.onload = (function(e) {
var content = e.target.result;
console.log(content);
// TODO: Need to clear out the selected files after load.
};
if (this.parentNode.nodeName.toLowerCase() === "form"){
this.parentNode.reset();
} else {
console.log("WARNING: Parent node is NOT a <form> element.");
}
}).bind(this);
reader.readAsText(this.files[0]);
} else {
console.log("Project file not found or no file selected.");

+ 3
- 1
views/header.html View File

@@ -14,7 +14,9 @@
</a>
<ul class="pure-menu-children">
<li class="pure-menu-item" emit="load-project">
<input type="file" class="project-loader" accept="text/plain" style="display:none;"></input>
<form>
<input type="file" class="project-loader" accept="text/plain" style="display:none;"></input>
</form>
<a href="#" class="pure-menu-link">
<i class="fa fa-folder-open"></i>
Load Project

Loading…
Cancel
Save