]> _ Git - fluidbook-toolbox.git/commitdiff
wip #7467 @6
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 6 Jun 2025 17:07:55 +0000 (19:07 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 6 Jun 2025 17:07:55 +0000 (19:07 +0200)
app/SubForms/Link/Base.php
resources/linkeditor-stable/js/linkeditor.accessibility.js
resources/linkeditor-stable/js/linkeditor.links.js

index 2e1e115b6b289d08301a5ca20d052862bb475e0f..e44671f9ff55177de7bdef8b020ca544fad558fd 100644 (file)
@@ -17,6 +17,7 @@ use Cubist\Backpack\Magic\Fields\FieldGroupStart;
 use Cubist\Backpack\Magic\Fields\FilesOrURL;
 use Cubist\Backpack\Magic\Fields\FormSection;
 use Cubist\Backpack\Magic\Fields\Hidden;
+use Cubist\Backpack\Magic\Fields\HiddenVisible;
 use Cubist\Backpack\Magic\Fields\Number;
 use Cubist\Backpack\Magic\Fields\SelectFromArray;
 use Cubist\Backpack\Magic\Fields\Text;
@@ -291,6 +292,7 @@ class Base extends Form
         }
         $this->addField('header_extra', FormSection::class, __('Autres paramètres'));
         $this->addField('extra', Textarea::class, '');
+        $this->addField('order', HiddenVisible::class, __('Ordre'));
         $attrs = $this->_getHTMLAttributes();
         if ($attrs) {
             $this->addField('header_html_attributes', FormSection::class, __('Attributs HTML'));
@@ -298,6 +300,7 @@ class Base extends Form
                 $this->addField('html_' . $attr, Text::class, $attr);
             }
         }
+
     }
 
     public function addStatsFields()
index 16ec258f513d79f54cd8d897dfde679801cdb19e..e8f8ad5c71d4ceffdb81e7a6d1ea7938bd7c191a 100644 (file)
@@ -109,7 +109,9 @@ LinkeditorAccessibility.prototype = {
         $(links).each(function (k, v) {
             $(v.link).attr('fb-order', i++);
         });
+
         if (refresh) {
+            this.linkeditor.links.updateLinksData(links, ['order']);
             this.linkeditor.hasChanged();
         }
         this.linkeditor.links.pageMaxOrderIndex = i;
@@ -158,6 +160,7 @@ LinkeditorAccessibility.prototype = {
                 order: parseInt($(this).attr('fb-order')),
             });
         });
+
         accessibility.sort(function (a, b) {
             if (a.interactive === b.interactive) {
                 return a.order - b.order
index 19fead76f71c45340befc7134d3872f6edd4fcc2..dbcd0bd618202ab748d6624925251c05ccc555ae 100644 (file)
@@ -211,8 +211,7 @@ LinkeditorLinks.prototype = {
             events: {
                 show: function (e) {
                     $this.contextMenuPosition = {x: $this.linkeditor.mx, y: $this.linkeditor.my};
-                },
-                preShow: function (e) {
+                }, preShow: function (e) {
                     console.log(e);
                     if ($(e).is('.link:not(.selected)')) {
                         $this.deselectAllLinks();
@@ -1221,18 +1220,35 @@ LinkeditorLinks.prototype = {
         this.updatePolygonLinks(false);
     },
 
-    updateSelectionData: function (props) {
-        this.getCurrentSelection().each(function () {
-            let uid = $(this).attr('fb-uid');
+    updateLinksData: function (links, props) {
+        $(links).each(function () {
+            let l;
+            let uid;
+            if (this.link !== undefined) {
+                uid = $(this.link).attr('fb-uid');
+                l = this.link;
+            } else {
+                uid = $(this).attr('fb-uid');
+                l = this;
+            }
+            console.log(uid, props);
             for (let i = 0; i < props.length; i++) {
                 let prop = props[i];
-                LINKS[uid][prop] = $(this).attr('fb-' + prop);
+                LINKS[uid][prop] = $(l).attr('fb-' + prop);
             }
         });
         this.linkeditor.rulers.updateMagnetValues();
         this.updatePanels();
     },
 
+    updateSelectionData: function (props) {
+        this.updateLinksData(this.getCurrentSelection(), props);
+    },
+
+    updatePageData: function (props) {
+        this.updateLinksData(this.getLinksOfCurrentPage(), props);
+    },
+
     distributeSelection: function (axis) {
         let d = this.getMinMaxSelection(axis);
         let totalLength = d.max - d.min;