]> _ Git - fluidbook-toolbox.git/commitdiff
wait #6120 @1.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 7 Jul 2023 16:34:21 +0000 (18:34 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 7 Jul 2023 16:34:21 +0000 (18:34 +0200)
app/Fluidbook/Compiler/Compiler.php
app/Fluidbook/Link/LinksData.php
resources/linkeditor/js/linkeditor.form.js
resources/linkeditor/js/linkeditor.links.js

index 5c2641ecbb7d4f3416e2a30a311c4f306c90c4a8..d466ad9bcf36f625084049562b6af56ebf1f2f74 100644 (file)
@@ -49,6 +49,7 @@ class Compiler extends Base implements CompilerInterface
     use Favicon;
     use Secure;
     use Images;
+    use Sound;
 
     protected static $uaPrefixes = array('-moz-', '-webkit-', '-o-', '-ms-', '');
 
@@ -666,7 +667,7 @@ class Compiler extends Base implements CompilerInterface
     public function handle()
     {
         $this->log('Preprocess images');
-        FluidbookImagesPreprocess::dispatchSync($this->book_id);
+        (new FluidbookImagesPreprocess($this->book_id))->handle();
         $this->log('Start compile process');
 
         // Raw copy of some directories
@@ -855,18 +856,6 @@ class Compiler extends Base implements CompilerInterface
         }
     }
 
-    /**
-     * @throws \Exception
-     */
-    protected function writeSounds()
-    {
-        if (!$this->fluidbookSettings->soundTheme || $this->fluidbookSettings->soundTheme === 'none') {
-            return;
-        }
-        $dir = resource_path('fluidbookpublication/sounds/' . $this->fluidbookSettings->soundTheme);
-        $this->setSetting('simpleSoundTheme', file_exists($dir . '/flip.mp3'));
-        $this->vdir->copyDirectory($dir, 'data/sounds');
-    }
 
     protected function writeAccessibility()
     {
@@ -1836,14 +1825,14 @@ class Compiler extends Base implements CompilerInterface
         return $this->config->get($k);
     }
 
-    public function getWidth()
+    public function getWidth($page = 1)
     {
-        return $this->getPageDimension(1)[0];
+        return $this->getPageDimension($page)[0];
     }
 
-    public function getHeight()
+    public function getHeight($page = 1)
     {
-        return $this->getPageDimension(1)[1];
+        return $this->getPageDimension($page)[1];
     }
 
 
@@ -2896,14 +2885,14 @@ class Compiler extends Base implements CompilerInterface
         return $this->getFluidbook()->getPDFSplitSource($page);
     }
 
-    public function getWidthForLinks()
+    public function getWidthForLinks($page = 1)
     {
-        return $this->getWidth() / $this->getLinkScale();
+        return $this->getWidth($page) / $this->getLinkScale();
     }
 
