PHP Classes

File: engine/modules/core/wysiwyg/froala/plugins/line_breaker.min.js

Recommend this page to a friend!
  Classes of Aldo Tripiciano   Quanta CMS   engine/modules/core/wysiwyg/froala/plugins/line_breaker.min.js   Download  
File: engine/modules/core/wysiwyg/froala/plugins/line_breaker.min.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Quanta CMS
Manage content that works without a database
Author: By
Last change:
Date: 5 years ago
Size: 4,781 bytes
 

Contents

Class file image Download
/*! * froala_editor v2.3.5 (https://www.froala.com/wysiwyg-editor) * License https://froala.com/wysiwyg-editor/terms/ * Copyright 2014-2016 Froala Labs */ !function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof module&&module.exports?module.exports=function(b,c){return void 0===c&&(c="undefined"!=typeof window?require("jquery"):require("jquery")(b)),a(c),c}:a(jQuery)}(function(a){a.extend(a.FE.DEFAULTS,{lineBreakerTags:["table","hr","form","dl","span.fr-video"],lineBreakerOffset:15}),a.FE.PLUGINS.lineBreaker=function(b){function c(c,d){var e,f,g,h,i,j,k,l;if(null==c)h=d.parent(),i=h.offset().top,k=d.offset().top,e=k-Math.min((k-i)/2,b.opts.lineBreakerOffset),g=h.outerWidth(),f=h.offset().left;else if(null==d)h=c.parent(),j=h.offset().top+h.outerHeight(),l=c.offset().top+c.outerHeight(),e=l+Math.min((j-l)/2,b.opts.lineBreakerOffset),g=h.outerWidth(),f=h.offset().left;else{h=c.parent();var m=c.offset().top+c.height(),o=d.offset().top;if(m>o)return!1;e=(m+o)/2,g=h.outerWidth(),f=h.offset().left}b.opts.iframe&&(f+=b.$iframe.offset().left-a(b.o_win).scrollLeft(),e+=b.$iframe.offset().top-a(b.o_win).scrollTop()),b.$box.append(n),n.css("top",e-b.win.pageYOffset),n.css("left",f-b.win.pageXOffset),n.css("width",g),n.data("tag1",c),n.data("tag2",d),n.addClass("fr-visible").data("instance",b)}function d(a,d){var f,g,h=a.offset().top,i=a.offset().top+a.outerHeight();if(Math.abs(i-d)<=b.opts.lineBreakerOffset||Math.abs(d-h)<=b.opts.lineBreakerOffset)if(Math.abs(i-d)<Math.abs(d-h)){g=a.get(0);for(var j=g.nextSibling;j&&j.nodeType==Node.TEXT_NODE&&0===j.textContent.length;)j=j.nextSibling;if(!j)return c(a,null),!0;if(f=e(j))return c(a,f),!0}else{if(g=a.get(0),!g.previousSibling)return c(null,a),!0;if(f=e(g.previousSibling))return c(f,a),!0}n.removeClass("fr-visible").removeData("instance")}function e(c){if(c){var d=a(c);if(0===b.$el.find(d).length)return null;if(c.nodeType!=Node.TEXT_NODE&&d.is(b.opts.lineBreakerTags.join(",")))return d;if(d.parents(b.opts.lineBreakerTags.join(",")).length>0)return c=d.parents(b.opts.lineBreakerTags.join(",")).get(0),a(c)}return null}function f(c){p=null;var f,g,h,i=null,j=b.doc.elementFromPoint(c.pageX-b.win.pageXOffset,c.pageY-b.win.pageYOffset);if(j&&("HTML"==j.tagName||"BODY"==j.tagName||b.node.isElement(j)))for(f=1;f<=b.opts.lineBreakerOffset;f++){if(g=b.doc.elementFromPoint(c.pageX-b.win.pageXOffset,c.pageY-b.win.pageYOffset-f),g&&!b.node.isElement(g)&&g!=b.$wp.get(0)&&a(g).parents(b.$wp).length){i=e(g);break}if(h=b.doc.elementFromPoint(c.pageX-b.win.pageXOffset,c.pageY-b.win.pageYOffset+f),h&&!b.node.isElement(h)&&h!=b.$wp.get(0)&&a(h).parents(b.$wp).length){i=e(h);break}}else i=e(j);i?d(i,c.pageY):b.core.sameInstance(n)&&n.removeClass("fr-visible").removeData("instance")}function g(a){return n.hasClass("fr-visible")&&!b.core.sameInstance(n)?!1:b.popups.areVisible()||b.$el.get(0).querySelectorAll(".fr-selected-cell").length?(n.removeClass("fr-visible"),!0):void(o===!1&&(p&&clearTimeout(p),p=setTimeout(f,30,a)))}function h(){p&&clearTimeout(p),n.hasClass("fr-visible")&&n.removeClass("fr-visible").removeData("instance")}function i(){o=!0,h()}function j(){o=!1}function k(c){if(!b.core.sameInstance(n))return!0;c.preventDefault(),n.removeClass("fr-visible").removeData("instance");var d=n.data("tag1"),e=n.data("tag2"),f=b.html.defaultTag();null==d?f&&"TD"!=e.parent().get(0).tagName?e.before("<"+f+">"+a.FE.MARKERS+"<br></"+f+">"):e.before(a.FE.MARKERS+"<br>"):f&&"TD"!=d.parent().get(0).tagName&&0===d.parents(f).length?d.after("<"+f+">"+a.FE.MARKERS+"<br></"+f+">"):d.after(a.FE.MARKERS+"<br>"),b.selection.restore()}function l(){b.shared.$line_breaker||(b.shared.$line_breaker=a('<div class="fr-line-breaker"><a class="fr-floating-btn" role="button" tabindex="-1" title="'+b.language.translate("Break")+'"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><rect x="21" y="11" width="2" height="8"/><rect x="14" y="17" width="7" height="2"/><path d="M14.000,14.000 L14.000,22.013 L9.000,18.031 L14.000,14.000 Z"/></svg></a></div>')),n=b.shared.$line_breaker,b.events.on("shared.destroy",function(){n.html("").removeData().remove(),n=null},!0),b.events.on("destroy",function(){n.removeData("instance").removeClass("fr-visible").appendTo("body"),clearTimeout(p)},!0),b.events.$on(n,"mouseleave",h,!0),b.events.$on(n,"mousemove",function(a){a.stopPropagation()},!0),b.events.$on(n,"mousedown","a",function(a){a.stopPropagation()},!0),b.events.$on(n,"click","a",k,!0)}function m(){return b.$wp?(l(),o=!1,b.events.$on(b.$win,"mousemove",g),b.events.$on(a(b.win),"scroll",h),b.events.on("popups.show.table.edit",h),b.events.on("commands.after",h),b.events.$on(a(b.win),"mousedown",i),void b.events.$on(a(b.win),"mouseup",j)):!1}var n,o,p;return{_init:m}}});