Merge branch 'main' of git@github.com:Frooodle/Stirling-PDF.git into

main
This commit is contained in:
Anthony Stirling 2023-08-06 21:56:47 +01:00
commit c047c46587

View file

@ -80,14 +80,11 @@ function setupFileInput(chooser) {
document.body.addEventListener('dragleave', dragleaveListener); document.body.addEventListener('dragleave', dragleaveListener);
document.body.addEventListener('drop', dropListener); document.body.addEventListener('drop', dropListener);
console.log("Element Id: ", elementId);
$("#" + elementId).on("change", function(e) { $("#" + elementId).on("change", function(e) {
allFiles = Array.from(e.target.files); allFiles = Array.from(e.target.files);
handleFileInputChange(this); handleFileInputChange(this);
}); });
function handleFileInputChange(inputElement) { function handleFileInputChange(inputElement) {
const files = allFiles; const files = allFiles;
const fileNames = files.map(f => f.name); const fileNames = files.map(f => f.name);
@ -96,7 +93,6 @@ function setupFileInput(chooser) {
fileNames.forEach(fileName => { fileNames.forEach(fileName => {
selectedFilesContainer.append("<div>" + fileName + "</div>"); selectedFilesContainer.append("<div>" + fileName + "</div>");
}); });
if (fileNames.length === 1) { if (fileNames.length === 1) {
$(inputElement).siblings(".custom-file-label").addClass("selected").html(fileNames[0]); $(inputElement).siblings(".custom-file-label").addClass("selected").html(fileNames[0]);
} else if (fileNames.length > 1) { } else if (fileNames.length > 1) {