9 lines
9.6 KiB
JavaScript
9 lines
9.6 KiB
JavaScript
|
/**
|
||
|
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||
|
* Licensed under the LGPL or a commercial license.
|
||
|
* For LGPL see License.txt in the project root for license information.
|
||
|
* For commercial licenses see https://www.tiny.cloud/
|
||
|
*
|
||
|
* Version: 5.7.0 (2021-02-10)
|
||
|
*/
|
||
|
!function(){"use strict";var N=function(e){var t=e;return{get:function(){return t},set:function(e){t=e}}},e=tinymce.util.Tools.resolve("tinymce.PluginManager"),l=Object.hasOwnProperty,g=tinymce.util.Tools.resolve("tinymce.util.Tools"),d=tinymce.util.Tools.resolve("tinymce.util.URI"),f=tinymce.util.Tools.resolve("tinymce.util.XHR"),h=function(e){return e.getParam("spellchecker_rpc_url")},k=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)},p=function(e){return e&&1===e.nodeType&&"false"===e.contentEditable},r=function(i,r){var n,a=[],v=r.dom,f=r.schema.getBlockElements(),h=r.schema.getWhiteSpaceElements(),g=r.schema.getShortEndedElements(),o=function(e){var t;if(3===e.nodeType)return e.data;if(h[e.nodeName]&&!f[e.nodeName])return"";if(p(e))return"\n";if(t="",(f[e.nodeName]||g[e.nodeName])&&(t+="\n"),e=e.firstChild)for(;t+=o(e),e=e.nextSibling;);return t},c=function(e){for(var t=e.parentNode;0<e.childNodes.length;)t.insertBefore(e.childNodes[0],e);t.removeChild(e)},s=function(e){var t=i.getElementsByTagName("*"),n=[];e="number"==typeof e?""+e:null;for(var r=0;r<t.length;r++){var o=t[r],a=o.getAttribute("data-mce-index");null!==a&&a.length&&-1!==o.className.indexOf("mce-spellchecker-word")&&(a!==e&&null!==e||n.push(o))}return n},l=function(e){for(var t=a.length;t--;)if(a[t]===e)return t;return-1};function e(e){for(var t=0,n=a.length;t<n&&!1!==e(a[t],t);t++);return this}function t(e){for(var t=s(e?l(e):null),n=t.length;n--;)c(t[n]);return this}var u=function(e){var t=s(l(e)),n=r.dom.createRng();return n.setStartBefore(t[0]),n.setEndAfter(t[t.length-1]),n};var d=o(i);return{text:d,matches:a,each:e,filter:function(n){var r=[];return e(function(e,t){n(e,t)&&r.push(e)}),a=r,this},reset:function(){return a.splice(0,a.length),t(),this},matchFromElement:function(e){return a[e.getAttribute("data-mce-index")]},elementFromMatch:function(e){return s(l(e))[0]},find:function(e,t){if(d&&e.global)for(;n=e.exec(d);)a.push(function(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}}(n,t));return this},add:function(e,t,n){return a.push({start:e,end:e+t,text:d.substr(e,t),data:n}),this},wrap:function(e){var o,m;return a.length&&function(e,t,n){var r,o,a,i,c,s=[],l=0,u=e,d=0;(t=t.slice(0)).sort(function(e,t){return e.start-t.start}),c=t.shift();e:for(;;){if((f[u.nodeName]||g[u.nodeName]||p(u))&&l++,3===u.nodeType&&(!o&&u.length+l>=c.end?(o=u,i=c.end-l):r&&s.push(u),!r&&u.length+l>c.start&&(r=u,a=c.start-l),l+=u.length),r&&o){if(u=n({startNode:r,startNodeIndex:a,endNode:o,endNodeIndex:i,innerNodes:s,match:c.text,matchIndex:d}),l-=o.length-i,o=r=null,s=[],d++,!(c=t.shift()))break}else if(h[u.nodeName]&&!f[u.nodeName]||!u.firstChild){if(u.nextSibling){u=u.nextSibling;continue}}else if(!p(u)){u=u.firstChild;continue}for(;;){if(u.nextSibling){u=u.nextSibling;break}if(u.parentNode===e)break e;u=u.parentNode}}}(i,a,(o=e,m=function(e,t){var n=a[t];n.stencil||(n.stencil=o(n));var r=n.stencil.cloneNode(!1);return r.setAttribute("data-mce-index",t),e&&r.appendChild(v.doc.createTextNode(e)),r},function(e){var t,n,r=e.startNode,o=e.endNode,a=e.matchIndex,i=v.doc;if(r===o){var c=r,s=c.parentNode;0<e.startNodeIndex&&(t=i.createTextNode(c.data.substring(0,e.startNodeIndex)),s.insertBefore(t,c));var l=m(e.match,a);return s.insertBefore(l,c),e.endNodeIndex<c.length&&(n=i.createTextNode(c.data.substring(e.endNodeIndex)),s.insertBefore(n,c)),c.parentNode.removeChild(c),l}t=i.createTextNode(r.data.substring(0,e.startNodeIndex)),n=i.createTextNode(o.data.substring(e.endNodeIndex));for(var u=m(r.data.substring(e.startNodeIndex),a),d=0,f=e.innerNodes.length;d<f;++d){var h=e.innerNodes[d],g=m(h.data,a);h.parentNode.replaceChild(g,h)}var p=m(o.data.substring(0,e.endNodeIndex),a);return(s=r.parentNode).insertBefore(t,r),s.insertBefore(u,r),s.removeChild(r),(s=o.parentNode).insertBefore(p,o),s
|