From 4c8ac82aea87f3b649576ce013537764ba0cd05c Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Tue, 29 Aug 2023 10:59:24 +0200 Subject: [PATCH] wip #5929 @0.75 --- app/Fluidbook/Compiler/Compiler.php | 3 +-- app/SubForms/Link/Base.php | 4 +++- app/SubForms/Link/Lottie.php | 28 ++++++++++++++++++++++ resources/linkeditor/js/linkeditor.form.js | 2 +- 4 files changed, 33 insertions(+), 4 deletions(-) create mode 100644 app/SubForms/Link/Lottie.php diff --git a/app/Fluidbook/Compiler/Compiler.php b/app/Fluidbook/Compiler/Compiler.php index a0c7d3f85..6d2db54f3 100644 --- a/app/Fluidbook/Compiler/Compiler.php +++ b/app/Fluidbook/Compiler/Compiler.php @@ -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) diff --git a/app/SubForms/Link/Base.php b/app/SubForms/Link/Base.php index 2f5ea5317..1844cdfde 100644 --- a/app/SubForms/Link/Base.php +++ b/app/SubForms/Link/Base.php @@ -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 index 000000000..7e318d07c --- /dev/null +++ b/app/SubForms/Link/Lottie.php @@ -0,0 +1,28 @@ +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]); + } +} diff --git a/resources/linkeditor/js/linkeditor.form.js b/resources/linkeditor/js/linkeditor.form.js index fcb4ac3c6..c36c0197a 100644 --- a/resources/linkeditor/js/linkeditor.form.js +++ b/resources/linkeditor/js/linkeditor.form.js @@ -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, -- 2.39.5