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
30 KiB
JavaScript

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