]> _ Git - fluidbook-toolbox.git/commitdiff
wip #5524 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 22 Feb 2023 09:55:07 +0000 (10:55 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 22 Feb 2023 09:55:07 +0000 (10:55 +0100)
resources/linkeditor/js/linkeditor.loader.js
resources/views/fluidbook_publication/link_editor.blade.php

index b64cb9dccc02cccc7568514e8d4dd0da3d50ab65..c40a701f3ab94ce3bcb76d12d9d1892b0ef20b34 100644 (file)
@@ -36,9 +36,20 @@ LinkeditorLoader.prototype = {
     },
 
     togglePagesSource: function () {
+        var $this = this;
         this.pagesSource = this.pagesSource === 'pages' ? 'thumbnails' : 'pages';
         this.clearPreloads();
-        this.preloadPages();
+        $(".linkeditor-page").each(function () {
+            let p = parseInt($(this).attr('data-page'));
+            if (isNaN(p) || p === 0 || p > FLUIDBOOK_DATA.settings.pages) {
+                $(this).html('');
+            } else {
+                $this._loadPage(p, $(this));
+            }
+        });
+        setTimeout(function () {
+            $this.preloadPages();
+        }, 2000);
     },
 
     clearPreloads: function () {
@@ -70,7 +81,7 @@ LinkeditorLoader.prototype = {
         if (this.linkeditor.utils.isSpecialPage(p)) {
             c += '<img draggable="false" class="images" src="' + this.linkeditor.utils.getSpecialPageAssetURL(p) + '" />';
         } else {
-            if(this.pagesSource==='pages') {
+            if (this.pagesSource === 'pages') {
                 if (this.rasterizePages.indexOf(p) >= 0) {
                     c += '<img draggable="false" src="raster_' + p + '.' + imageFormat + '" />';
                 } else if (this.vectorPages.indexOf(p) >= 0) {
@@ -79,7 +90,7 @@ LinkeditorLoader.prototype = {
                     c += '<img draggable="false" class="images" src="images_' + p + '.' + imageFormat + '" />';
                     c += '<img draggable="false" class="texts" src="texts_' + p + '.svg" />';
                 }
-            }else if(this.pagesSource==='thumbnails'){
+            } else if (this.pagesSource === 'thumbnails') {
                 c += '<img draggable="false" src="thumbspdf_' + p + '.' + imageFormat + '" />';
             }
         }
index 583ae3ed072ef5abd70556decf7146856b7c0266..f40526dbd1a7ddddba8d8dd3d801f899c50779b3 100644 (file)
                     @endif
                     <div class="separator"></div>
                     @if($fluidbook->pdfThumbnails)
-                        <a href="#" data-action="" data-icon="pdf-thumbnails"
+                        <a href="#" data-action="togglePDFThumbnails" data-icon="pdf-thumbnails"
                            data-tooltip="{{__('Afficher les pages du PDF des miniatures')}}"></a>
                     @endif
                     <a href="#" data-action="toggleWhiteOverlay" data-icon="white-overlay"