1
0
Fork 0
mirror of https://github.com/24eme/signaturepdf synced 2026-03-14 13:55:44 +01:00

organization: button "Download selection" instead of "Download full

PDF" when pages selected
This commit is contained in:
Vincent LAURENT 2025-07-10 00:50:15 +02:00
commit ad4be4c0f1
2 changed files with 20 additions and 11 deletions

View file

@ -526,7 +526,8 @@ function updateGlobalState() {
document.querySelector('#top_bar_action_selection').classList.add('d-none');
document.querySelector('#bottom_bar_action').classList.remove('d-none');
document.querySelector('#bottom_bar_action_selection').classList.add('d-none');
document.querySelector('#save').removeAttribute('disabled');
document.querySelector('#save').classList.remove('d-none');
document.querySelector('#save_select').classList.add('d-none');
if(isSelectionMode()) {
document.querySelector('#container_btn_select .card-header span').innerText = document.querySelectorAll('.canvas-container .input-select:checked').length;
@ -548,7 +549,8 @@ function updateGlobalState() {
document.querySelector('#top_bar_action').classList.add('d-none');
document.querySelector('#bottom_bar_action_selection').classList.remove('d-none');
document.querySelector('#bottom_bar_action').classList.add('d-none');
document.querySelector('#save').setAttribute('disabled', 'disabled');
document.querySelector('#save').classList.add('d-none');
document.querySelector('#save_select').classList.remove('d-none');
}
}
@ -757,17 +759,23 @@ function getPDFTags(node) {
}
function createEventsListener() {
document.getElementById('save-select_mobile').addEventListener('click', async function(event) {
document.getElementById('save_select_mobile').addEventListener('click', async function(event) {
event.preventDefault();
startProcessingMode(document.getElementById('save-select_mobile'));
startProcessingMode(document.getElementById('save_select_mobile'));
await saveAll();
endProcessingMode(document.getElementById('save-select_mobile'));
endProcessingMode(document.getElementById('save_select_mobile'));
});
document.getElementById('save-select').addEventListener('click', async function(event) {
document.getElementById('btn_extract_select').addEventListener('click', async function(event) {
event.preventDefault();
startProcessingMode(document.getElementById('save-select'));
startProcessingMode(document.getElementById('btn_extract_select'));
await saveAll();
endProcessingMode(document.getElementById('save-select'));
endProcessingMode(document.getElementById('btn_extract_select'));
});
document.getElementById('save_select').addEventListener('click', async function(event) {
event.preventDefault();
startProcessingMode(document.getElementById('save_select'));
await saveAll();
endProcessingMode(document.getElementById('save_select'));
});
document.getElementById('save').addEventListener('click', async function(e) {
e.preventDefault();
@ -850,7 +858,7 @@ function createEventsListener() {
document.querySelector('#btn_liste_pdf').click();
});
document.querySelector('body').addEventListener('click', function(event) {
if(!event.originalTarget.classList.contains('offcanvas-header') && !event.originalTarget.classList.contains('offcanvas-body') && event.originalTarget.id != 'container-pages' && event.originalTarget.id != 'sidebarToolsLabel' && event.originalTarget.id != 'btn_container') {
if(!event.originalTarget.classList.contains('offcanvas-header') && !event.originalTarget.classList.contains('offcanvas-body') && event.originalTarget.id != 'container-pages' && event.originalTarget.id != 'sidebarTools' && event.originalTarget.id != 'sidebarToolsLabel' && event.originalTarget.id != 'btn_container') {
return;
}
document.getElementById('btn_cancel_select').click();

View file

@ -63,7 +63,7 @@
<button id="btn_rotate_select" disabled="disabled" type="button" class="btn btn-sm btn-outline-secondary"><?php echo sprintf(_("%s Rotate 90°"), '<i class="bi bi-arrow-clockwise"></i>'); ?></button>
<button id="btn_drag_select" disabled="disabled" type="button" class="btn btn-sm btn-outline-secondary"><?php echo sprintf(_("%s Move"), '<i class="bi bi-arrows-move"></i>'); ?></button>
<button id="btn_delete_select" disabled="disabled" type="button" class="btn btn-sm btn-outline-secondary"><?php echo sprintf(_("%s Delete"), '<i class="bi bi-trash"></i>'); ?></button>
<button id="save-select" class="btn btn-sm btn-outline-secondary" disabled="disabled" form="form_pdf" type="submit"><?php echo sprintf(_("%s Extract and download"), '<i class="bi bi-download"></i>'); ?></button>
<button id="btn_extract_select" class="btn btn-sm btn-outline-secondary" disabled="disabled" form="form_pdf" type="submit"><?php echo sprintf(_("%s Extract and download"), '<i class="bi bi-download"></i>'); ?></button>
</div>
<div class="card-footer d-none small text-center p-1 border-primary bg-primary bg-opacity-25"><a id="btn_cancel_select_footer" type="button" aria-label="Close" style="text-decoration: none;" class="text-primary"><?php echo sprintf(_("%s Cancel selection"), '<i class="bi bi-x-lg"></i>'); ?></a></div>
</div>
@ -80,6 +80,7 @@
</button>
<button class="btn btn-primary" type="submit" id="save"><?php echo sprintf(_("%s Download the full PDF"), '<i class="bi bi-download"></i>'); ?></button>
<button id="save_select" class="btn btn-outline-primary d-none" type="submit"><i class="bi bi-download"></i> <?php echo _("Download the selection"); ?></button>
</div>
</form>
</div>
@ -108,7 +109,7 @@
<button class="btn btn-primary" type="submit" id="save_mobile"><?php echo sprintf(_("%s Download the full PDF"), '<i class="bi bi-download"></i>'); ?></button>
</div>
<div id="bottom_bar_action_selection" class="d-grid gap-2 d-none">
<button id="save-select_mobile" class="btn btn-outline-primary" type="submit" form="form_pdf"><i class="bi bi-download"></i> <?php echo _("Download the selection"); ?></button>
<button id="save_select_mobile" class="btn btn-outline-primary" type="submit" form="form_pdf"><i class="bi bi-download"></i> <?php echo _("Download the selection"); ?></button>
</div>
</div>
</div>