Give file pickers unique IDs to fix many patchers

This commit is contained in:
Will Toohey
2021-02-23 22:45:16 +10:00
parent 9de05e7d1c
commit 200aa521dd
+6 -4
View File
@@ -251,13 +251,14 @@ class PatchContainer {
self.loadFile(files[0]); self.loadFile(files[0]);
}); });
var filepickerId = createID();
this.fileInput = $("<input>", this.fileInput = $("<input>",
{ {
"class": "fileInput", "class": "fileInput",
"id": "any-file", "id": filepickerId,
"type": "file", "type": "file",
}); });
var label = $("<label>", {"class": "fileLabel", "for": "any-file"}); var label = $("<label>", {"class": "fileLabel", "for": filepickerId});
label.html("<strong>Choose a file</strong> or drag and drop."); label.html("<strong>Choose a file</strong> or drag and drop.");
this.fileInput.on("change", function (e) { this.fileInput.on("change", function (e) {
@@ -396,11 +397,12 @@ class Patcher {
self.loadFile(files[0]); self.loadFile(files[0]);
}); });
var filepickerId = createID();
this.fileInput = $("<input>", this.fileInput = $("<input>",
{"class": "fileInput", {"class": "fileInput",
"id" : this.filename + '-file', "id" : filepickerId,
"type" : 'file'}); "type" : 'file'});
var label = $("<label>", {"class": "fileLabel", "for": this.filename + '-file'}); var label = $("<label>", {"class": "fileLabel", "for": filepickerId});
label.html('<strong>Choose a file</strong> or drag and drop.'); label.html('<strong>Choose a file</strong> or drag and drop.');
this.fileInput.on('change', function(e) { this.fileInput.on('change', function(e) {