From 166fa0eb876277fe14036e0d829ff54241574df1 Mon Sep 17 00:00:00 2001 From: Michel Heusschen <59014050+michelheusschen@users.noreply.github.com> Date: Tue, 23 Jan 2024 16:06:57 +0100 Subject: [PATCH] fix: show only selected files for merge tool --- src/main/resources/static/js/merge.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/main/resources/static/js/merge.js b/src/main/resources/static/js/merge.js index b90c7be2..7ca524d2 100644 --- a/src/main/resources/static/js/merge.js +++ b/src/main/resources/static/js/merge.js @@ -8,11 +8,18 @@ document.getElementById("fileInput-input").addEventListener("change", function() displayFiles(files); }); +/** + * @param {FileList} files + */ function displayFiles(files) { - var list = document.getElementById("selectedFiles"); + const list = document.getElementById("selectedFiles"); - for (var i = 0; i < files.length; i++) { - var item = document.createElement("li"); + while (list.firstChild) { + list.removeChild(list.firstChild); + } + + for (let i = 0; i < files.length; i++) { + const item = document.createElement("li"); item.className = "list-group-item"; item.innerHTML = `