Fixes issue.

This commit is contained in:
Dimitrios Kaitantzidis 2023-10-14 00:03:08 +03:00
parent 74da8c340d
commit 369ac99a16
4 changed files with 49 additions and 4 deletions

8
.idea/.gitignore vendored Normal file
View file

@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

View file

@ -55,6 +55,17 @@ class PdfActionsManager {
deletePageButtonCallback(e) { deletePageButtonCallback(e) {
var imgContainer = this.getPageContainer(e.target); var imgContainer = this.getPageContainer(e.target);
this.pagesContainer.removeChild(imgContainer); this.pagesContainer.removeChild(imgContainer);
if (this.pagesContainer.childElementCount === 0) {
const filenameInput = document.getElementById('filename-input');
const filenameParagraph = document.getElementById('filename');
const downloadBtn = document.getElementById('export-button');
filenameInput.disabled = true;
filenameInput.value = "";
filenameParagraph.innerText = "";
downloadBtn.disabled = true;
}
}; };
insertFileButtonCallback(e) { insertFileButtonCallback(e) {

View file

@ -34,8 +34,12 @@ class PdfContainer {
window.rotateAll = this.rotateAll; window.rotateAll = this.rotateAll;
const filenameInput = document.getElementById('filename-input'); const filenameInput = document.getElementById('filename-input');
const filenameParagraph = document.getElementById('filename');
filenameInput.onkeyup = this.updateFilename; filenameInput.onkeyup = this.updateFilename;
filenameInput.disabled = true; filenameInput.disabled = true;
filenameInput.innerText = "";
filenameParagraph.innerText = "";
} }
movePageTo(startElement, endElement, scrollTo = false) { movePageTo(startElement, endElement, scrollTo = false) {
@ -70,8 +74,17 @@ class PdfContainer {
const files = e.target.files; const files = e.target.files;
if (files.length > 0) { if (files.length > 0) {
const filenameInput = document.getElementById('filename-input'); const filenameInput = document.getElementById('filename-input');
const pagesContainer = document.getElementById('pages-container');
const downloadBtn = document.getElementById('export-button');
filenameInput.disabled = false; filenameInput.disabled = false;
downloadBtn.disabled = false;
if (pagesContainer.childElementCount === 0) {
filenameInput.value = "";
}
} }
this.addPdfsFromFiles(files, nextSiblingElement); this.addPdfsFromFiles(files, nextSiblingElement);
} }
@ -228,16 +241,15 @@ class PdfContainer {
setDownloadAttribute() { setDownloadAttribute() {
console.log('inside setDownloadAttribute ' + this.filename); console.log('inside setDownloadAttribute ' + this.filename);
this.downloadLink.setAttribute("download", this.filename); this.downloadLink.setAttribute("download", this.filename ? this.filename : 'managed.pdf');
} }
updateFilename() { updateFilename() {
const filenameInput = document.getElementById('filename-input'); const filenameInput = document.getElementById('filename-input');
const filenameParagraph = document.getElementById('filename'); const filenameParagraph = document.getElementById('filename');
console.log('updatedFilename fired ' + filenameInput.value);
this.filename = filenameInput.value; this.filename = filenameInput.value;
filenameParagraph.innerText = this.filename; filenameParagraph.innerText = this.filename + ".pdf";
} }
} }

View file

@ -23,7 +23,7 @@
<div id="global-buttons-container" class="d-flex align-content-center justify-content-center"> <div id="global-buttons-container" class="d-flex align-content-center justify-content-center">
<div class="form-group"> <div class="form-group">
<label for="filename-input">Filename</label> <label for="filename-input">Filename</label>
<input type="text" class="form-control" id="filename-input" placeholder="filename" onkeyup="(e) => updateFilename(e)"> <input type="text" class="form-control" id="filename-input" placeholder="filename" onkeyup="updateFilename()">
</div> </div>
<div class="form-group"> <div class="form-group">
<p>Final name of file: </p><p id="filename"></p> <p>Final name of file: </p><p id="filename"></p>
@ -136,6 +136,20 @@
#global-buttons-container input:disabled { #global-buttons-container input:disabled {
color: #3D3D3D !important; color: #3D3D3D !important;
} }
#global-buttons-container input:disabled::-webkit-input-placeholder { /* WebKit browsers */
color: #6E6865;
}
#global-buttons-container input:disabled:-moz-placeholder { /* Mozilla Firefox 4 to 18 */
color: #6E6865;
}
#global-buttons-container input:disabled::-moz-placeholder { /* Mozilla Firefox 19+ */
color: #6E6865;
}
#global-buttons-container input:disabled:-ms-input-placeholder { /* Internet Explorer 10+ */
color: #6E6865;
}
#global-buttons-container svg { #global-buttons-container svg {
width: 20px; width: 20px;
height: 20px; height: 20px;