mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-02 21:07:12 +01:00
1 line
4.4 KiB
JavaScript
1 line
4.4 KiB
JavaScript
!function(){"use strict";var t,e,n,r,o,i=tinymce.util.Tools.resolve("tinymce.PluginManager"),d=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),g=tinymce.util.Tools.resolve("tinymce.EditorManager"),v=tinymce.util.Tools.resolve("tinymce.Env"),h=tinymce.util.Tools.resolve("tinymce.util.Tools"),c=function(t){return t.getParam("importcss_merge_classes")},u=function(t){return t.getParam("importcss_exclusive")},_=function(t){return t.getParam("importcss_selector_converter")},l=function(t){return t.getParam("importcss_selector_filter")},f=function(t){return t.getParam("importcss_groups")},m=function(t){return t.getParam("importcss_append")},p=function(t){return t.getParam("importcss_file_filter")},s=function(t){return function(){return t}},a=s(!1),y=s(!0),O=function(){return x},x=(r={fold:function(t,e){return t()},is:a,isSome:a,isNone:y,getOr:n=function(t){return t},getOrThunk:e=function(t){return t()},getOrDie:function(t){throw new Error(t||"error: getOrDie called on none.")},getOrNull:function(){return null},getOrUndefined:function(){return undefined},or:n,orThunk:e,map:O,ap:O,each:function(){},bind:O,flatten:O,exists:a,forall:y,filter:O,equals:t=function(t){return t.isNone()},equals_:t,toArray:function(){return[]},toString:s("none()")},Object.freeze&&Object.freeze(r),r),T=(o="function",function(t){return function(t){if(null===t)return"null";var e=typeof t;return"object"===e&&Array.prototype.isPrototypeOf(t)?"array":"object"===e&&String.prototype.isPrototypeOf(t)?"string":e}(t)===o}),b=Array.prototype.push,k=function(t,e){return function(t){for(var e=[],n=0,r=t.length;n<r;++n){if(!Array.prototype.isPrototypeOf(t[n]))throw new Error("Arr.flatten item "+n+" was not an array, input: "+t);b.apply(e,t[n])}return e}(function(t,e){for(var n=t.length,r=new Array(n),o=0;o<n;o++){var i=t[o];r[o]=e(i,o,t)}return r}(t,e))},P=(Array.prototype.slice,T(Array.from)&&Array.from,function(e){return"string"==typeof e?function(t){return-1!==t.indexOf(e)}:e instanceof RegExp?function(t){return e.test(t)}:e}),S=function(f,t,m){var p=[],n={};function y(t,e){var n,r,o,i=t.href;if(r=i,o=v.cacheSuffix,"string"==typeof r&&(r=r.replace("?"+o,"").replace("&"+o,"")),(i=r)&&m(i,e)&&(c=i,s=(u=f).settings,!(a=!1!==s.skin&&(s.skin||"oxide"))||c!==(s.skin_url?u.documentBaseURI.toAbsolute(s.skin_url):g.baseURL+"/skins/"+a)+"/content"+(u.inline?".inline":"")+".min.css")){var u,c,s,a;h.each(t.imports,function(t){y(t,!0)});try{n=t.cssRules||t.rules}catch(l){}h.each(n,function(t){t.styleSheet?y(t.styleSheet,!0):t.selectorText&&h.each(t.selectorText.split(","),function(t){p.push(h.trim(t))})})}}h.each(f.contentCSS,function(t){n[t]=!0}),m||(m=function(t,e){return e||n[t]});try{h.each(t.styleSheets,function(t){y(t)})}catch(e){}return p},A=function(t,e){var n,r=/^(?:([a-z0-9\-_]+))?(\.[a-z0-9_\-\.]+)$/i.exec(e);if(r){var o=r[1],i=r[2].substr(1).split(".").join(" "),u=h.makeMap("a,img");return r[1]?(n={title:e},t.schema.getTextBlockElements()[o]?n.block=o:t.schema.getBlockElements()[o]||u[o.toLowerCase()]?n.selector=o:n.inline=o):r[2]&&(n={inline:"span",title:e.substr(1),classes:i}),!1!==c(t)?n.classes=i:n.attributes={"class":i},n}},w=function(t,e){return null===e||!1!==u(t)},E=A,I=function(g){g.on("init",function(t){var e,n,r,o,i=(e=[],n=[],r={},{addItemToGroup:function(t,e){r[t]?r[t].push(e):(n.push(t),r[t]=[e])},addItem:function(t){e.push(t)},toFormats:function(){return k(n,function(t){var e=r[t];return 0===e.length?[]:[{title:t,items:e}]}).concat(e)}}),y={},u=P(l(g)),c=(o=f(g),h.map(o,function(t){return h.extend({},t,{original:t,selectors:{},filter:P(t.filter),item:{text:t.title,menu:[]}})})),s=function(t,e){if(f=t,p=y,!(w(g,m=e)?f in p:f in m.selectors)){s=t,l=y,w(g,a=e)?l[s]=!0:a.selectors[s]=!0;var n=(i=(o=g).plugins.importcss,u=t,((c=e)&&c.selector_converter?c.selector_converter:_(o)?_(o):function(){return A(o,u)}).call(i,u,c));if(n){var r=n.name||d.DOM.uniqueId();return g.formatter.register(r,n),h.extend({},{title:n.title,format:r})}}var o,i,u,c,s,a,l,f,m,p;return null};h.each(S(g,t.doc||g.getDoc(),P(p(g))),function(n){if(-1===n.indexOf(".mce-")&&(!u||u(n))){var t=(r=c,o=n,h.grep(r,function(t){return!t.filter||t.filter(o)}));if(0<t.length)h.each(t,function(t){var e=s(n,t);e&&i.addItemToGroup(t.title,e)});else{var e=s(n,null);e&&i.addItem(e)}}var r,o});var a=i.toFormats();g.fire("addStyleModifications",{items:a,replace:!m(g)})})},M=function(e){return{convertSelectorToFormat:function(t){return E(e,t)}}};i.add("importcss",function(t){return I(t),M(t)}),function j(){}}(); |