Parcourir la source

Hidden File Input reset after loading a project.

dev
Bryan Miller il y a 5 ans
Parent
révision
97c0a73619
2 fichiers modifiés avec 10 ajouts et 4 suppressions
  1. +7
    -3
      app/js/ctrls/CTRLIO.js
  2. +3
    -1
      views/header.html

+ 7
- 3
app/js/ctrls/CTRLIO.js Voir le fichier

@@ -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 Voir le fichier

@@ -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

Chargement…
Annuler
Enregistrer