1
0
mirror of https://github.com/Stirling-Tools/Stirling-PDF.git synced 2024-11-04 23:10:11 +01:00

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) {
var imgContainer = this.getPageContainer(e.target);
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) {

View File

@ -34,8 +34,12 @@ class PdfContainer {
window.rotateAll = this.rotateAll;
const filenameInput = document.getElementById('filename-input');
const filenameParagraph = document.getElementById('filename');
filenameInput.onkeyup = this.updateFilename;
filenameInput.disabled = true;
filenameInput.innerText = "";
filenameParagraph.innerText = "";
}
movePageTo(startElement, endElement, scrollTo = false) {
@ -70,8 +74,17 @@ class PdfContainer {
const files = e.target.files;
if (files.length > 0) {
const filenameInput = document.getElementById('filename-input');
const pagesContainer = document.getElementById('pages-container');
const downloadBtn = document.getElementById('export-button');
filenameInput.disabled = false;
downloadBtn.disabled = false;
if (pagesContainer.childElementCount === 0) {
filenameInput.value = "";
}
}
this.addPdfsFromFiles(files, nextSiblingElement);
}
@ -228,16 +241,15 @@ class PdfContainer {
setDownloadAttribute() {
console.log('inside setDownloadAttribute ' + this.filename);
this.downloadLink.setAttribute("download", this.filename);
this.downloadLink.setAttribute("download", this.filename ? this.filename : 'managed.pdf');
}
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;
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 class="form-group">
<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 class="form-group">
<p>Final name of file: </p><p id="filename"></p>
@ -136,6 +136,20 @@
#global-buttons-container input:disabled {
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 {
width: 20px;
height: 20px;