mirror of
https://github.com/Frooodle/Stirling-PDF.git
synced 2024-12-21 19:08:24 +01:00
Changes filename using js, but the old filename persists in download
This commit is contained in:
parent
f3ddf18a23
commit
a1b7aaddb8
@ -14,6 +14,7 @@ class PdfContainer {
|
|||||||
this.rotateElement = this.rotateElement.bind(this);
|
this.rotateElement = this.rotateElement.bind(this);
|
||||||
this.rotateAll = this.rotateAll.bind(this);
|
this.rotateAll = this.rotateAll.bind(this);
|
||||||
this.exportPdf = this.exportPdf.bind(this);
|
this.exportPdf = this.exportPdf.bind(this);
|
||||||
|
this.updateFilename = this.updateFilename.bind(this);
|
||||||
|
|
||||||
this.pdfAdapters = pdfAdapters;
|
this.pdfAdapters = pdfAdapters;
|
||||||
|
|
||||||
@ -28,6 +29,9 @@ class PdfContainer {
|
|||||||
window.addPdfs = this.addPdfs;
|
window.addPdfs = this.addPdfs;
|
||||||
window.exportPdf = this.exportPdf;
|
window.exportPdf = this.exportPdf;
|
||||||
window.rotateAll = this.rotateAll;
|
window.rotateAll = this.rotateAll;
|
||||||
|
|
||||||
|
const filenameInput = document.getElementById('filename-input');
|
||||||
|
filenameInput.onkeyup = this.updateFilename;
|
||||||
}
|
}
|
||||||
|
|
||||||
movePageTo(startElement, endElement, scrollTo = false) {
|
movePageTo(startElement, endElement, scrollTo = false) {
|
||||||
@ -202,10 +206,20 @@ class PdfContainer {
|
|||||||
// Download the file
|
// Download the file
|
||||||
const downloadLink = document.createElement('a');
|
const downloadLink = document.createElement('a');
|
||||||
downloadLink.href = url;
|
downloadLink.href = url;
|
||||||
|
console.log('filename before download ' + this.filename);
|
||||||
downloadLink.download = this.fileName ? this.fileName : 'managed.pdf';
|
downloadLink.download = this.fileName ? this.fileName : 'managed.pdf';
|
||||||
downloadLink.click();
|
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;
|
export default PdfContainer;
|
||||||
|
@ -20,6 +20,15 @@
|
|||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row justify-content-center">
|
<div class="row justify-content-center">
|
||||||
<div class="col-md-6" style="text-align: center">
|
<div class="col-md-6" style="text-align: center">
|
||||||
|
<div id="global-buttons-container" class="d-flex align-content-center justify-content-center">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="filename-input">Filename</label>
|
||||||
|
<input type="text" class="form-control" id="filename-input" placeholder="filename" onkeyup="(e) => updateFilename(e)">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<p>Final name of file: </p><p id="filename"></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div id="global-buttons-container">
|
<div id="global-buttons-container">
|
||||||
|
|
||||||
<button class="btn btn-primary" onclick="addPdfs()">
|
<button class="btn btn-primary" onclick="addPdfs()">
|
||||||
@ -29,6 +38,7 @@
|
|||||||
</svg>
|
</svg>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
|
||||||
<button class="btn btn-secondary enable-on-file" onclick="rotateAll(-90)" disabled>
|
<button class="btn btn-secondary enable-on-file" onclick="rotateAll(-90)" disabled>
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrow-counterclockwise" viewBox="0 0 16 16">
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrow-counterclockwise" viewBox="0 0 16 16">
|
||||||
<path fill-rule="evenodd" d="M8 3a5 5 0 1 1-4.546 2.914.5.5 0 0 0-.908-.417A6 6 0 1 0 8 2v1z" />
|
<path fill-rule="evenodd" d="M8 3a5 5 0 1 1-4.546 2.914.5.5 0 0 0-.908-.417A6 6 0 1 0 8 2v1z" />
|
||||||
@ -114,6 +124,14 @@
|
|||||||
#global-buttons-container > * {
|
#global-buttons-container > * {
|
||||||
padding: 0.6rem 0.75rem;
|
padding: 0.6rem 0.75rem;
|
||||||
}
|
}
|
||||||
|
#global-buttons-container input {
|
||||||
|
background-color: #323948;
|
||||||
|
caret-color: #ffffff;
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
#global-buttons-container input::placeholder {
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
#global-buttons-container svg {
|
#global-buttons-container svg {
|
||||||
width: 20px;
|
width: 20px;
|
||||||
height: 20px;
|
height: 20px;
|
||||||
|
Loading…
Reference in New Issue
Block a user