]> _ Git - fluidbook-toolbox.git/commitdiff
wait #6787 @1:30
authorsoufiane <soufiane@cubedesigners.com>
Tue, 19 Mar 2024 11:00:57 +0000 (12:00 +0100)
committersoufiane <soufiane@cubedesigners.com>
Tue, 19 Mar 2024 11:00:57 +0000 (12:00 +0100)
resources/linkeditor/js/linkeditor.links.js

index 0b4ece134b8c5c0babde62067cc9021412c74acb..0bbb9519350a8cebf5da8215688419948cbd10ff 100644 (file)
@@ -1566,10 +1566,15 @@ LinkeditorLinks.prototype = {
                 l = this.getLinkById(linkData.uid),
                 gsapConfig = this.convertAnimationStringToObject(linkData.image_rollover)
 
+            l.html("<div data-id-preview='"+linkData.uid+"'></div>")
+
+            $("[data-id-preview="+linkData.uid+"]").css({
+                height: '100%',
+                width: '100%'
+            })
+
             if(linkData.type === '14') {
-                l.html("<div data-id-preview='"+linkData.uid+"'></div>")
                 $("[data-id-preview="+linkData.uid+"]").css({
-                    height: '100%',
                     backgroundColor: linkData.to,
                     'z-index': 99
                 })
@@ -1577,6 +1582,18 @@ LinkeditorLinks.prototype = {
                 /*gsapConfig.forEach(function(conf) {
                     gsap.to($("[data-id-preview="+linkData.uid+"]"),conf)
                 })*/
+            } else if(linkData.type === '15') {
+                let imgUrl = ASSETS['uid_'+linkData.uid]['url']
+                let img = "<img src='"+imgUrl+"' />"
+                $("[data-id-preview="+linkData.uid+"]").append(img)
+
+                $("[data-id-preview="+linkData.uid+"] img").css({
+                    height: '100%',
+                    width: '100%',
+                    display: 'block',
+                    'background-size': '100% 100%',
+                    'background-position': '0 0',
+                })
             }
         }
     },
@@ -1589,19 +1606,21 @@ LinkeditorLinks.prototype = {
         let anims = anim.split('---')
         let o = []
 
-        anims.forEach(function(anim_){
-            let arr = anim_.split('\n')
-            let o_ = {}
-            arr.forEach(function(pair) {
-                let parts = pair.split("=");
-                if(parts[0].length > 0 && parts[1].length > 0) {
-                    let k = parts[0];
-                    let v = parts[1];
-                    o_[k] = v;
-                }
+        if(anim !== "" && anim !== "none") {
+            anims.forEach(function (anim_) {
+                let arr = anim_.split('\n')
+                let o_ = {}
+                arr.forEach(function (pair) {
+                    let parts = pair.split("=");
+                    if (parts[0].length > 0 && parts[1].length > 0) {
+                        let k = parts[0];
+                        let v = parts[1];
+                        o_[k] = v;
+                    }
+                })
+                o.push(o_)
             })
-            o.push(o_)
-        })
+        }
 
         return o
     },