From: Vincent Vanwaelscappel Date: Thu, 2 Mar 2023 21:30:13 +0000 (+0100) Subject: wait #5769 @1 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=4cffb6b82fce2a96456b6413a694a4b4fc77adc3;p=fluidbook-toolbox.git wait #5769 @1 --- diff --git a/app/Fluidbook/Link/Custom/InpesPopinLink.php b/app/Fluidbook/Link/Custom/InpesPopinLink.php index c114607a7..9af1605e5 100644 --- a/app/Fluidbook/Link/Custom/InpesPopinLink.php +++ b/app/Fluidbook/Link/Custom/InpesPopinLink.php @@ -9,7 +9,6 @@ class InpesPopinLink extends HTMLMultimediaLink { public function getHTMLContent() { - $this->alternative = $this->to; $c = parent::getHTMLContent(); $class = $this->getClasses(); diff --git a/app/Fluidbook/Links.php b/app/Fluidbook/Links.php index 030a6d041..1c4c593f0 100644 --- a/app/Fluidbook/Links.php +++ b/app/Fluidbook/Links.php @@ -198,6 +198,7 @@ class Links { self::_correctImageSpecialLinks($links); self::_fixWebVideoServices($links); + self::_fixMultimedia($links); } protected static function _correctImageSpecialLinks(&$links) @@ -206,8 +207,8 @@ class Links if (preg_match('/^link_(.*)$/', $link['page'], $matches) && strlen($matches[1]) !== 32) { $uid = $matches[1]; foreach ($links as $l) { - if ($l['uid'] === $uid && $l['alternative']) { - $links[$k]['page'] = 'link_' . md5($l['alternative']); + if ($l['uid'] === $uid && $l['to']) { + $links[$k]['page'] = 'link_' . md5($l['to']); break; } } @@ -228,6 +229,16 @@ class Links } } + protected static function _fixMultimedia(&$links) + { + foreach ($links as $k => $link) { + if (isset($link['alternative']) && $link['alternative'] && $link['type'] == 6) { + $links[$k]['to'] = $link['alternative']; + unset($links[$k]['alternative']); + } + } + } + public static function getLinksFromExcel($xls, &$links, &$rulers) { $s = $xls->setActiveSheetIndexByName('Links'); diff --git a/app/Jobs/FluidbookCompiler.php b/app/Jobs/FluidbookCompiler.php index 880032374..851563508 100644 --- a/app/Jobs/FluidbookCompiler.php +++ b/app/Jobs/FluidbookCompiler.php @@ -2220,7 +2220,6 @@ height="0" width="0" style="display:none;visibility:hidden"> 'height' => 100, 'type' => 6, 'to' => $this->fluidbookSettings->tabsHTML5, - 'alternative' => $this->fluidbookSettings->tabsHTML5, 'image' => '', 'inline' => 1, 'interactive' => 1, @@ -2262,9 +2261,6 @@ height="0" width="0" style="display:none;visibility:hidden"> foreach ($linksCopy as $k => $linkData) { if ($this->fluidbookSettings->PDFRendererIframe === 'svg' && (($linkData['type'] == 31 && stristr($linkData['to'], '.pdf')) || ($linkData['type'] == 6 && stristr($linkData['alternative'], '.pdf')))) { - if ($linkData['type'] == 6) { - $linkData['to'] = $linkData['alternative']; - } $ofile = $this->wdir . '/' . $linkData['to']; $dfile = $this->wdir . '/' . $linkData['to'] . '.svg'; if (!file_exists($dfile) || filemtime($dfile) < filemtime($ofile)) { @@ -2272,7 +2268,7 @@ height="0" width="0" style="display:none;visibility:hidden"> `$cmd`; } $linkData['type'] = 6; - $linkData['to'] = $linkData['alternative'] = $linkData['to'] . '.svg'; + $linkData['to'] = $linkData['to'] . '.svg'; $linkData['backgroundColor'] = '#fff'; $links[$k] = $linkData; } @@ -2320,7 +2316,7 @@ height="0" width="0" style="display:none;visibility:hidden"> $dupData['animation'] = ''; $dupData['inline'] = true; $dupData['interactive'] = false; - $dupData['alternative'] = $linkData['animation']; + $dupData['to'] = $linkData['animation']; $dupData['type'] = 6; $linkData['relatedAnimation'] = $dupData['uid'] = 'a_' . $linkData['uid']; $dupData['video_width'] = $dupData['video_height'] = 0; diff --git a/app/Models/FluidbookDocument.php b/app/Models/FluidbookDocument.php index ec9d0a375..42f9acf81 100644 --- a/app/Models/FluidbookDocument.php +++ b/app/Models/FluidbookDocument.php @@ -423,7 +423,7 @@ class FluidbookDocument extends ToolboxModel public function lnCrop() { - link($this->getPDFSource('crop'), $this->getPDFSource('fixed')); + link($this->getPDFSource('fixed'), $this->getPDFSource()); } protected function isCropped() diff --git a/app/Models/FluidbookPublication.php b/app/Models/FluidbookPublication.php index 68c2b3d33..06c8045b9 100644 --- a/app/Models/FluidbookPublication.php +++ b/app/Models/FluidbookPublication.php @@ -441,15 +441,18 @@ class FluidbookPublication extends ToolboxSettingsModel continue; } - $file = $this->asset_path($link['alternative']); + if (!isset($link['to']) || !$link['to']) { + continue; + } + $file = $this->asset_path($link['to']); if (!file_exists($file)) { continue; } - $md5 = md5($link['alternative']); + $md5 = md5($link['to']); if (isset($res[$md5])) { continue; } - $res[$md5] = ['name' => $link['alternative'], 'dim' => Image::getimagesize($file), 'url' => url('/fluidbook-publication/' . $this->id . '/edit/links/assets/' . $link['alternative'])]; + $res[$md5] = ['name' => $link['to'], 'dim' => Image::getimagesize($file), 'url' => url('/fluidbook-publication/' . $this->id . '/edit/links/assets/' . $link['to'])]; } return $res; } diff --git a/app/SubForms/Link/Base.php b/app/SubForms/Link/Base.php index f6495ac2d..6c5870d05 100644 --- a/app/SubForms/Link/Base.php +++ b/app/SubForms/Link/Base.php @@ -22,6 +22,7 @@ use Cubist\Backpack\Magic\Fields\Textarea; use Cubist\Backpack\Magic\Form; use Fluidbook\Tools\Compiler\DummyCompiler; use App\Fluidbook\Link\Link; + // __('!! Editeur de liens') class Base extends Form { @@ -92,7 +93,7 @@ class Base extends Form protected static $_acceptImage = ['.jpg', '.jpeg', '.png', '.svg', '.gif']; protected static $_acceptImageAZip = ['.jpg', '.jpeg', '.png', '.svg', '.gif', '.zip']; - protected static $_acceptAnimation = ['.jpg', '.jpeg', '.png', '.svg', '.gif', '.zip', '.oam', '.html', '.json']; + protected static $_acceptAnimation = ['.jpg', '.jpeg', '.png', '.svg', '.gif', '.zip', '.oam', '.html', '.json', '.pdf']; protected static $_acceptVideo = ['.mp4']; protected static $_acceptFont = ['.otf', '.ttf']; protected static $_acceptAudiodescription = ['.mp3', '.txt']; @@ -335,7 +336,7 @@ class Base extends Form } } if ($type['type'] === 6) { - $optionsChoices['alternative'] = ['file.jpg', 'file.zip']; + $optionsChoices['to'] = ['file.jpg', 'file.zip']; } $configs[$type['type']] = $optionsChoices; @@ -351,7 +352,7 @@ class Base extends Form } $id = 1; - $base = ['top' => 1, 'left' => 1, 'width' => 1, 'height' => 1, 'to' => '-', 'inline' => 'inline', 'page' => 2, 'target' => '_blank', 'extra' => '', 'alternative' => '', 'interactive' => false]; + $base = ['top' => 1, 'left' => 1, 'width' => 1, 'height' => 1, 'to' => '', 'inline' => 'inline', 'page' => 2, 'target' => '_blank', 'extra' => '', 'interactive' => false]; $compiler = new FluidbookCompiler($fluidbook); /** @var Link $instances */ diff --git a/app/SubForms/Link/Multimedia.php b/app/SubForms/Link/Multimedia.php index 891e9c903..94724797b 100644 --- a/app/SubForms/Link/Multimedia.php +++ b/app/SubForms/Link/Multimedia.php @@ -13,7 +13,7 @@ class Multimedia extends Base public function addDestinationField() { - $this->addField('alternative', FilesOrURL::class, __('Animation'), $this->getFilesOrURLEntry() + ['accept' => self::$_acceptAnimation]); + $this->addField('to', FilesOrURL::class, __('Animation'), $this->getFilesOrURLEntry() + ['accept' => self::$_acceptAnimation]); } public function addMultimediaFields() diff --git a/resources/linkeditor/js/linkeditor.form.js b/resources/linkeditor/js/linkeditor.form.js index 8003f74c0..c3be0b692 100644 --- a/resources/linkeditor/js/linkeditor.form.js +++ b/resources/linkeditor/js/linkeditor.form.js @@ -154,6 +154,7 @@ LinkeditorForm.prototype = { if (link === undefined || link === null) { return; } + this.lastSelectedLink = link; } catch (e) { return; } diff --git a/resources/linkeditor/js/linkeditor.layers.js b/resources/linkeditor/js/linkeditor.layers.js index 3fce5ca80..bea434fe1 100644 --- a/resources/linkeditor/js/linkeditor.layers.js +++ b/resources/linkeditor/js/linkeditor.layers.js @@ -74,11 +74,16 @@ LinkeditorLayers.prototype = { }, updateSelection() { + + if (this.container === undefined || this.container.is(':hidden')) { + return; + } var $this = this; this.maskCheckEvents = true; setTimeout(function () { $this.maskCheckEvents = false; }, 100); + $('#linkeditor-links .link').each(function () { let checkbox = $this.container.find('input[name=' + $(this).attr('fb-uid') + ']'); checkbox.prop('checked', $(this).is('.selected')); diff --git a/resources/linkeditor/js/linkeditor.links.js b/resources/linkeditor/js/linkeditor.links.js index d018d33ce..405f7f8df 100644 --- a/resources/linkeditor/js/linkeditor.links.js +++ b/resources/linkeditor/js/linkeditor.links.js @@ -291,13 +291,14 @@ LinkeditorLinks.prototype = { offset.y -= top; } + this.deselectAllLinks(); $(linksInClipboard).each(function () { let data = $this._duplicateLink($(this), false); data.top += offset.y; data.left += offset.x; - $this.addLink(data); + $this.selectLink($this.addLink(data)); }); this.linkeditor.hasChanged();