From: soufiane Date: Mon, 18 Mar 2024 17:30:08 +0000 (+0100) Subject: wait #6786 @7:00 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=e59b9a980f55c6b19909eb85b95acfea250d2f99;p=fluidbook-toolbox.git wait #6786 @7:00 --- diff --git a/resources/linkeditor/js/linkeditor.js b/resources/linkeditor/js/linkeditor.js index ca85b81cc..8df7c79ea 100644 --- a/resources/linkeditor/js/linkeditor.js +++ b/resources/linkeditor/js/linkeditor.js @@ -60,6 +60,7 @@ require('select2'); import 'select2/dist/css/select2.css'; import 'select2-bootstrap-theme/dist/select2-bootstrap.css'; import * as noty from "noty"; +import LinkeditorPreviewLinks from "./linkeditor.previewLinks"; window.MD5 = require("crypto-js/md5"); @@ -118,6 +119,7 @@ LinkEditor.prototype = { this.popup = new LinkeditorPopup(this); this.undo = new LinkeditorUndo(this); this.accessControl = new LinkeditorAccessControl(this); + this.previewLinks = new LinkeditorPreviewLinks(this); this.initEvents(); this.initIcons(); @@ -308,6 +310,7 @@ LinkEditor.prototype = { po = o; o = o[a[i]]; } + try { return o.apply(po, args); } catch (e) { diff --git a/resources/linkeditor/js/linkeditor.links.js b/resources/linkeditor/js/linkeditor.links.js index 524023e06..83227a3ee 100644 --- a/resources/linkeditor/js/linkeditor.links.js +++ b/resources/linkeditor/js/linkeditor.links.js @@ -1,4 +1,5 @@ import LinkeditorLinksLock from './linkeditor.links.lock'; +import gsap from "gsap"; var LinkeditorLinks = function (linkeditor) { this.linkeditor = linkeditor; @@ -146,6 +147,10 @@ LinkeditorLinks.prototype = { return false; } }); + this.key('ctrl+y', function () { + $this.preview(); + return false; + }); var commonDragAndDropEvent = function (e) { e.originalEvent.dataTransfer.dropEffect = "copy"; @@ -1543,6 +1548,64 @@ LinkeditorLinks.prototype = { this.linkeditor.updateFBElements(false); this.linkeditor.save.hasChanged(); }, + + preview: function() { + $("#linkeditor-fluidbook").toggleClass('white-overlay'); + let el = $("[data-action='links.preview']") + el.toggleClass("active") + if(el.hasClass("active")) { + this.setPreview() + } else { + this.clearPreview() + } + }, + + setPreview: function(p) { + const links = this.getLinksOfPage(1) + for(let link in links) { + let linkData = links[link], + l = this.getLinkById(linkData.uid), + gsapConfig = this.convertAnimationStringToObject(linkData.image_rollover) + + if(linkData.type === '14') { + l.html("
") + $("[data-id-preview="+linkData.uid+"]").css({ + height: '100%', + backgroundColor: linkData.to, + 'z-index': 99 + }) + + /*gsapConfig.forEach(function(conf) { + gsap.to($("[data-id-preview="+linkData.uid+"]"),conf) + })*/ + } + } + }, + + clearPreview: function() { + $("[data-id-preview]").remove() + }, + + convertAnimationStringToObject: function(anim) { + 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; + } + }) + o.push(o_) + }) + + return o + }, }; export default LinkeditorLinks; diff --git a/resources/linkeditor/js/linkeditor.previewLinks.js b/resources/linkeditor/js/linkeditor.previewLinks.js new file mode 100644 index 000000000..d06fa0ab5 --- /dev/null +++ b/resources/linkeditor/js/linkeditor.previewLinks.js @@ -0,0 +1,13 @@ +function LinkeditorPreviewLinks(linkeditor) { + this.linkeditor = linkeditor; + this.init() +} + +LinkeditorPreviewLinks.prototype = { + init: function () { + let links = this.linkeditor.links.getLinksOfPage(1); + console.log("links",links) + } +} + +export default LinkeditorPreviewLinks; diff --git a/resources/views/fluidbook_publication/link_editor.blade.php b/resources/views/fluidbook_publication/link_editor.blade.php index 42ca86cf6..369e7357a 100644 --- a/resources/views/fluidbook_publication/link_editor.blade.php +++ b/resources/views/fluidbook_publication/link_editor.blade.php @@ -308,10 +308,10 @@ @endif + -