-    public function getHeightForLinks()
+    public function getHeightForLinks($page = 1)
     {
-        return $this->getHeight() / $this->getLinkScale();
+        return $this->getHeight($page) / $this->getLinkScale();
     }
 
     /**
@@ -2934,3 +2923,5 @@ class Compiler extends Base implements CompilerInterface
         return (int)$this->config->JPEGQuality;
     }
 }
+
+
index c8bd8ac187359d365d2ec1d0b594aa3e8dc4602d..31afdb7eb85066aa1ab8415207c4469a85864d03 100644 (file)
@@ -263,8 +263,19 @@ class LinksData
         self::_fixMultimedia($links);
         self::_fixCloseButton($links);
         self::_fixColors($links);
+        self::_fixInline($links);
     }
 
+    protected static function _fixInline(&$links)
+    {
+        foreach ($links as $k => $link) {
+            if (isset($link['inline'])) {
+                $links[$k]['inline'] = Link::normalizeInlineIntegration($link['inline']);
+            }
+        }
+    }
+
+
     protected static function _fixColors(&$links)
     {
         foreach ($links as $k => $link) {
@@ -604,7 +615,7 @@ class LinksData
                 }
 
                 $link = [];
-                $cols = array('page' => '', 'left' => '', 'top' => '', 'width' => '', 'height' => '', 'type' => '', 'to' => '', 'target' => '_blank', 'video_loop' => true, 'video_auto_start' => true, 'video_controls' => true, 'video_sound_on' => true, 'tooltip' => '', 'numerotation' => 'physical', "inline" => true, 'pdfjs' => 'normal');
+                $cols = array('page' => '', 'left' => '', 'top' => '', 'width' => '', 'height' => '', 'type' => '', 'to' => '', 'target' => '_blank', 'video_loop' => true, 'video_auto_start' => true, 'video_controls' => true, 'video_sound_on' => true, 'tooltip' => '', 'numerotation' => 'physical', "inline" => 'inline', 'pdfjs' => 'normal');
                 $k = 0;
                 foreach ($cols as $col => $default) {
                     if (isset($line[$k])) {
index cec7d1aa297aab30fe676f61b0bd6101071b4e3d..08169686d2fafc0ed0b9a06f01359d0b00079a77 100644 (file)
@@ -36,8 +36,17 @@ LinkeditorForm.prototype = {
         });
 
 
+        setInterval(function () {
+            if ($(document.activeElement).is('.sp-input')) {
+                var v = $(document.activeElement).val();
+                let main = $(document.activeElement).closest('.form-group').find('.colorpicker');
+                $(main).val(v);
+                $(main).trigger('change');
 
-        $(document).on('change', "#linkeditor-panel-form input,#linkeditor-panel-form select,#linkeditor-panel-form textarea", function () {
+            }
+        }, 250);
+
+        $(document).on('change keyup', "#linkeditor-panel-form input,#linkeditor-panel-form select,#linkeditor-panel-form textarea", function () {
             if ($this._maskChangeEvent) {
                 return;
             }
@@ -163,7 +172,7 @@ LinkeditorForm.prototype = {
         if (f.length === 0) {
             return;
         }
-        if(!f.is('input,textarea')){
+        if (!f.is('input,textarea')) {
             return;
         }
         f = f.get(0);
@@ -280,7 +289,7 @@ LinkeditorForm.prototype = {
     initSpectrum: function () {
         $("#linkeditor-panel-form .colorpicker:not(.init)").each(function () {
             var t = $(this);
-            $(this).spectrum({
+            let s = $(this).spectrum({
                 preferredFormat: 'hex3',
                 showAlpha: true,
                 allowEmpty: false,
index c7baa03f31d97e469b0b3a46b78c980686528144..b65edbc4370563e85b425c46f0ac16a4ec7a783f 100644 (file)
@@ -1050,7 +1050,7 @@ LinkeditorLinks.prototype = {
             let zindex = ((calcDepth + 1) * 10000) - Math.min(9999, Math.max(1, Math.round(9999 * ((linkWidth * linkHeight) / $this.linkeditor.bookSurface))));
 
             if (isNaN(zindex) || isNaN(calcDepth)) {
-                console.warn('error defining depth of link ' + $(this).attr('fb-uid'), calcDepth, linkWidth, linkHeight, $this.linkeditor.bookSurface);
+                console.warn('error defining depth of link ' + $(this).attr('fb-uid'), calcDepth, $this.findDefaultLinkDepth($(this)), linkWidth, linkHeight, $this.linkeditor.bookSurface);
             }
 
             $(this).attr('fb-calc-depth', calcDepth);
@@ -1066,7 +1066,7 @@ LinkeditorLinks.prototype = {
         $.each(conf, function (k, v) {
             let val = $(link).attr('fb-' + k);
             if (k === 'alternative' || k === 'to') {
-                if (key === 6) {
+                if (key == 6) {
                     let e = val.split('.');
                     let ext = e.pop().toLowerCase();
                     val = (['png', 'jpg', 'jpeg', 'gif', 'webp', 'avif', 'svg'].indexOf(ext) >= 0) ? 'file.jpg' : 'file.zip';
@@ -1077,7 +1077,12 @@ LinkeditorLinks.prototype = {
         if (settings.length > 0) {
             key += '/' + settings.join(',');
         }
-        return DEPTH.depths[key];
+
+        let res = DEPTH.depths[key];
+        if (res === undefined) {
+            console.log('undefined depth key ', key);
+        }
+        return res;
     },
 
     clear: function () {