Selaa lähdekoodia

chooseFile: reorder args with optional at the end

trethaller 4 vuotta sitten
vanhempi
commit
5d04036d06
2 muutettua tiedostoa jossa 5 lisäystä ja 6 poistoa
  1. 3 4
      hide/Ide.hx
  2. 2 2
      hide/comp/cdb/Cell.hx

+ 3 - 4
hide/Ide.hx

@@ -840,15 +840,14 @@ class Ide {
 		}).appendTo(window.window.document.body).click();
 		}).appendTo(window.window.document.body).click();
 	}
 	}
 
 
-	public function chooseFile( workingdir : String =null, exts : Array<String>, onSelect : Null<String> -> Void, allowNull=false ) {
+	public function chooseFile( exts : Array<String>, onSelect : Null<String> -> Void, allowNull = false, workingdir:String = null) {
 		var path = "";
 		var path = "";
-		if (workingdir != null && workingdir != "#MISSING")
-		{
+		if (workingdir != null && workingdir != "#MISSING") {
 			var pathArray = getPath(workingdir).split("/");
 			var pathArray = getPath(workingdir).split("/");
 			var c = isWindows ? "\\" : "/";
 			var c = isWindows ? "\\" : "/";
 			path = pathArray.join(c);
 			path = pathArray.join(c);
 		}
 		}
-		
+
 		var e = new Element('<input type="file" style="visibility:hidden" value="" nwworkingdir="$path" accept="${[for( e in exts ) "."+e].join(",")}"/>');
 		var e = new Element('<input type="file" style="visibility:hidden" value="" nwworkingdir="$path" accept="${[for( e in exts ) "."+e].join(",")}"/>');
 		e.change(function(_) {
 		e.change(function(_) {
 			var file = e.val();
 			var file = e.val();

+ 2 - 2
hide/comp/cdb/Cell.hx

@@ -669,10 +669,10 @@ class Cell extends Component {
 			};
 			};
 			modal.click(function(_) color.close());
 			modal.click(function(_) color.close());
 		case TFile:
 		case TFile:
-			ide.chooseFile(currentValue, ["*"], function(file) {
+			ide.chooseFile(["*"], function(file) {
 				setValue(file);
 				setValue(file);
 				refresh();
 				refresh();
-			});
+			}, false, currentValue);
 		case TFlags(values):
 		case TFlags(values):
 			var div = new Element("<div>").addClass("flagValues");
 			var div = new Element("<div>").addClass("flagValues");
 			div.click(function(e) e.stopPropagation()).dblclick(function(e) e.stopPropagation());
 			div.click(function(e) e.stopPropagation()).dblclick(function(e) e.stopPropagation());