1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-20 21:59:42 +02:00
documize/gui/public/tinymce/plugins/visualchars/plugin.min.js

1 line
5.5 KiB
JavaScript
Raw Normal View History

2018-01-19 11:36:38 +00:00
!function(){"use strict";var n=function(e){var t=e,r=function(){return t};return{get:r,set:function(n){t=n},clone:function(){return n(r())}}},e=tinymce.util.Tools.resolve("tinymce.PluginManager"),t=function(n){return{isEnabled:function(){return n.get()}}},r=function(n,e){return n.fire("VisualChars",{state:e})},o={"\xa0":"nbsp","\xad":"shy"},u=function(n,e){var t,r="";for(t in n)r+=t;return new RegExp("["+r+"]",e?"g":"")},i=function(n){var e,t="";for(e in n)t&&(t+=","),t+="span.mce-"+n[e];return t},c={charMap:o,regExp:u(o),regExpGlobal:u(o,!0),selector:i(o),charMapToRegExp:u,charMapToSelector:i},a=function(n){return function(){return n}},f={noop:function(){},noarg:function(n){return function(){return n()}},compose:function(n,e){return function(){return n(e.apply(null,arguments))}},constant:a,identity:function(n){return n},tripleEquals:function(n,e){return n===e},curry:function(n){for(var e=new Array(arguments.length-1),t=1;t<arguments.length;t++)e[t-1]=arguments[t];return function(){for(var t=new Array(arguments.length),r=0;r<t.length;r++)t[r]=arguments[r];var o=e.concat(t);return n.apply(null,o)}},not:function(n){return function(){return!n.apply(null,arguments)}},die:function(n){return function(){throw new Error(n)}},apply:function(n){return n()},call:function(n){n()},never:a(!1),always:a(!0)},l=f.never,s=f.always,d=function(){return m},m=function(){var n=function(n){return n.isNone()},e=function(n){return n()},t=function(n){return n},r={fold:function(n,e){return n()},is:l,isSome:l,isNone:s,getOr:t,getOrThunk:e,getOrDie:function(n){throw new Error(n||"error: getOrDie called on none.")},or:t,orThunk:e,map:d,ap:d,each:function(){},bind:d,flatten:d,exists:l,forall:s,filter:d,equals:n,equals_:n,toArray:function(){return[]},toString:f.constant("none()")};return Object.freeze&&Object.freeze(r),r}(),v=function(n){var e=function(){return n},t=function(){return o},r=function(e){return e(n)},o={fold:function(e,t){return t(n)},is:function(e){return n===e},isSome:s,isNone:l,getOr:e,getOrThunk:e,getOrDie:e,or:t,orThunk:t,map:function(e){return v(e(n))},ap:function(e){return e.fold(d,function(e){return v(e(n))})},each:function(e){e(n)},bind:r,flatten:e,exists:r,forall:r,filter:function(e){return e(n)?o:m},equals:function(e){return e.is(n)},equals_:function(e,t){return e.fold(l,function(e){return t(n,e)})},toArray:function(){return[n]},toString:function(){return"some("+n+")"}};return o},p={some:v,none:d,from:function(n){return null===n||n===undefined?m:v(n)}},h=(function(){var n=Array.prototype.indexOf;undefined}(),function(n,e){for(var t=n.length,r=new Array(t),o=0;o<t;o++){var u=n[o];r[o]=e(u,o,n)}return r}),g=function(n,e){for(var t=0,r=n.length;t<r;t++){e(n[t],t,n)}},y=function(n,e){for(var t=0,r=n.length;t<r;++t)if(n[t]===e)return t;return-1},T=(Array.prototype.push,Array.prototype.slice,h),w=g,x=function(n){if(null===n||n===undefined)throw new Error("Node cannot be null or undefined");return{dom:f.constant(n)}},E={fromHtml:function(n,e){var t=(e||document).createElement("div");if(t.innerHTML=n,!t.hasChildNodes()||t.childNodes.length>1)throw console.error("HTML does not have a single root node",n),"HTML must have a single root node";return x(t.childNodes[0])},fromTag:function(n,e){var t=(e||document).createElement(n);return x(t)},fromText:function(n,e){var t=(e||document).createTextNode(n);return x(t)},fromDom:x,fromPoint:function(n,e,t){return p.from(n.dom().elementFromPoint(e,t)).map(x)}},b=8,k=9,N=3,C=function(n){return n.dom().nodeName.toLowerCase()},M=function(n){return n.dom().nodeType},D=function(n){return function(e){return M(e)===n}},O=D(1),A=D(N),S=D(k),B={name:C,type:M,value:function(n){return n.dom().nodeValue},isElement:O,isText:A,isDocument:S,isComment:function(n){return M(n)===b||"#comment"===C(n)}},P=function(n){return'<span data-mce-bogus="1" class="mce-'+c.charMap[n]+'">'+n+"</span>"},V=function(n,e){var t=[],r=n.dom(),o=T(r.childNodes,E.fromDom);return w(o,function(n){e(n)&&(t=t.concat([n])),t=t.concat(V(n,e))}),t},q={isMatch:function(n){return B.isText(n)&&B.value(n)!==undefined&&c.regExp.test(B.value(n))},fil