From 74da8c340df8ae3a35d6f16b57bde0e988056596 Mon Sep 17 00:00:00 2001 From: Dimitrios Kaitantzidis Date: Tue, 10 Oct 2023 20:24:11 +0300 Subject: [PATCH] Adds support for disabled filename input if not pdf is loaded. Need to disable the input if all pages are deleted. --- src/main/resources/static/js/multitool/PdfContainer.js | 6 +++++- src/main/resources/templates/multi-tool.html | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/resources/static/js/multitool/PdfContainer.js b/src/main/resources/static/js/multitool/PdfContainer.js index 4a871efb..f7ffec36 100644 --- a/src/main/resources/static/js/multitool/PdfContainer.js +++ b/src/main/resources/static/js/multitool/PdfContainer.js @@ -35,6 +35,7 @@ class PdfContainer { const filenameInput = document.getElementById('filename-input'); filenameInput.onkeyup = this.updateFilename; + filenameInput.disabled = true; } movePageTo(startElement, endElement, scrollTo = false) { @@ -67,6 +68,10 @@ class PdfContainer { input.setAttribute("accept", "application/pdf"); input.onchange = async(e) => { const files = e.target.files; + if (files.length > 0) { + const filenameInput = document.getElementById('filename-input'); + filenameInput.disabled = false; + } this.addPdfsFromFiles(files, nextSiblingElement); } @@ -224,7 +229,6 @@ class PdfContainer { setDownloadAttribute() { console.log('inside setDownloadAttribute ' + this.filename); this.downloadLink.setAttribute("download", this.filename); - console.log('downloadLink download 2 ' + a.download); } updateFilename() { diff --git a/src/main/resources/templates/multi-tool.html b/src/main/resources/templates/multi-tool.html index 9e2da94f..4266a795 100644 --- a/src/main/resources/templates/multi-tool.html +++ b/src/main/resources/templates/multi-tool.html @@ -132,6 +132,10 @@ #global-buttons-container input::placeholder { color: #ffffff; } + + #global-buttons-container input:disabled { + color: #3D3D3D !important; + } #global-buttons-container svg { width: 20px; height: 20px;