You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

9 lines
9.7 KiB
JavaScript

4 weeks ago
/**
* 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.9.2 (2021-09-08)
*/
!function(){"use strict";function I(e){var t=e;return{get:function(){return t},set:function(e){t=e}}}function u(e){return e.getParam("spellchecker_rpc_url")}function E(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)}function p(e){return e&&1===e.nodeType&&"false"===e.contentEditable}function r(i,r){function o(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}function a(e){for(var t=c.length;t--;)if(c[t]===e)return t;return-1}var n,c=[],v=r.dom,f=r.schema.getBlockElements(),h=r.schema.getWhiteSpaceElements(),g=r.schema.getShortEndedElements(),s=function(e){if(3===e.nodeType)return e.data;if(h[e.nodeName]&&!f[e.nodeName])return"";if(p(e))return"\n";var t="";if((f[e.nodeName]||g[e.nodeName])&&(t+="\n"),e=e.firstChild)for(;t+=s(e),e=e.nextSibling;);return t};function e(e){for(var t=0,n=c.length;t<n&&!1!==e(c[t],t);t++);return this}function t(e){for(var t=o(e?a(e):null),n=t.length;n--;)!function(e){for(var t=e.parentNode;0<e.childNodes.length;)t.insertBefore(e.childNodes[0],e);t.removeChild(e)}(t[n]);return this}function l(e){var t=o(a(e)),n=r.dom.createRng();return n.setStartBefore(t[0]),n.setEndAfter(t[t.length-1]),n}var u=s(i);return{text:u,matches:c,each:e,filter:function(n){var r=[];return e(function(e,t){n(e,t)&&r.push(e)}),c=r,this},reset:function(){return c.splice(0,c.length),t(),this},matchFromElement:function(e){return c[e.getAttribute("data-mce-index")]},elementFromMatch:function(e){return o(a(e))[0]},find:function(e,t){if(u&&e.global)for(;n=e.exec(u);)c.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 c.push({start:e,end:e+t,text:u.substr(e,t),data:n}),this},wrap:function(e){return c.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,c,(o=e,function(e){var t=e.startNode,n=e.endNode,r=e.matchIndex,o=v.doc;if(t===n){var a=t,i=a.parentNode;0<e.startNodeIndex&&(s=o.createTextNode(a.data.substring(0,e.startNodeIndex)),i.insertBefore(s,a));var c=m(e.match,r);return i.insertBefore(c,a),e.endNodeIndex<a.length&&(l=o.createTextNode(a.data.substring(e.endNodeIndex)),i.insertBefore(l,a)),a.parentNode.removeChild(a),c}for(var s=o.createTextNode(t.data.substring(0,e.startNodeIndex)),l=o.createTextNode(n.data.substring(e.endNodeIndex)),u=m(t.data.substring(e.startNodeIndex),r),d=0,f=e.innerNodes.length;d<f;++d){var h=e.innerNodes[d],g=m(h.data,r);h.parentNode.replaceChild(g,h)}var p=m(n.data.substring(0,e.endNodeIndex),r);return(i=t.parentNode).insertBefore(s,t),i.insertBefore(u,t),i.removeChild(t),(i=n.parentNode).insertBefore(p,n),i.insertBefore(l,n),i.removeChild(n),p})),this;function m(e,t){var n=c[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}var o},unwrap:t,replace:function(e,t){var n=l(e);return n.deleteContents(),0<t.length&&n.insertNode(r.dom.doc.createTextNode(t)),n},rangeFromMatch:l,indexOf:a}}function l(e,t){var n;return t.get()||(n=r(e.getBod