diff --git a/src/main/resources/static/js/multitool/PdfContainer.js b/src/main/resources/static/js/multitool/PdfContainer.js index 45c92be1..c82b6859 100644 --- a/src/main/resources/static/js/multitool/PdfContainer.js +++ b/src/main/resources/static/js/multitool/PdfContainer.js @@ -14,6 +14,7 @@ class PdfContainer { this.rotateElement = this.rotateElement.bind(this); this.rotateAll = this.rotateAll.bind(this); this.exportPdf = this.exportPdf.bind(this); + this.updateFilename = this.updateFilename.bind(this); this.pdfAdapters = pdfAdapters; @@ -28,6 +29,9 @@ class PdfContainer { window.addPdfs = this.addPdfs; window.exportPdf = this.exportPdf; window.rotateAll = this.rotateAll; + + const filenameInput = document.getElementById('filename-input'); + filenameInput.onkeyup = this.updateFilename; } movePageTo(startElement, endElement, scrollTo = false) { @@ -202,10 +206,20 @@ class PdfContainer { // Download the file const downloadLink = document.createElement('a'); downloadLink.href = url; + console.log('filename before download ' + this.filename); downloadLink.download = this.fileName ? this.fileName : 'managed.pdf'; downloadLink.click(); } } + + updateFilename() { + const filenameInput = document.getElementById('filename-input'); + const filenameParagraph = document.getElementById('filename'); + + console.log('updatedFilename fired ' + filenameInput.value); + this.filename = filenameInput.value; + filenameParagraph.innerText = this.filename; + } } export default PdfContainer; diff --git a/src/main/resources/templates/multi-tool.html b/src/main/resources/templates/multi-tool.html index 0b1d7b8a..9e2da94f 100644 --- a/src/main/resources/templates/multi-tool.html +++ b/src/main/resources/templates/multi-tool.html @@ -20,15 +20,25 @@