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.
roundcubemail/program/js/tinymce/plugins/table/plugin.min.js

1 line
25 KiB
JavaScript

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