2 lines
9.9 KiB
JavaScript
2 lines
9.9 KiB
JavaScript
|
!function(){"use strict";var c=function(e){var t=e,n=function(){return t};return{get:n,set:function(e){t=e},clone:function(){return c(n())}}},t=tinymce.util.Tools.resolve("tinymce.PluginManager"),a=function(e){return!(!/(^|[ ,])tinymcespellchecker([, ]|$)/.test(e.settings.plugins)||!t.get("tinymcespellchecker")||("undefined"!=typeof window.console&&window.console.log&&window.console.log("Spell Checker Pro is incompatible with Spell Checker plugin! Remove 'spellchecker' from the 'plugins' option."),0))},h=function(e){return e.getParam("spellchecker_languages","English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr_FR,German=de,Italian=it,Polish=pl,Portuguese=pt_BR,Spanish=es,Swedish=sv")},l=function(e){var t=e.getParam("language","en");return e.getParam("spellchecker_language",t)},d=function(e){return e.getParam("spellchecker_rpc_url")},f=function(e){return e.getParam("spellchecker_callback")},s=function(e){var t=new RegExp('[^\\s!"#$%&()*+,-./:;<=>?@[\\]^_{|}`\xa7\xa9\xab\xae\xb1\xb6\xb7\xb8\xbb\xbc\xbd\xbe\xbf\xd7\xf7\xa4\u201d\u201c\u201e\xa0\u2002\u2003\u2009]+',"g");return e.getParam("spellchecker_wordchar_pattern",t)},g=tinymce.util.Tools.resolve("tinymce.util.Tools"),m=tinymce.util.Tools.resolve("tinymce.util.URI"),p=tinymce.util.Tools.resolve("tinymce.util.XHR"),u=function(e){return e.fire("SpellcheckStart")},r=function(e){return e.fire("SpellcheckEnd")};function v(e){return e&&1===e.nodeType&&"false"===e.contentEditable}var x,o=function(c,r){var n,o,f,h,g,i=[],x=r.dom;function a(e,t){if(!e[0])throw new Error("findAndReplaceDOMText cannot handle zero-length matches");return{start:e.index,end:e.index+e[0].length,text:e[0],data:t}}function l(e){var t=c.getElementsByTagName("*"),n=[];e="number"==typeof e?""+e:null;for(var r=0;r<t.length;r++){var o=t[r],i=o.getAttribute("data-mce-index");null!==i&&i.length&&-1!==o.className.indexOf("mce-spellchecker-word")&&(i!==e&&null!==e||n.push(o))}return n}function s(e){for(var t=i.length;t--;)if(i[t]===e)return t;return-1}function t(e){for(var t=0,n=i.length;t<n&&!1!==e(i[t],t);t++);return this}function u(e){var t,n,r=l(e?s(e):null);for(t=r.length;t--;)(n=r[t]).parentNode.insertBefore(n.firstChild,n),n.parentNode.removeChild(n);return this}function d(e){var t=l(s(e)),n=r.dom.createRng();return n.setStartBefore(t[0]),n.setEndAfter(t[t.length-1]),n}return f=r.schema.getBlockElements(),h=r.schema.getWhiteSpaceElements(),g=r.schema.getShortEndedElements(),{text:o=function e(t){var n;if(3===t.nodeType)return t.data;if(h[t.nodeName]&&!f[t.nodeName])return"";if(v(t))return"\n";if(n="",(f[t.nodeName]||g[t.nodeName])&&(n+="\n"),t=t.firstChild)for(;n+=e(t),t=t.nextSibling;);return n}(c),matches:i,each:t,filter:function(n){var r=[];return t(function(e,t){n(e,t)&&r.push(e)}),i=r,this},reset:function(){return i.splice(0,i.length),u(),this},matchFromElement:function(e){return i[e.getAttribute("data-mce-index")]},elementFromMatch:function(e){return l(s(e))[0]},find:function(e,t){if(o&&e.global)for(;n=e.exec(o);)i.push(a(n,t));return this},add:function(e,t,n){return i.push({start:e,end:e+t,text:o.substr(e,t),data:n}),this},wrap:function(e){return i.length&&function(e,t,n){var r,o,i,c,a,l=[],s=0,u=e,d=0;(t=t.slice(0)).sort(function(e,t){return e.start-t.start}),a=t.shift();e:for(;;){if((f[u.nodeName]||g[u.nodeName]||v(u))&&s++,3===u.nodeType&&(!o&&u.length+s>=a.end?(o=u,c=a.end-s):r&&l.push(u),!r&&u.length+s>a.start&&(r=u,i=a.start-s),s+=u.length),r&&o){if(u=n({startNode:r,startNodeIndex:i,endNode:o,endNodeIndex:c,innerNodes:l,match:a.text,matchIndex:d}),s-=o.length-c,o=r=null,l=[],d++,!(a=t.shift()))break}else if(h[u.nodeName]&&!f[u.nodeName]||!u.firstChild){if(u.nextSibling){u=u.nextSibling;continue}}else if(!v(u)){u=u.firstChild;continue}for(;;){if(u.nextSibling){u=u.nextSibling;break}if(u.parentNode===e)break e;u=u.parentNode}}}(c,i,function(o){function v(e,t){var n=i[t];n.stencil||(n.stencil=o(n));var r=n.stencil.cloneNode(!1);return r.setAttribute("data-mce-index",t),e&&r.appendChild(x.doc.createTextNode(e)),r}return function(e){var t,n,r,o=e.startNode,i=e.endNode,c=e.matchIndex,a=x.doc;if(o=
|