From 1a2acbc1e7c720983415fa2e284bc0b773ea6aad Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Fri, 18 Jul 2025 16:56:40 +0200 Subject: [PATCH] wip #7650 --- app/Fluidbook/Compiler/Links.php | 4 ++-- app/Fluidbook/Link/Custom/InpesPopinLink.php | 2 +- app/Fluidbook/Link/LinksData.php | 6 +++--- app/SubForms/Link/Base.php | 8 +++++++- app/SubForms/Link/Tooltip.php | 3 ++- package.json | 2 +- resources/linkeditor-stable/js/linkeditor.form.js | 10 +++++++++- resources/linkeditor/js/linkeditor.form.js | 2 +- 8 files changed, 26 insertions(+), 11 deletions(-) diff --git a/app/Fluidbook/Compiler/Links.php b/app/Fluidbook/Compiler/Links.php index 7c4b6b045..b3cf91c02 100644 --- a/app/Fluidbook/Compiler/Links.php +++ b/app/Fluidbook/Compiler/Links.php @@ -80,7 +80,7 @@ trait Links } if ($init['type'] == Link::CUSTOM) { $init['image'] = ''; - $init['display_area'] = false; + $init['display_area'] = 'none'; $links[$k] = $init; } } @@ -336,7 +336,7 @@ trait Links $linksToAdd[] = $link->getRightClone(); } - if ($dupLinkAreaColor !== false && $link instanceof NormalLink && $link->display_area && !$link->isOutsidePage()) { + if ($dupLinkAreaColor !== false && $link instanceof NormalLink && $link->display_area!=='none' && !$link->isOutsidePage()) { $linksToAdd[] = $link->getDisplayAreaLink($dupLinkAreaColor, $dupLinkAreaOpacity, $dupLinkAreaDuration, $link->blinkdelay ? $link->blinkdelay / 1000 : 0.5); } diff --git a/app/Fluidbook/Link/Custom/InpesPopinLink.php b/app/Fluidbook/Link/Custom/InpesPopinLink.php index b7077f70a..dfddaaba0 100644 --- a/app/Fluidbook/Link/Custom/InpesPopinLink.php +++ b/app/Fluidbook/Link/Custom/InpesPopinLink.php @@ -12,7 +12,7 @@ class InpesPopinLink extends HTMLMultimediaLink $c = parent::getHTMLContent(); $class = $this->getClasses(); - if ($this->display_area) { + if ($this->display_area!=="none") { $class[] = 'displayArea'; } $c = ''; diff --git a/app/Fluidbook/Link/LinksData.php b/app/Fluidbook/Link/LinksData.php index 6a91c62a7..95ca34a37 100644 --- a/app/Fluidbook/Link/LinksData.php +++ b/app/Fluidbook/Link/LinksData.php @@ -458,7 +458,7 @@ class LinksData $j++; } if ($link['display_area'] == '' || !$link['display_area']) { - $link['display_area'] = '0'; + $link['display_area'] = 'none'; } if (isset($link['infobulle'])) { $link['tooltip'] = $link['infobulle']; @@ -533,7 +533,7 @@ class LinksData 'page' => $page, 'left' => $left, 'top' => $top, 'width' => $width, 'height' => $height, 'rot' => '', 'type' => $type, 'to' => $to, 'target' => $target, - 'tooltip' => '', 'numerotation' => $numerotation, 'display_area' => '1'); + 'tooltip' => '', 'numerotation' => $numerotation, 'display_area' => 'fill'); } self::_fixLinks($links); @@ -745,7 +745,7 @@ class LinksData $link['to'] = $webvideo['id']; } - $link['display_area'] = '1'; + $link['display_area'] = 'fill'; $link['page'] = $page; $link['uid'] = self::generateUID(); $links[] = $link; diff --git a/app/SubForms/Link/Base.php b/app/SubForms/Link/Base.php index e695e5d30..0c759fd25 100644 --- a/app/SubForms/Link/Base.php +++ b/app/SubForms/Link/Base.php @@ -189,7 +189,13 @@ class Base extends Form } $this->addField('header_tooltip', FormSection::class, __('Infobulle')); $this->addField('tooltip', Text::class, __('Texte de l\'infobulle'), ['hint' => __('Laisser vide pour conserver le texte par défaut') . '.
' . __('Taper un tiret (-) pour ne pas afficher d\'infobulle')]); - $this->addField('display_area', CheckboxBasic::class, __('Afficher la zone de couleur au survol'), ['default' => true]); + $this->addAreaFields(); + } + + public function addAreaFields() + { + $this->addField('header_zone', FormSection::class, __('Zone')); + $this->addField('display_area', SelectFromArray::class, __('Afficher la zone de couleur au survol'), ['ajax' => false, 'options' => ['fill' => __('Oui'), 'stroke' => __('Uniquement le contour'), 'none' => __('Non')], 'default' => '1']); $this->addField('animation_type', SelectFromArray::class, __('Animation à l\'affichage de la page'), ['ajax' => false, 'options' => array_merge(['default' => __('Animation par défaut'), 'none' => __('Pas d\'animation')], FluidbookTheme::getLinksAnimationTypes()), 'default' => 'default']); } diff --git a/app/SubForms/Link/Tooltip.php b/app/SubForms/Link/Tooltip.php index dbd7e3872..d3808231d 100644 --- a/app/SubForms/Link/Tooltip.php +++ b/app/SubForms/Link/Tooltip.php @@ -5,6 +5,7 @@ namespace App\SubForms\Link; use App\Fluidbook\Link\Link; use Cubist\Backpack\Magic\Fields\CheckboxBasic; use Cubist\Backpack\Magic\Fields\FormSection; +use Cubist\Backpack\Magic\Fields\SelectFromArray; use Cubist\Backpack\Magic\Fields\Textarea; // __('!! Editeur de liens') @@ -27,6 +28,6 @@ class Tooltip extends Base } $this->addField('header_tooltip', FormSection::class, __('Paramètres')); $this->addField('tooltip', Textarea::class, __('Texte de l\'infobulle')); - $this->addField('display_area', CheckboxBasic::class, __('Afficher la zone de couleur au survol'), ['default' => true]); + $this->addAreaFields(); } } diff --git a/package.json b/package.json index 3ac00ed3f..c2e7f2153 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "linkeditor-beta": "cross-env process.env.section=linkeditor mix --production" }, "devDependencies": { - "axios": "^1.3.5", + "axios": "^1.8.4", "cross-env": "^7.0.3", "gsap": "npm:@gsap/business@^3.12.3", "jquery": "^3.6.4", diff --git a/resources/linkeditor-stable/js/linkeditor.form.js b/resources/linkeditor-stable/js/linkeditor.form.js index 71de8a470..9cd5d10a7 100644 --- a/resources/linkeditor-stable/js/linkeditor.form.js +++ b/resources/linkeditor-stable/js/linkeditor.form.js @@ -194,7 +194,7 @@ LinkeditorForm.prototype = { value = ''; } var number = ['top', 'left', 'width', 'height', 'rot', 'x', 'y', 'h', 'w']; - var bool = ['display_area']; + var bool = []; var integers = ['zindex']; if (k === 'zindex' && (value === undefined || value === null || value === '')) { value = -1; @@ -216,6 +216,14 @@ LinkeditorForm.prototype = { value = (value === true || value === 'true' || value === "1" || value === 1) ? '1' : '0'; } + if (k === 'display_area') { + if (value === undefined || value === null || value == "1" || value == 'true') { + value = 'fill'; + } else if (value == 'false' || value == '0') { + value = 'none'; + } + } + value = value.toString() value = value.replace(new RegExp("\r\n", 'g'), "\n"); value = value.replace(new RegExp("\r", 'g'), "\n"); diff --git a/resources/linkeditor/js/linkeditor.form.js b/resources/linkeditor/js/linkeditor.form.js index 88782a380..d06d3dc87 100644 --- a/resources/linkeditor/js/linkeditor.form.js +++ b/resources/linkeditor/js/linkeditor.form.js @@ -189,7 +189,7 @@ LinkeditorForm.prototype = { value = ''; } var number = ['top', 'left', 'width', 'height', 'rot', 'x', 'y', 'h', 'w']; - var bool = ['display_area']; + var bool = []; var integers = ['zindex']; if (k === 'zindex' && (value === undefined || value === null || value === '')) { value = -1; -- 2.39.5