]> _ Git - fluidbook-html5.git/commitdiff
wip #7871 @1.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 6 Jan 2026 16:25:00 +0000 (17:25 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 6 Jan 2026 16:25:00 +0000 (17:25 +0100)
js/libs/fluidbook/fluidbook.menu.js
js/libs/fluidbook/menu/fluidbook.pdfform.js
style/menu-pdf.less

index 9f2d424e9ca74cffc4b02382aa29e9e42fb67549..15e25cd4d2ebf79e81cf24c16e9b953dfaa79a8e 100644 (file)
@@ -20,7 +20,7 @@ FluidbookMenu.prototype = {
 
         $(document).on(this.fluidbook.input.clickEvent, "#viewOverlay", function (e) {
             // Don't close if a interactive multimedia popup is currently displayed
-            let close = $(".mview[data-menu=multimedia] .multimediaScale div.multimedia:not(.notinteractive) iframe").length === 0;
+            let close = $(".mview[data-menu=multimedia] .multimediaScale div.multimedia:not(.notinteractive) iframe, .mview.pdfform").length === 0;
             return handleCloseView(e, close);
         });
 
@@ -1183,14 +1183,21 @@ FluidbookMenu.prototype = {
                 break;
             case 'pdfform':
                 this.initPDFViewer();
+
                 iframe = m.find('iframe');
-                seamless = iframe.hasClass('seamless');
-                var pw = iframe.data('width') * 2;
-                var th = iframe.data('total-height') * 2;
+                if ($(iframe).length > 0) {
+                    seamless = iframe.hasClass('seamless');
+                    var pw = iframe.data('width') * 2;
+                    var th = iframe.data('total-height') * 2;
+                    w = Math.min(pw, ww)
+                    ratio = pw / th;
+                } else {
+                    w = 500;
+                    ratio=1;
+                }
 
-                w = Math.min(pw, ww)
                 fullscreen = (w === ww);
-                ratio = pw / th;
+
                 ih = w / ratio;
                 h = Math.min(ih, fullscreen ? hh : hh * 0.9);
 
@@ -1234,6 +1241,7 @@ FluidbookMenu.prototype = {
         if (maxWidth > 0) {
             w = Math.min(maxWidth, w);
         }
+        console.log(maxWidth, w);
 
         css = {};
         var ccss = {};
index 95cafdfaaab1f40fa208dcb141cf40a52b9f87b1..b1258eb4c5d9a8472d5b0e1fed1fa8a747cd309a 100644 (file)
@@ -5,7 +5,8 @@ function FluidbookPDFForm(fluidbook) {
 
 FluidbookPDFForm.prototype = {
     init: function () {
-        $(document).on('click', '.mview[data-menu="pdfform"] .fonctions a.submit', function () {
+        let $this = this;
+        $(document).on('click', '.mview.pdfform .fonctions a.submit', function () {
             let linkId = $(this).closest('.mview').data('linkid');
             let doc = $('.mview[data-menu="pdfform"] iframe').get(0).contentDocument;
             let fields = {};
@@ -28,15 +29,22 @@ FluidbookPDFForm.prototype = {
             let data = {fields: fields};
             data.linkid = linkId;
             $this.fluidbook.service.call('pdfform', data, function (data) {
+                $this.confirmation();
             }, undefined, 'POST');
             return false;
         });
     },
 
+    confirmation: function () {
+        $('.mview.pdfform .content').html('<div class="confirmation">' + this.fluidbook.settings.pdfform_confirm + '</div>');
+        $('.mview.pdfform').attr('data-max-width', 500);
+        this.fluidbook.resize.resize();
+    },
+
     open: function (uid, callback) {
         let $this = this;
         var infos = this.fluidbook.settings.pdfLinks[uid];
-        let c = this.getCaption('', 'nocaption', 'nocaption');
+        let c = this.fluidbook.menu.getCaption('', 'nocaption', 'nocaption');
         c += '<div class="content">';
         c += '<div class="pdf-holder"><iframe class="pdf view ' + infos.interface + '" data-width="' + infos.width + '" data-height="' + infos.height + '" data-total-height="' + infos.totalHeight + '" frameborder="0" scrolling="no" src="pdfjs/web/viewer.' + this.fluidbook.settings.htmlExtension + '?&file=../../data/links/' + infos.file + '#zoom=page-width"></iframe></div>';
         c += '<div class="fonctions">';
@@ -44,7 +52,7 @@ FluidbookPDFForm.prototype = {
         c += '<a role="button" class="submit" href="#">' + (this.fluidbook.settings.pdfform_button ? this.fluidbook.settings.pdfform_button : this.fluidbook.l10n.__('send')) + '</a>';
         c += '</div>';
         c += '</div>';
-        this.viewWrap(c, 'pdfform', 'data-linkid="' + uid + '"', 'pdfform ' + this.fluidbook.settings.pdfform_style);
+        this.fluidbook.menu.viewWrap(c, 'pdfform', 'data-linkid="' + uid + '"', 'pdfform ' + this.fluidbook.settings.pdfform_style);
         if (callback != undefined) {
             callback();
         }
index 836845b274894480721c2df615ec66687366527a..01801d238a97d55895e92c1fdc51333da6dec996 100644 (file)
 }
 
 .mview.pdfform.cfgroup {
+  .confirmation {
+    font-size: 25px;
+    text-align: center;
+    padding: 50px;
+  }
+
   .pdf-holder {
     padding-bottom: 100px;
     @media screen and (max-width: 800px) {