forked from extern/egroupware
1 line
15 KiB
JavaScript
1 line
15 KiB
JavaScript
|
!function(){"use strict";var n,t,e,r,o,i=tinymce.util.Tools.resolve("tinymce.PluginManager"),u=tinymce.util.Tools.resolve("tinymce.util.VK"),a=function(n){return n.target_list},c=function(n){return n.rel_list},l=function(n){return n.link_class_list},h=function(n){return"boolean"==typeof n.link_assume_external_targets&&n.link_assume_external_targets},f=function(n){return n.link_list},p=function(n){return"string"==typeof n.default_link_target},v=function(n){return n.default_link_target},s=a,g=function(n){return!1!==a(n)},d=c,m=function(n){return c(n)!==undefined},y=l,x=function(n){return l(n)!==undefined},k=function(n){return!1!==n.link_title},b=function(n){return"boolean"==typeof n.allow_unsafe_link_target&&n.allow_unsafe_link_target},O=function(n){return!0===n.link_quicklink},w=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),_=tinymce.util.Tools.resolve("tinymce.Env"),A=function(n){if(!_.ie||10<_.ie){var t=document.createElement("a");t.target="_blank",t.href=n,t.rel="noreferrer noopener";var e=document.createEvent("MouseEvents");e.initMouseEvent("click",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),i=t,u=e,document.body.appendChild(i),i.dispatchEvent(u),document.body.removeChild(i)}else{var r=window.open("","_blank");if(r){r.opener=null;var o=r.document;o.open(),o.write('<meta http-equiv="refresh" content="0; url='+w.DOM.encode(n)+'">'),o.close()}}var i,u},T=tinymce.util.Tools.resolve("tinymce.util.Tools"),C=function(n,t){var e,r,o=["noopener"],i=n?n.split(/\s+/):[],u=function(n){return n.filter(function(n){return-1===T.inArray(o,n)})};return(i=t?(e=u(e=i)).length?e.concat(o):o:u(i)).length?(r=i,T.trim(r.sort().join(" "))):null},N=function(n,t){return t=t||n.selection.getNode(),D(t)?n.dom.select("a[href]",t)[0]:n.dom.getParent(t,"a[href]")},S=function(n){return n&&"A"===n.nodeName&&n.href},D=function(n){return n&&"FIGURE"===n.nodeName&&/\bimage\b/i.test(n.className)},M=function(n,t){var e,r;(r=n.dom.select("img",t)[0])&&(e=n.dom.getParents(r,"a[href]",t)[0])&&(e.parentNode.insertBefore(r,e),n.dom.remove(e))},z=function(n,t,e){var r,o;(o=n.dom.select("img",t)[0])&&(r=n.dom.create("a",e),o.parentNode.insertBefore(r,o),r.appendChild(o))},U=function(o,i){return function(r){o.undoManager.transact(function(){var n=o.selection.getNode(),t=N(o,n),e={href:r.href,target:r.target?r.target:null,rel:r.rel?r.rel:null,"class":r["class"]?r["class"]:null,title:r.title?r.title:null};m(o.settings)||!1!==b(o.settings)||(e.rel=C(e.rel,"_blank"===e.target)),r.href===i.href&&(i.attach(),i={}),t?(o.focus(),r.hasOwnProperty("text")&&("innerText"in t?t.innerText=r.text:t.textContent=r.text),o.dom.setAttribs(t,e),o.selection.select(t),o.undoManager.add()):D(n)?z(o,n,e):r.hasOwnProperty("text")?o.insertContent(o.dom.createHTML("a",e,o.dom.encode(r.text))):o.execCommand("mceInsertLink",!1,e)})}},E=function(t){return function(){t.undoManager.transact(function(){var n=t.selection.getNode();D(n)?M(t,n):t.execCommand("unlink")})}},P=function(n){return 0<T.grep(n,S).length},L=function(n){return!(/</.test(n)&&(!/^<a [^>]+>[^<]+<\/a>$/.test(n)||-1===n.indexOf("href=")))},R=N,K=function(n,t){var e=t?t.innerText||t.textContent:n.getContent({format:"text"});return e.replace(/\uFEFF/g,"")},q=C,j=function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t]},I=function(n){return function(){return n}},V=I(!1),B=I(!0),F=V,W=B,H=function(){return $},$=(r={fold:function(n,t){return n()},is:F,isSome:F,isNone:W,getOr:e=function(n){return n},getOrThunk:t=function(n){return n()},getOrDie:function(n){throw new Error(n||"error: getOrDie called on none.")},getOrNull:function(){return null},getOrUndefined:function(){return undefined},or:e,orThunk:t,map:H,ap:H,each:function(){},bind:H,flatten:H,exists:F,forall:W,filter:H,equals:n=function(n){return n.isNone()},equals_:n,toArray:function(){return[]},toString:I("none()")},Object.freeze&&Object.freeze(r),r),G=function(e){var n=function(){return e},t=function(){return o},r=function(n){return n(e)},o={fold:function(n,t){return t(e)},is:function(n){return e===n},isSome:W,isNone:F,getOr:n,getOrThunk:n,getOrDie:n,getOrNull:
|