mirror of
https://github.com/24eme/signaturepdf.git
synced 2023-08-25 09:33:08 +02:00
Hide button share and download when in sharing mode
This commit is contained in:
parent
b5d3b990fb
commit
814793f847
@ -27,9 +27,12 @@ var loadPDF = async function(pdfBlob, filename) {
|
||||
dataTransfer.items.add(new File([pdfBlob], filename, {
|
||||
type: 'application/pdf'
|
||||
}));
|
||||
document.getElementById('input_pdf').files = dataTransfer.files;
|
||||
document.getElementById('input_pdf_share').files = dataTransfer.files;
|
||||
|
||||
if(document.getElementById('input_pdf')) {
|
||||
document.getElementById('input_pdf').files = dataTransfer.files;
|
||||
}
|
||||
if(document.getElementById('input_pdf_share')) {
|
||||
document.getElementById('input_pdf_share').files = dataTransfer.files;
|
||||
}
|
||||
var loadingTask = pdfjsLib.getDocument(url);
|
||||
loadingTask.promise.then(function(pdf) {
|
||||
|
||||
@ -52,7 +55,7 @@ var loadPDF = async function(pdfBlob, filename) {
|
||||
|
||||
var pageIndex = page.pageNumber - 1;
|
||||
|
||||
document.getElementById('form_pdf').insertAdjacentHTML('beforeend', '<input name="svg[' + pageIndex + ']" id="data-svg-' + pageIndex + '" type="hidden" value="" />');
|
||||
document.getElementById('form_block').insertAdjacentHTML('beforeend', '<input name="svg[' + pageIndex + ']" id="data-svg-' + pageIndex + '" type="hidden" value="" />');
|
||||
document.getElementById('container-pages').insertAdjacentHTML('beforeend', '<div class="position-relative mt-1 ms-1 me-1 d-inline-block" id="canvas-container-' + pageIndex +'"><canvas id="canvas-pdf-'+pageIndex+'" class="shadow-sm canvas-pdf"></canvas><div class="position-absolute top-0 start-0"><canvas id="canvas-edition-'+pageIndex+'"></canvas></div></div>');
|
||||
|
||||
var canvasPDF = document.getElementById('canvas-pdf-' + pageIndex);
|
||||
@ -475,8 +478,12 @@ var addObjectInCanvas = function(canvas, item) {
|
||||
};
|
||||
|
||||
var createAndAddSvgInCanvas = function(canvas, item, x, y, height = null) {
|
||||
save.removeAttribute('disabled');
|
||||
save_mobile.removeAttribute('disabled');
|
||||
if(document.getElementById('save')) {
|
||||
document.getElementById('save').removeAttribute('disabled');
|
||||
}
|
||||
if(document.getElementById('save_mobile')) {
|
||||
document.getElementById('save_mobile').removeAttribute('disabled');
|
||||
}
|
||||
|
||||
if(!height) {
|
||||
height = 100;
|
||||
@ -729,15 +736,17 @@ var createEventsListener = function() {
|
||||
event.preventDefault();
|
||||
});
|
||||
|
||||
document.getElementById('save').addEventListener('click', function(event) {
|
||||
var dataTransfer = new DataTransfer();
|
||||
canvasEditions.forEach(function(canvasEdition, index) {
|
||||
dataTransfer.items.add(new File([canvasEdition.toSVG()], index+'.svg', {
|
||||
type: 'image/svg+xml'
|
||||
}));
|
||||
})
|
||||
document.getElementById('input_svg').files = dataTransfer.files;
|
||||
});
|
||||
if(document.getElementById('save')) {
|
||||
document.getElementById('save').addEventListener('click', function(event) {
|
||||
var dataTransfer = new DataTransfer();
|
||||
canvasEditions.forEach(function(canvasEdition, index) {
|
||||
dataTransfer.items.add(new File([canvasEdition.toSVG()], index+'.svg', {
|
||||
type: 'image/svg+xml'
|
||||
}));
|
||||
})
|
||||
document.getElementById('input_svg').files = dataTransfer.files;
|
||||
});
|
||||
}
|
||||
|
||||
document.getElementById('save_mobile').addEventListener('click', function(event) {
|
||||
document.getElementById('save').click();
|
||||
|
@ -70,7 +70,8 @@
|
||||
<div class="d-grid gap-2 mt-2">
|
||||
<button type="button" id="btn-add-svg" class="btn btn-sm btn-light" data-bs-toggle="modal" data-bs-target="#modalAddSvg"><i class="bi bi-plus-circle"></i> Ajouter un élément</button>
|
||||
</div>
|
||||
<div class="position-absolute bottom-0 pb-2 ps-0 pe-4 w-100 d-none d-sm-none d-md-block">
|
||||
<div id="form_block" class="position-absolute bottom-0 pb-2 ps-0 pe-4 w-100 d-none d-sm-none d-md-block">
|
||||
<?php if(!isset($hash)): ?>
|
||||
<form id="form_sharing" action="/share" method="post" enctype="multipart/form-data">
|
||||
<input id="input_pdf_share" name="pdf" type="file" class="d-none" />
|
||||
<div class="d-grid gap-2 mt-2">
|
||||
@ -84,6 +85,7 @@
|
||||
<button class="btn btn-primary" disabled="disabled" type="submit" id="save"><i class="bi bi-download"></i> Télécharger le PDF Signé</button>
|
||||
</div>
|
||||
</form>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user