11 lines
8.6 KiB
JavaScript
11 lines
8.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.0.3 (2019-03-19)
|
||
|
*/
|
||
|
|
||
|
!function(){"use strict";var r=function(e){var t=e,n=function(){return t};return{get:n,set:function(e){t=e},clone:function(){return r(n())}}},e=tinymce.util.Tools.resolve("tinymce.PluginManager"),p=tinymce.util.Tools.resolve("tinymce.util.Tools");function x(e){return e&&1===e.nodeType&&"false"===e.contentEditable}var t,n,a,o,i,u={findAndReplaceDOMText:function R(e,t,n,r,a){var o,i,m,f,p,g,d=[],c=0;function l(e,t){if(t=t||0,!e[0])throw new Error("findAndReplaceDOMText cannot handle zero-length matches");var n=e.index;if(0<t){var r=e[t];if(!r)throw new Error("Invalid capture group");n+=e[0].indexOf(r),e[0]=r}return[n,n+e[0].length,[e[0]]]}if(m=t.ownerDocument,f=a.getBlockElements(),p=a.getWhiteSpaceElements(),g=a.getShortEndedElements(),i=function s(e){var t;if(3===e.nodeType)return e.data;if(p[e.nodeName]&&!f[e.nodeName])return"";if(t="",x(e))return"\n";if((f[e.nodeName]||g[e.nodeName])&&(t+="\n"),e=e.firstChild)for(;t+=s(e),e=e.nextSibling;);return t}(t)){if(e.global)for(;o=e.exec(i);)d.push(l(o,r));else o=i.match(e),d.push(l(o,r));return d.length&&(c=d.length,function h(e,t,n){var r,a,o,i,d=[],c=0,l=e,s=t.shift(),u=0;e:for(;;){if((f[l.nodeName]||g[l.nodeName]||x(l))&&c++,3===l.nodeType&&(!a&&l.length+c>=s[1]?(a=l,i=s[1]-c):r&&d.push(l),!r&&l.length+c>s[0]&&(r=l,o=s[0]-c),c+=l.length),r&&a){if(l=n({startNode:r,startNodeIndex:o,endNode:a,endNodeIndex:i,innerNodes:d,match:s[2],matchIndex:u}),c-=a.length-i,a=r=null,d=[],u++,!(s=t.shift()))break}else if(p[l.nodeName]&&!f[l.nodeName]||!l.firstChild){if(l.nextSibling){l=l.nextSibling;continue}}else if(!x(l)){l=l.firstChild;continue}for(;;){if(l.nextSibling){l=l.nextSibling;break}if(l.parentNode===e)break e;l=l.parentNode}}}(t,d,function u(e){var h;if("function"!=typeof e){var r=e.nodeType?e:m.createElement(e);h=function(e,t){var n=r.cloneNode(!1);return n.setAttribute("data-mce-index",t),e&&n.appendChild(m.createTextNode(e)),n}}else h=e;return function(e){var t,n,r,a=e.startNode,o=e.endNode,i=e.matchIndex;if(a===o){var d=a;r=d.parentNode,0<e.startNodeIndex&&(t=m.createTextNode(d.data.substring(0,e.startNodeIndex)),r.insertBefore(t,d));var c=h(e.match[0],i);return r.insertBefore(c,d),e.endNodeIndex<d.length&&(n=m.createTextNode(d.data.substring(e.endNodeIndex)),r.insertBefore(n,d)),d.parentNode.removeChild(d),c}t=m.createTextNode(a.data.substring(0,e.startNodeIndex)),n=m.createTextNode(o.data.substring(e.endNodeIndex));for(var l=h(a.data.substring(e.startNodeIndex),i),s=0,u=e.innerNodes.length;s<u;++s){var f=e.innerNodes[s],p=h(f.data,i);f.parentNode.replaceChild(p,f)}var g=h(o.data.substring(0,e.endNodeIndex),i);return(r=a.parentNode).insertBefore(t,a),r.insertBefore(l,a),r.removeChild(a),(r=o.parentNode).insertBefore(g,o),r.insertBefore(n,o),r.removeChild(o),g}}(n))),c}}},g=function(e){var t=e.getAttribute("data-mce-index");return"number"==typeof t?""+t:t},h=function(e){var t=e.parentNode;e.firstChild&&t.insertBefore(e.firstChild,e),e.parentNode.removeChild(e)},d=function(e,t){var n,r=[];if((n=p.toArray(e.getBody().getElementsByTagName("span"))).length)for(var a=0;a<n.length;a++){var o=g(n[a]);null!==o&&o.length&&o===t.toString()&&r.push(n[a])}return r},f=function(e,t,n){var r=t.get(),a=e.dom;(n=!1!==n)?r++:r--,a.removeClass(d(e,t.get()),"mce-match-marker-selected");var o=d(e,r);return o.length?(a.addClass(d(e,r),"mce-match-marker-selected"),e.selection.scrollIntoView(o[0]),r):-1},m=function(e,t){var n=t.parentNode;e.remove(t),e.isEmpty(n)&&e.remove(n)},v=function(e,t){var n=f(e,t,!0);-1!==n&&t.set(n)},b=function(e,t){var n=f(e,t,!1);-1!==n&&t.set(n)},N=function(e){var t=g(e);return null!==t&&0<t.length},y=function(e,t,n){var r,a,o,i;for(a=p.toArray(e.getBody().getElementsByTagName("span")),r=0;r<a.length;r++){var d=g(a[r]);null!==d&&d.length&&(d===t.get().toString()&&(o||(o=a[r].firstChild),i=a[r].firstChild),h(a[r]))}if(o&&i){var c=e.dom.createRng();return c.setStart(o,0),c.setEnd(i,i.data.length),!1!==n&&e.selection.setRng(c),c}},w=function(e,t){return 0<d(e,t.get()+1).length},C=function(e,t){return 0<d(e,t.get()-1).length},s={done:y,find:function(e,t,n,r,a){n=(n=n.replac
|