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

1 line
22 KiB
JavaScript
Raw Normal View History

2015-03-31 14:27:26 +08:00
!function(e,t){"use strict";function n(e,t){for(var n,o=[],i=0;i<e.length;++i){if(n=l[e[i]]||r(e[i]),!n)throw"module definition dependecy not found: "+e[i];o.push(n)}t.apply(null,o)}function o(e,o,r){if("string"!=typeof e)throw"invalid module definition, module id must be defined and be a string";if(o===t)throw"invalid module definition, dependencies must be specified";if(r===t)throw"invalid module definition, definition function must be specified";n(o,function(){l[e]=r.apply(null,arguments)})}function r(t){for(var n=e,o=t.split(/[.\/]/),r=0;r<o.length;++r){if(!n[o[r]])return;n=n[o[r]]}return n}function i(n){for(var o=0;o<n.length;o++){for(var r=e,i=n[o],a=i.split(/[.\/]/),c=0;c<a.length-1;++c)r[a[c]]===t&&(r[a[c]]={}),r=r[a[c]];r[a[a.length-1]]=l[i]}}var l={};o("tinymce/tableplugin/TableGrid",["tinymce/util/Tools","tinymce/Env"],function(e,t){function n(e,t){return parseInt(e.getAttribute(t)||1,10)}var o=e.each;return function(r,i){function l(){var e=0;B=[],o(["thead","tbody","tfoot"],function(t){var r=E.select("> "+t+" tr",i);o(r,function(r,i){i+=e,o(E.select("> td, > th",r),function(e,o){var r,l,a,c;if(B[i])for(;B[i][o];)o++;for(a=n(e,"rowspan"),c=n(e,"colspan"),l=i;i+a>l;l++)for(B[l]||(B[l]=[]),r=o;o+c>r;r++)B[l][r]={part:t,real:l==i&&r==o,elm:e,rowspan:a,colspan:c}})}),e+=r.length})}function a(e,t){return e=e.cloneNode(t),e.removeAttribute("id"),e}function c(e,t){var n;return n=B[t],n?n[e]:void 0}function s(e,t,n){e&&(n=parseInt(n,10),1===n?e.removeAttribute(t,1):e.setAttribute(t,n,1))}function d(e){return e&&(E.hasClass(e.elm,"mce-item-selected")||e==D)}function u(){var e=[];return o(i.rows,function(t){o(t.cells,function(n){return E.hasClass(n,"mce-item-selected")||n==D.elm?(e.push(t),!1):void 0})}),e}function m(){var e=E.createRng();e.setStartAfter(i),e.setEndAfter(i),I.setRng(e),E.remove(i)}function f(n){var i,l={};return r.settings.table_clone_elements!==!1&&(l=e.makeMap((r.settings.table_clone_elements||"strong em b i span font h1 h2 h3 h4 h5 h6 p div").toUpperCase(),/[ ,]/)),e.walk(n,function(e){var r;return 3==e.nodeType?(o(E.getParents(e.parentNode,null,n).reverse(),function(e){l[e.nodeName]&&(e=a(e,!1),i?r&&r.appendChild(e):i=r=e,r=e)}),r&&(r.innerHTML=t.ie?"&nbsp;":'<br data-mce-bogus="1" />'),!1):void 0},"childNodes"),n=a(n,!1),s(n,"rowSpan",1),s(n,"colSpan",1),i?n.appendChild(i):t.ie||(n.innerHTML='<br data-mce-bogus="1" />'),n}function g(){var e,t=E.createRng();return o(E.select("tr",i),function(e){0===e.cells.length&&E.remove(e)}),0===E.select("tr",i).length?(t.setStartBefore(i),t.setEndBefore(i),I.setRng(t),void E.remove(i)):(o(E.select("thead,tbody,tfoot",i),function(e){0===e.rows.length&&E.remove(e)}),l(),e=B[Math.min(B.length-1,k.y)],void(e&&(I.select(e[Math.min(e.length-1,k.x)].elm,!0),I.collapse(!0))))}function p(e,t,n,o){var r,i,l,a,c;for(r=B[t][e].elm.parentNode,l=1;n>=l;l++)if(r=E.getNext(r,"tr")){for(i=e;i>=0;i--)if(c=B[t+l][i].elm,c.parentNode==r){for(a=1;o>=a;a++)E.insertAfter(f(c),c);break}if(-1==i)for(a=1;o>=a;a++)r.insertBefore(f(r.cells[0]),r.cells[0])}}function h(){o(B,function(e,t){o(e,function(e,o){var r,i,l;if(d(e)&&(e=e.elm,r=n(e,"colspan"),i=n(e,"rowspan"),r>1||i>1)){for(s(e,"rowSpan",1),s(e,"colSpan",1),l=0;r-1>l;l++)E.insertAfter(f(e),e);p(o,t,i-1,r)}})})}function b(t,n,r){var i,a,u,m,f,p,b,v,w,y,x;if(t?(i=T(t),a=i.x,u=i.y,m=a+(n-1),f=u+(r-1)):(k=M=null,o(B,function(e,t){o(e,function(e,n){d(e)&&(k||(k={x:n,y:t}),M={x:n,y:t})})}),a=k.x,u=k.y,m=M.x,f=M.y),v=c(a,u),w=c(m,f),v&&w&&v.part==w.part){for(h(),l(),v=c(a,u).elm,s(v,"colSpan",m-a+1),s(v,"rowSpan",f-u+1),b=u;f>=b;b++)for(p=a;m>=p;p++)B[b]&&B[b][p]&&(t=B[b][p].elm,t!=v&&(y=e.grep(t.childNodes),o(y,function(e){v.appendChild(e)}),y.length&&(y=e.grep(v.childNodes),x=0,o(y,function(e){"BR"==e.nodeName&&E.getAttrib(e,"data-mce-bogus")&&x++<y.length-1&&v.removeChild(e)})),E.remove(t)));g()}}function v(e){var t,r,i,l,c,u,m,g,p;for(o(B,function(n,r){return o(n,function(n){return d(n)&&(n=n.elm,c=n.parentNode,u=a(c,!1),t=r,e)?!1:void 0}),e?!t:void 0}),l=0;l<B[0].length;l++)if(B[t][l]&&(r=B[t][l].elm,r!=i)){if(e){if(t>0&&B[t-1][l]&&(g