]> _ Git - fluidbook-toolbox.git/commitdiff
wip #5929 @0.75
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 29 Aug 2023 08:59:24 +0000 (10:59 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 29 Aug 2023 08:59:24 +0000 (10:59 +0200)
app/Fluidbook/Compiler/Compiler.php
app/SubForms/Link/Base.php
app/SubForms/Link/Lottie.php [new file with mode: 0644]
resources/linkeditor/js/linkeditor.form.js

index a0c7d3f8594d7ab97ae6a0757e35c7bec3e166ca..6d2db54f381ce4def15fc8ab0c9a85f0ef3eefea 100644 (file)
@@ -1479,8 +1479,7 @@ class Compiler extends Base implements CompilerInterface
         if ($link['page'] <= 0 || $link['page'] > $this->fluidbookSettings->pages) {
             return;
         }
-
-        $this->config->bookmarkGroups[] = array('page' => ($link['page']), 'nb' => $link['to'], 'name' => $link['extra']);
+        $this->config->push('bookmarkGroups', ['page' => ($link['page']), 'nb' => $link['to'], 'name' => $link['extra']]);
     }
 
     public function addTriggersLink($page, $link, $delay = 0)
index 2f5ea5317078211bc42d8401e36f1747dc979e26..1844cdfde82858aa8f94ff5c1394e575996ba27c 100644 (file)
@@ -56,6 +56,7 @@ class Base extends Form
     protected static $_acceptAudio = ['.mp3'];
     protected static $_acceptHtml = ['.html'];
     protected static $_acceptIframe = ['.oam', '.zip', '.html', '.pdf'];
+    protected static $_acceptLottie = ['.zip', '.html'];
     protected static $_acceptSlideshow = ['.jpg', '.jpeg', '.png', '.svg', '.gif', '.zip'];
     protected static $_acceptPDF = ['.pdf'];
 
@@ -104,6 +105,7 @@ class Base extends Form
             ['type' => \Fluidbook\Tools\Links\Link::FLIPCARD, 'label' => __('Flipcard'), 'color' => '#460e3f', 'class' => Flipcard::class],
             ['type' => \Fluidbook\Tools\Links\Link::PDF, 'label' => __('PDF'), 'color' => '#af48d1', 'class' => PDF::class],
             ['type' => \Fluidbook\Tools\Links\Link::ACTION, 'label' => __('Action'), 'color' => '#880000', 'class' => Action::class],
+            ['type' => \Fluidbook\Tools\Links\Link::LOTTIE, 'label' => __('Animation Lottie'), 'color' => '#ffaaff', 'class' => Lottie::class],
             //['type' => \Fluidbook\Tools\Links\Link::HTML5MULTIMEDIA, 'label' => __('Lien Multimédia (HTML)'), 'color' => '#34A853', 'disabled' => true, 'class' => Web::class],
             //['type' => \Fluidbook\Tools\Links\Link::BOOKMARK_CORNER, 'label' => __('Lien marque-page sur coin de page'), 'color' => '#000000', 'disabled' => true, 'class' => Web::class],
             //['type' => \Fluidbook\Tools\Links\Link::PAGE_CORNER, 'label' => __('Coin de page'), 'color' => '#f19043', 'disabled' => true, 'class' => Web::class],
@@ -318,7 +320,7 @@ class Base extends Form
             if ($type['type'] === Link::MULTIMEDIA) {
                 $optionsChoices['to'] = ['file.jpg', 'file.zip'];
             } else if ($type['type'] === Link::LAYER) {
-                $optionsChoices['to'] = ['', 'both','bothsvg', 'image', 'text', 'onlytext'];
+                $optionsChoices['to'] = ['', 'both', 'bothsvg', 'image', 'text', 'onlytext'];
             }
 
             $configs[$type['type']] = $optionsChoices;
diff --git a/app/SubForms/Link/Lottie.php b/app/SubForms/Link/Lottie.php
new file mode 100644 (file)
index 0000000..7e318d0
--- /dev/null
@@ -0,0 +1,28 @@
+<?php
+
+namespace App\SubForms\Link;
+
+use App\Fluidbook\Link\Link;
+use Cubist\Backpack\Magic\Fields\CheckboxBasic;
+use Cubist\Backpack\Magic\Fields\FilesOrURL;
+
+class Lottie extends Base
+{
+    public $type = Link::LOTTIE;
+    public $_integration = false;
+    public $_multimedia = true;
+
+    public function addDestinationField()
+    {
+        $this->addField('to', FilesOrURL::class, __('Animation Lottie'), $this->getFilesOrURLEntry() + ['accept' => self::$_acceptLottie]);
+    }
+
+    public function addMultimediaFields()
+    {
+        parent::addMultimediaFields();
+        $this->addField('interactive', CheckboxBasic::class, __('Animation interactive'), ['default' => false]);
+        $this->addField('background', \Cubist\Backpack\Magic\Fields\Color::class, __('Couleur de fond'), ['default' => 'rgba(0,0,0,0)']);
+        $this->addField('video_auto_start', CheckboxBasic::class, __('Jouer l\'animation automatiquement'), ['default' => true]);
+        $this->addField('video_loop', CheckboxBasic::class, __('Jouer l\'animation en boucle'), ['default' => false]);
+    }
+}
index fcb4ac3c6011cc244f15f08acd6e1ee117e67512..c36c0197a425ebe6bbb51a34ed96658e3fa7c8c6 100644 (file)
@@ -304,7 +304,7 @@ LinkeditorForm.prototype = {
             let s = $(this).spectrum({
                 preferredFormat: 'hex3',
                 showAlpha: true,
-                allowEmpty: false,
+                allowEmpty: $(t).attr('data-allow-empty') === 'true',
                 showInput: true,
                 showInitial: true,
                 showButtons: false,