]> _ Git - fluidbook-toolbox.git/commitdiff
wip #6961 @4:00
authorsoufiane <soufiane@cubedesigners.com>
Wed, 7 Aug 2024 13:56:26 +0000 (15:56 +0200)
committersoufiane <soufiane@cubedesigners.com>
Wed, 7 Aug 2024 13:56:26 +0000 (15:56 +0200)
resources/linkeditor/js/linkeditor.links.js
resources/linkeditor/js/linkeditor.panels.js
resources/linkeditor/style/inc/_form.sass
resources/linkeditor/style/inc/_links.sass

index c0ca33cd1d9e80cec8c281f1db573ba1b53b9756..ff1c6c9444d7bbb2ea61c174e22f0af2ba558af8 100644 (file)
@@ -1567,15 +1567,9 @@ LinkeditorLinks.prototype = {
     },
 
     animation: function() {
-        let el = $("[data-action^='links.']")
-        el.addClass("active")
-        if(el.hasClass("active")) {
-            this.setPreview()
-            this.setAnim()
-        } else {
-            this.clearPreview()
-            el.removeClass("active")
-        }
+        $("[data-action='links.preview']").addClass("active")
+        this.setPreview()
+        this.setAnim()
     },
 
     loadFontSize: function() {
@@ -1633,7 +1627,10 @@ LinkeditorLinks.prototype = {
                     'z-index': 99
                 })
             } else if (linkData.type === '15' || /\.(jpg|png|svg|webp|avif)$/.exec(linkData.image)) {
-                let imgUrl = linkData.type === '15' ? ASSETS['uid_' + linkData.uid]['url'] : "/fluidbook-publication/" + FLUIDBOOK_DATA.id + "/edit/links/assets/" + linkData.image
+                let imgUrl = "/fluidbook-publication/" + FLUIDBOOK_DATA.id + "/edit/links/assets/" + linkData.image
+                if(ASSETS['uid_' + linkData.uid]['url'] !== undefined && linkData.type === '15') {
+                    imgUrl = ASSETS['uid_' + linkData.uid]['url']
+                }
                 imgUrl = imgUrl + (imgUrl.includes('.svg') ? "#svgView(preserveAspectRatio(none))" : '')
                 let img = "<img src='" + imgUrl + "' />"
                 $("[data-id-preview=" + linkData.uid + "]").html(img)
@@ -1648,7 +1645,7 @@ LinkeditorLinks.prototype = {
             } else if (linkData.type === '35') {
                 var hash = 'fb_' + window.MD5(linkData.image).toString().substring(0, 10)
                 this.setFontSize(linkData)
-                $("[data-id-preview=" + linkData.uid + "]").text(linkData.to).css({
+                $("[data-id-preview=" + linkData.uid + "]").addClass("link-text").text(linkData.to).css({
                     'height': 'auto',
                     'width': 'max-content',
                     'font-family': hash,
@@ -1751,20 +1748,25 @@ LinkeditorLinks.prototype = {
 
         for(let link in links) {
             if(!isActive) {
-                console.log('ok 2')
                 this.updatePreview(links[link], zooming)
             }
         }
     },
 
-    setAnim: function() {
-        const links = this.getLinksOfPage(this.linkeditor.currentPage)
+    setAnim: function(all = true) {
+        const links = all ? this.getLinksOfPage(this.linkeditor.currentPage) : [this.getLinksOfPage(this.linkeditor.currentPage)[this.getCurrentSelection().attr('fb-uid')]]
 
         for(let link in links) {
             let animationText = $("[fb-uid=" + links[link].uid + "]").attr("fb-image_rollover")
             let animations = this.resolveAnimation(animationText)
+            let previewDiv = $("[data-id-preview=" + links[link].uid + "]")
+            let el = previewDiv.get(0)
+
+            if(links[link].type === '15' || /\.(jpg|png|svg|webp|avif)$/.exec(links[link].image)) {
+                el = previewDiv.children().get(0)
+            }
 
-            this.linkeditor.linksAnimations.executeAnimations($("[data-id-preview=" + links[link].uid + "]").children().get(0), animations)
+            this.linkeditor.linksAnimations.executeAnimations(el, animations)
         }
     },
 
index 1fc92329337de98b6bad9f56361c0bf5431ea75d..cc0e272b656563756c87d1c4e494a934fd41fb2a 100644 (file)
@@ -38,7 +38,7 @@ LinkeditorPanels.prototype = {
             }
         });
 
-        $("[data-name=image_rollover]").append("<button id='linkeditor-start-animation'>Lancer l'animation</button>")
+        $("[data-name=image_rollover] label").append("<button id='linkeditor-start-animation'><svg viewBox=\"0 0 24 24\" aria-hidden=\"true\"><use xlink:href=\"#linkeditor-start-animation\"></use></svg></button>")
 
         this.linkeditor.layers.init();
 
index 2935ac18ef21341f5885038532c535ecbed56c19..3cfe375c4cc9df5143e529c1b1452b223d2cb181 100644 (file)
@@ -276,5 +276,21 @@ button
 .select2-container--bootstrap .select2-results > .select2-results__options
     max-height: 350px !important
 
+
+[data-name='image_rollover'] label
+    display: flex !important
+    align-items: end
+    justify-content: space-between
+
 #linkeditor-start-animation
-    display: block
+    display: flex
+    width: 26px
+    height: 26px
+    background: transparent
+    padding: 4px 4px
+    border: 0
+    &:hover
+        background-color: #000
+    svg
+        width: 100%
+        fill: transparent
index fdea3355167776f76bceaaaa6fa477540aad80d0..5a7b7610e16aa11784a226ae7c5689969e84f4db 100644 (file)
@@ -20,7 +20,7 @@
         .canvas .texts
             z-index: 2
 
-        [data-id-preview]
+        [data-id-preview]:not(.link-text)
             overflow: hidden
 
         #linkeditor-main.dropfile &.dropfile