Load pdf libs when needed (#1902)

* feat: only load pdf-lib when its used

* feat: only load pdfjs when its used
This commit is contained in:
Eric
2024-09-15 00:24:04 -07:00
committed by GitHub
parent d389b5e2f3
commit c6c33d611a
12 changed files with 17 additions and 10 deletions

View File

@@ -37,6 +37,7 @@
<!-- pdf selector -->
<div th:replace="~{fragments/common :: fileSelector(name='pdf-upload', multipleInputsForSingleRequest=false, disableMultipleFiles=true, accept='application/pdf')}"></div>
<script type="module" th:src="@{'/pdfjs-legacy/pdf.mjs'}"></script>
<script>
let originalFileName = '';
document.querySelector('input[name=pdf-upload]').addEventListener('change', async (event) => {
@@ -229,6 +230,7 @@
<!-- draggables box -->
<div id="box-drag-container" class="show-on-file-selected">
<canvas id="pdf-canvas"></canvas>
<script th:src="@{'/js/thirdParty/pdf-lib.min.js'}"></script>
<script th:src="@{'/js/draggable-utils.js'}"></script>
<div class="draggable-buttons-box ignore-rtl">
<button class="btn btn-outline-secondary" onclick="DraggableUtils.deleteDraggableCanvas(DraggableUtils.getLastInteracted())">