mirror of
https://github.com/Frooodle/Stirling-PDF.git
synced 2024-12-21 19:08:24 +01:00
Fixed merge conflict. Cleaned up code
This commit is contained in:
parent
b123e8eba5
commit
38925ea4ca
@ -102,7 +102,7 @@
|
||||
<div class="custom-file-chooser">
|
||||
<div class="custom-file">
|
||||
<input type="file" class="custom-file-input" th:name="${name}" th:id="${name}+'-input'" th:multiple="${multiple}">
|
||||
<label class="custom-file-label" th:for="${name}+'-input'">Choose file</label>
|
||||
<label class="custom-file-label" th:for="${name}+'-input'" th:text="#{pdfPrompt}"></label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -113,7 +113,7 @@
|
||||
if (fileNames) {
|
||||
$(this).siblings(".custom-file-label").addClass("selected").html(fileNames);
|
||||
} else {
|
||||
$(this).siblings(".custom-file-label").addClass("selected").html("Choose file");
|
||||
$(this).siblings(".custom-file-label").addClass("selected").html([[#{pdfPrompt}]]);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
@ -19,6 +19,7 @@
|
||||
<div th:replace="fragments/common :: fileSelector(name='fileInput', multiple=false)"></div>
|
||||
<input type="hidden" id="angleInput" name="angle" value="0">
|
||||
|
||||
<div id="editSection" style="display: none">
|
||||
<div class="previewContainer">
|
||||
<img id="pdf-preview"/>
|
||||
</div>
|
||||
@ -38,6 +39,7 @@
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
@ -54,14 +56,11 @@
|
||||
fileInput.addEventListener("change", async function() {
|
||||
console.log("loading pdf");
|
||||
|
||||
preview.parentElement.style.display = "block";
|
||||
document.querySelector(".buttonContainer").style.display = "flex";
|
||||
document.querySelector("#editSection").style.display = "";
|
||||
|
||||
var file = fileInput.files[0];
|
||||
var url = URL.createObjectURL(file)
|
||||
var loadingTask = pdfjsLib.getDocument(url);
|
||||
var url = URL.createObjectURL(fileInput.files[0])
|
||||
|
||||
const pdf = await loadingTask.promise;
|
||||
const pdf = await pdfjsLib.getDocument(url).promise;
|
||||
const page = await pdf.getPage(1);
|
||||
|
||||
const canvas = document.createElement("canvas");
|
||||
@ -115,20 +114,17 @@
|
||||
width: 100%;
|
||||
border: 1px solid rgba(0,0,0,.125);
|
||||
border-radius: 0.25rem;
|
||||
margin: 1rem 0 0;
|
||||
margin: 1rem 0;
|
||||
padding: 15px;
|
||||
display: none;
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.buttonContainer {
|
||||
display: none;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
}
|
||||
button {
|
||||
top-margin: -100%;
|
||||
}
|
||||
</style>
|
||||
</body>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user