Files
leanote/public/tinymce/plugins/spellchecker/plugin.min.js

1 line
6.5 KiB
JavaScript
Raw Normal View History

2015-01-08 23:33:14 +08:00
!function(e,t){"use strict";function n(e,t){for(var n,r=[],i=0;i<e.length;++i){if(n=c[e[i]]||o(e[i]),!n)throw"module definition dependecy not found: "+e[i];r.push(n)}t.apply(null,r)}function r(e,r,o){if("string"!=typeof e)throw"invalid module definition, module id must be defined and be a string";if(r===t)throw"invalid module definition, dependencies must be specified";if(o===t)throw"invalid module definition, definition function must be specified";n(r,function(){c[e]=o.apply(null,arguments)})}function o(t){for(var n=e,r=t.split(/[.\/]/),o=0;o<r.length;++o){if(!n[r[o]])return;n=n[r[o]]}return n}function i(n){for(var r=0;r<n.length;r++){for(var o=e,i=n[r],a=i.split(/[.\/]/),l=0;l<a.length-1;++l)o[a[l]]===t&&(o[a[l]]={}),o=o[a[l]];o[a[a.length-1]]=c[i]}}var c={};r("tinymce/spellcheckerplugin/DomTextMatcher",[],function(){return function(e,t,n){function r(e){if(!e[0])throw"findAndReplaceDOMText cannot handle zero-length matches";var t=e.index;return[t,t+e[0].length,[e[0]]]}function o(e){var t;if(3===e.nodeType)return e.data;if(p[e.nodeName]&&!h[e.nodeName])return"";if(t="",(h[e.nodeName]||g[e.nodeName])&&(t+="\n"),e=e.firstChild)do t+=o(e);while(e=e.nextSibling);return t}function i(e,t,n){var r,o,i,c,a=[],l=0,d=e,s=t.shift(),u=0;e:for(;;){if((h[d.nodeName]||g[d.nodeName])&&l++,3===d.nodeType&&(!o&&d.length+l>=s[1]?(o=d,c=s[1]-l):r&&a.push(d),!r&&d.length+l>s[0]&&(r=d,i=s[0]-l),l+=d.length),r&&o){if(d=n({startNode:r,startNodeIndex:i,endNode:o,endNodeIndex:c,innerNodes:a,match:s[2],matchIndex:u}),l-=o.length-c,r=null,o=null,a=[],s=t.shift(),u++,!s)break}else{if((!p[d.nodeName]||h[d.nodeName])&&d.firstChild){d=d.firstChild;continue}if(d.nextSibling){d=d.nextSibling;continue}}for(;;){if(d.nextSibling){d=d.nextSibling;break}if(d.parentNode===e)break e;d=d.parentNode}}}function c(e){var t;if("function"!=typeof e){var n=e.nodeType?e:f.createElement(e);t=function(e,t){var r=n.cloneNode(!1);return r.setAttribute("data-mce-index",t),e&&r.appendChild(f.createTextNode(e)),r}}else t=e;return function(e){var n,r,o,i=e.startNode,c=e.endNode,a=e.matchIndex;if(i===c){var l=i;o=l.parentNode,e.startNodeIndex>0&&(n=f.createTextNode(l.data.substring(0,e.startNodeIndex)),o.insertBefore(n,l));var d=t(e.match[0],a);return o.insertBefore(d,l),e.endNodeIndex<l.length&&(r=f.createTextNode(l.data.substring(e.endNodeIndex)),o.insertBefore(r,l)),l.parentNode.removeChild(l),d}n=f.createTextNode(i.data.substring(0,e.startNodeIndex)),r=f.createTextNode(c.data.substring(e.endNodeIndex));for(var s=t(i.data.substring(e.startNodeIndex),a),u=[],h=0,p=e.innerNodes.length;p>h;++h){var g=e.innerNodes[h],m=t(g.data,a);g.parentNode.replaceChild(m,g),u.push(m)}var v=t(c.data.substring(0,e.endNodeIndex),a);return o=i.parentNode,o.insertBefore(n,i),o.insertBefore(s,i),o.removeChild(i),o=c.parentNode,o.insertBefore(v,c),o.insertBefore(r,c),o.removeChild(c),v}}function a(e){var t=[];return l(function(n,r){e(n,r)&&t.push(n)}),m=t,this}function l(e){for(var t=0,n=m.length;n>t&&e(m[t],t)!==!1;t++);return this}function d(e){return m.length&&(v=m.length,i(t,m,c(e))),this}var s,u,f,h,p,g,m=[],v=0;if(f=t.ownerDocument,h=n.getBlockElements(),p=n.getWhiteSpaceElements(),g=n.getShortEndedElements(),u=o(t),u&&e.global)for(;s=e.exec(u);)m.push(r(s));return{text:u,count:v,matches:m,each:l,filter:a,mark:d}}}),r("tinymce/spellcheckerplugin/Plugin",["tinymce/spellcheckerplugin/DomTextMatcher","tinymce/PluginManager","tinymce/util/Tools","tinymce/ui/Menu","tinymce/dom/DOMUtils","tinymce/util/JSONRequest","tinymce/util/URI"],function(e,t,n,r,o,i,c){t.add("spellchecker",function(t,a){function l(e){for(var t in e)return!1;return!0}function d(e,i){var c=[],a=m[i];n.each(a,function(e){c.push({text:e,onclick:function(){t.insertContent(e),u()}})}),c.push.apply(c,[{text:"-"},{text:"Ignore",onclick:function(){h(e,i)}},{text:"Ignore all",onclick:function(){h(e,i,!0)}},{text:"Finish",onclick:p}]),x=new r({items:c,context:"contextmenu",onautohide:function(e){-1!=e.target.className.indexOf("spellchecker")&&e.preventDefault()},onhide:function(){x.remove(),x=null}}),x.renderTo(document.body);var l=o.D