From: Vincent Vanwaelscappel Date: Wed, 29 Nov 2023 07:49:46 +0000 (+0100) Subject: wip #6533 @0.25 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=eadb8196e5870f2fe530e1e9a332bfdc37a44c77;p=fluidbook_tools.git wip #6533 @0.25 --- diff --git a/src/Links/Link.php b/src/Links/Link.php index f0d4013..36965cb 100644 --- a/src/Links/Link.php +++ b/src/Links/Link.php @@ -70,6 +70,7 @@ class Link const TEXT_POPUP = 43; const LOTTIE = 44; const COPY_TO_CLIPBOARD = 45; + const SLIDESHOW_INLINE = 46; protected static string|false|null $_linksKey = null; @@ -214,6 +215,8 @@ class Link return new InlineSlideshowLink($id, $init, $compiler); } return new ImageLink($id, $init, $compiler); + case static::SLIDESHOW_INLINE: + return new InlineSlideshowLink($id, $init, $compiler); case static::FILE: return new FileLink($id, $init, $compiler); case static::AUDIO: @@ -654,7 +657,7 @@ class Link } /** - * @return int + * @return float */ public function getDelay(): float { diff --git a/src/Links/SlideshowLink.php b/src/Links/SlideshowLink.php index 737ff3c..602831e 100644 --- a/src/Links/SlideshowLink.php +++ b/src/Links/SlideshowLink.php @@ -5,9 +5,9 @@ namespace Fluidbook\Tools\Links; use Cubist\Util\Files\Files; use Cubist\Util\Graphics\Image; use Cubist\Util\Xml; -use Illuminate\Support\Facades\Log; -class SlideshowLink extends NormalLink { +class SlideshowLink extends NormalLink +{ protected $path; protected $path_absolute; @@ -16,7 +16,8 @@ class SlideshowLink extends NormalLink { protected $baseName = ''; - public function getURL() { + public function getURL() + { if (empty($this->to)) { return ''; @@ -36,18 +37,21 @@ class SlideshowLink extends NormalLink { return '#/slideshow/' . $this->uid; } - public function getAdditionnalContent() { - return 'data-slideshow="' . rawurlencode($this->generateSlideshow('popup')) . '" '; + public function getAdditionnalContent() + { + return parent::getAdditionnalContent() . ' data-slideshow="' . rawurlencode($this->generateSlideshow('popup')) . '" '; } - public function getDefaultTooltip() { + public function getDefaultTooltip() + { return 'view slideshow'; } /** * @throws \Exception */ - public function generateSlideshow($context) { + public function generateSlideshow($context) + { $this->compiler->addSlideshowLibrary($context === 'inline'); $this->allowed_extensions = ['jpg', 'png', 'jpeg', 'gif', 'svg']; @@ -130,7 +134,8 @@ class SlideshowLink extends NormalLink { return $res; } - protected function _getSlidesFromDirectory($path) { + protected function _getSlidesFromDirectory($path) + { $files = Files::getRecursiveDirectoryIterator($path); $slides = []; @@ -154,7 +159,8 @@ class SlideshowLink extends NormalLink { } - protected function _slides($slides, $options = []) { + protected function _slides($slides, $options = []) + { $default_options = [ 'show_captions' => true, 'caption_size' => null, @@ -205,11 +211,13 @@ class SlideshowLink extends NormalLink { } - protected function _orderSlidesByFilename($a, $b) { + protected function _orderSlidesByFilename($a, $b) + { return strcmp($a['path'], $b['path']); } - public function keep() { + public function keep() + { return true; } }