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

View File

@ -251,13 +251,14 @@ class PatchContainer {
self.loadFile(files[0]);
});
var filepickerId = createID();
this.fileInput = $("<input>",
{
"class": "fileInput",
"id": "any-file",
"id": filepickerId,
"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.");
this.fileInput.on("change", function (e) {
@ -396,11 +397,12 @@ class Patcher {
self.loadFile(files[0]);
});
var filepickerId = createID();
this.fileInput = $("<input>",
{"class": "fileInput",
"id" : this.filename + '-file',
"id" : filepickerId,
"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.');
this.fileInput.on('change', function(e) {
@ -495,4 +497,4 @@ class Patcher {
window.Patcher = Patcher;
window.PatchContainer = PatchContainer;
})(window, document);
})(window, document);