11 lines
9.1 KiB
JavaScript
11 lines
9.1 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.12 (2019-07-18)
|
||
|
*/
|
||
|
|
||
|
!function(){"use strict";var o=function(e){var t=e,n=function(){return t};return{get:n,set:function(e){t=e},clone:function(){return o(n())}}},e=tinymce.util.Tools.resolve("tinymce.PluginManager"),p=function(){return(p=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},m=tinymce.util.Tools.resolve("tinymce.util.Tools");function x(e){return e&&1===e.nodeType&&"false"===e.contentEditable}var t,n,r,a,i,f={findAndReplaceDOMText:function D(e,t,n,r,o){var a,i,h,f,g,p,c=[],d=0;function u(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(h=t.ownerDocument,f=o.getBlockElements(),g=o.getWhiteSpaceElements(),p=o.getShortEndedElements(),i=function l(e){var t;if(3===e.nodeType)return e.data;if(g[e.nodeName]&&!f[e.nodeName])return"";if(t="",x(e))return"\n";if((f[e.nodeName]||p[e.nodeName])&&(t+="\n"),e=e.firstChild)for(;t+=l(e),e=e.nextSibling;);return t}(t)){if(e.global)for(;a=e.exec(i);)c.push(u(a,r));else a=i.match(e),c.push(u(a,r));return c.length&&(d=c.length,function m(e,t,n){var r,o,a,i,c=[],d=0,u=e,l=t.shift(),s=0;e:for(;;){if((f[u.nodeName]||p[u.nodeName]||x(u))&&d++,3===u.nodeType&&(!o&&u.length+d>=l[1]?(o=u,i=l[1]-d):r&&c.push(u),!r&&u.length+d>l[0]&&(r=u,a=l[0]-d),d+=u.length),r&&o){if(u=n({startNode:r,startNodeIndex:a,endNode:o,endNodeIndex:i,innerNodes:c,match:l[2],matchIndex:s}),d-=o.length-i,o=r=null,c=[],s++,!(l=t.shift()))break}else if(g[u.nodeName]&&!f[u.nodeName]||!u.firstChild){if(u.nextSibling){u=u.nextSibling;continue}}else if(!x(u)){u=u.firstChild;continue}for(;;){if(u.nextSibling){u=u.nextSibling;break}if(u.parentNode===e)break e;u=u.parentNode}}}(t,c,function s(e){var m;if("function"!=typeof e){var r=e.nodeType?e:h.createElement(e);m=function(e,t){var n=r.cloneNode(!1);return n.setAttribute("data-mce-index",t),e&&n.appendChild(h.createTextNode(e)),n}}else m=e;return function(e){var t,n,r,o=e.startNode,a=e.endNode,i=e.matchIndex;if(o===a){var c=o;r=c.parentNode,0<e.startNodeIndex&&(t=h.createTextNode(c.data.substring(0,e.startNodeIndex)),r.insertBefore(t,c));var d=m(e.match[0],i);return r.insertBefore(d,c),e.endNodeIndex<c.length&&(n=h.createTextNode(c.data.substring(e.endNodeIndex)),r.insertBefore(n,c)),c.parentNode.removeChild(c),d}t=h.createTextNode(o.data.substring(0,e.startNodeIndex)),n=h.createTextNode(a.data.substring(e.endNodeIndex));for(var u=m(o.data.substring(e.startNodeIndex),i),l=0,s=e.innerNodes.length;l<s;++l){var f=e.innerNodes[l],g=m(f.data,i);f.parentNode.replaceChild(g,f)}var p=m(a.data.substring(0,e.endNodeIndex),i);return(r=o.parentNode).insertBefore(t,o),r.insertBefore(u,o),r.removeChild(o),(r=a.parentNode).insertBefore(p,a),r.insertBefore(n,a),r.removeChild(a),p}}(n))),d}}},h=function(e){var t=e.getAttribute("data-mce-index");return"number"==typeof t?""+t:t},v=function(e){var t=e.parentNode;e.firstChild&&t.insertBefore(e.firstChild,e),e.parentNode.removeChild(e)},c=function(e,t){var n,r=[];if((n=m.toArray(e.getBody().getElementsByTagName("span"))).length)for(var o=0;o<n.length;o++){var a=h(n[o]);null!==a&&a.length&&(a===t.toString()&&r.push(n[o]))}return r},g=function(e,t,n){var r=t.get(),o=r.index,a=e.dom;(n=!1!==n)?o+1===r.count?o=0:o++:o-1==-1?o=r.count-1:o--,a.removeClass(c(e,r.index),"mce-match-marker-selected");var i=c(e,o);return i.length?(a.addClass(c(e,o),"mce-match-marker-selected"),e.selection.scrollIntoView(i[0]),o):-1},b=function(e,t){var n=t.parentNode;e.remove(t),e.isEmpty(n)&&e.remove(n)},y=function(e,t,n,r,o){n=(n=n.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")).replace(/\s/g,"[^\\S\\r\\n]"),n=o?"\\b"+n+"\\b":n;var a,i,c,d,u,l=(a=e,i=t,c=new RegExp(n,r?"g":"gi"),(u=a.dom.create("span",{"data-mce-bogus":1})).className="mce-match-marker",d=a.getBody(),T(a,i,!1),f.findAndReplaceDOMText(c,d,u,!1,a.schema));if(l){var s=g(e,t,!0);t.set({index:s,count:l,te
|