From: soufiane Date: Tue, 2 Apr 2024 15:32:05 +0000 (+0200) Subject: wait #6789 @5:30 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=944a34fc18fa749788645aea3dcbec303442a4f3;p=fluidbook-toolbox.git wait #6789 @5:30 --- diff --git a/resources/linkeditor/js/linkeditor.links.js b/resources/linkeditor/js/linkeditor.links.js index 4485fd1d5..a3667bb7e 100644 --- a/resources/linkeditor/js/linkeditor.links.js +++ b/resources/linkeditor/js/linkeditor.links.js @@ -903,7 +903,6 @@ LinkeditorLinks.prototype = { addLink: function (link, triggerChange) { - console.log('new') if (triggerChange === undefined) { triggerChange = true; } @@ -1148,7 +1147,6 @@ LinkeditorLinks.prototype = { }, updateLinkData: function (id, data, updateHTML) { - console.log('is updating') if (LINKS[id] === undefined) { console.warn('Link ' + id + ' not found'); return; @@ -1584,10 +1582,19 @@ LinkeditorLinks.prototype = { }, updatePreview: function(link) { + console.log(link) if($("#preview-links").hasClass("active")) { let linkData = link let l = this.getLinkById(link.uid) + let absoluteCss = { + width: "100%", + height: "100%", + top: 0, + left: 0, + position: "absolute", + } + if ($('[data-id-preview="' + link.uid + '"]').length < 1) { l.html("
") } @@ -1630,6 +1637,41 @@ LinkeditorLinks.prototype = { }) this.updateFontSize(link) } + + if (linkData.type === '10') { + let paramIframe = 'accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share;' + let html = "
" + + let iframeUrl = () => { + if(linkData.video_service === 'youtube') { + return "https://www.youtube.com/embed/" + linkData.to + "?controls=" + linkData.video_controls + "&modestbranding=1&rel=0&showinfo=" + linkData.video_controls + "&loop=" + linkData.video_loop + "&muted="+linkData.video_sound_on+"&fs=0&hl&playsinline=true&enablejsapi=1"; + }else if(linkData.video_service === 'dailymotion') { + return 'https://www.dailymotion.com/embed/video/' + linkData.to; + }else if(linkData.video_service === 'dailymotion') { + return 'https://player.vimeo.com/video/' + linkData.to + '?autoplay=' + linkData.video_auto_start + '&loop=' + linkData.video_loop + '&muted=' + linkData.video_sound_on; + } + } + + let iframe = "" + if(linkData.video_auto_start === '1' && linkData.video_service === 'youtube') { + paramIframe += ' autoplay;' + } + + $("[data-id-preview=" + linkData.uid + "]").css("position","relative").append(html) + $("#video_" + linkData.uid+ " div").css("background", linkData.extra).html(iframe) + $("#video_" + linkData.uid+ " iframe").css(absoluteCss).attr("allow", paramIframe) + } + + if (linkData.type === '4') { + let url = "/fluidbook-publication/" + FLUIDBOOK_DATA.id + "/edit/links/assets/" + linkData.to + let html = "" + $("[data-id-preview=" + linkData.uid + "]").css("position","relative").html(html) + $("[data-id-preview=" + linkData.uid + "]").find("video").css({...absoluteCss, ...{'object-fit': 'fill'} }) + } + + if(linkData.type === '10' || linkData.type === '4') { + $("[data-id-preview=" + linkData.uid + "]").css("transform","rotate("+linkData.rot+"deg)") + } } }, @@ -1645,7 +1687,7 @@ LinkeditorLinks.prototype = { var pw = FLUIDBOOK_DATA.settings.width; var ph = FLUIDBOOK_DATA.settings.height; - var fs = link.height * (1 * Math.min((567 / pw), (709 / ph))); + var fs = link.height * (1 * Math.min(( 567 / pw), (709 / ph))); try { $("[data-id-preview=" + link.uid + "]").text(link.to).css({ @@ -1659,9 +1701,10 @@ LinkeditorLinks.prototype = { updateFontSize: function(link) { let zoom = this.linkeditor.zoom.zoom + $("[data-id-preview="+link.uid+"]").css({ transform: "scale("+zoom+")", - 'transform-origin': 'left top' + 'transform-origin': "0 0 0" }) }, diff --git a/resources/linkeditor/js/linkeditor.resize.js b/resources/linkeditor/js/linkeditor.resize.js index 78912165a..e036da80c 100644 --- a/resources/linkeditor/js/linkeditor.resize.js +++ b/resources/linkeditor/js/linkeditor.resize.js @@ -29,7 +29,6 @@ LinkeditorResize.prototype = { } else { $("#linkeditor").addClass('double').removeClass('single'); } - this.resizePages(); this.updateWindowDimensions(); this.resizeMain();