summaryrefslogtreecommitdiff
path: root/program/js/tinymce/plugins/table/plugin.min.js
diff options
context:
space:
mode:
Diffstat (limited to 'program/js/tinymce/plugins/table/plugin.min.js')
-rw-r--r--program/js/tinymce/plugins/table/plugin.min.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/program/js/tinymce/plugins/table/plugin.min.js b/program/js/tinymce/plugins/table/plugin.min.js
index 68be206bd..4ee5ccaf7 100644
--- a/program/js/tinymce/plugins/table/plugin.min.js
+++ b/program/js/tinymce/plugins/table/plugin.min.js
@@ -1 +1 @@
-!function(e,t){"use strict";function n(e,t){for(var n,r=[],i=0;i<e.length;++i){if(n=s[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,i){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(i===t)throw"invalid module definition, definition function must be specified";n(r,function(){s[e]=i.apply(null,arguments)})}function i(e){return!!s[e]}function o(t){for(var n=e,r=t.split(/[.\/]/),i=0;i<r.length;++i){if(!n[r[i]])return;n=n[r[i]]}return n}function a(n){for(var r=0;r<n.length;r++){for(var i=e,o=n[r],a=o.split(/[.\/]/),l=0;l<a.length-1;++l)i[a[l]]===t&&(i[a[l]]={}),i=i[a[l]];i[a[a.length-1]]=s[o]}}var s={},l="tinymce/tableplugin/TableGrid",c="tinymce/util/Tools",d="tinymce/Env",u="tinymce/tableplugin/Quirks",f="tinymce/util/VK",p="tinymce/tableplugin/CellSelection",m="tinymce/dom/TreeWalker",h="tinymce/tableplugin/Plugin",g="tinymce/PluginManager";r(l,[c,d],function(e,n){function r(e,t){return parseInt(e.getAttribute(t)||1,10)}var i=e.each;return function(o,a){function s(){var e=0;A=[],i(["thead","tbody","tfoot"],function(t){var n=L.select("> "+t+" tr",a);i(n,function(n,o){o+=e,i(L.select("> td, > th",n),function(e,n){var i,a,s,l;if(A[o])for(;A[o][n];)n++;for(s=r(e,"rowspan"),l=r(e,"colspan"),a=o;o+s>a;a++)for(A[a]||(A[a]=[]),i=n;n+l>i;i++)A[a][i]={part:t,real:a==o&&i==n,elm:e,rowspan:s,colspan:l}})}),e+=n.length})}function l(e,t){return e=e.cloneNode(t),e.removeAttribute("id"),e}function c(e,t){var n;return n=A[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&&(L.hasClass(e.elm,"mce-item-selected")||e==D)}function f(){var e=[];return i(a.rows,function(t){i(t.cells,function(n){return L.hasClass(n,"mce-item-selected")||D&&n==D.elm?(e.push(t),!1):void 0})}),e}function p(){var e=L.createRng();e.setStartAfter(a),e.setEndAfter(a),M.setRng(e),L.remove(a)}function m(t){var r,a={};return o.settings.table_clone_elements!==!1&&(a=e.makeMap((o.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 o;return 3==e.nodeType?(i(L.getParents(e.parentNode,null,t).reverse(),function(e){a[e.nodeName]&&(e=l(e,!1),r?o&&o.appendChild(e):r=o=e,o=e)}),o&&(o.innerHTML=n.ie?"&nbsp;":'<br data-mce-bogus="1" />'),!1):void 0},"childNodes"),t=l(t,!1),d(t,"rowSpan",1),d(t,"colSpan",1),r?t.appendChild(r):n.ie||(t.innerHTML='<br data-mce-bogus="1" />'),t}function h(){var e=L.createRng(),t;return i(L.select("tr",a),function(e){0===e.cells.length&&L.remove(e)}),0===L.select("tr",a).length?(e.setStartBefore(a),e.setEndBefore(a),M.setRng(e),void L.remove(a)):(i(L.select("thead,tbody,tfoot",a),function(e){0===e.rows.length&&L.remove(e)}),s(),void(B&&(t=A[Math.min(A.length-1,B.y)],t&&(M.select(t[Math.min(t.length-1,B.x)].elm,!0),M.collapse(!0)))))}function g(e,t,n,r){var i,o,a,s,l;for(i=A[t][e].elm.parentNode,a=1;n>=a;a++)if(i=L.getNext(i,"tr")){for(o=e;o>=0;o--)if(l=A[t+a][o].elm,l.parentNode==i){for(s=1;r>=s;s++)L.insertAfter(m(l),l);break}if(-1==o)for(s=1;r>=s;s++)i.insertBefore(m(i.cells[0]),i.cells[0])}}function v(){i(A,function(e,t){i(e,function(e,n){var i,o,a;if(u(e)&&(e=e.elm,i=r(e,"colspan"),o=r(e,"rowspan"),i>1||o>1)){for(d(e,"rowSpan",1),d(e,"colSpan",1),a=0;i-1>a;a++)L.insertAfter(m(e),e);g(n,t,o-1,i)}})})}function y(t,n,r){var o,a,l,f,p,m,g,y,b,C,x;if(t?(o=S(t),a=o.x,l=o.y,f=a+(n-1),p=l+(r-1)):(B=P=null,i(A,function(e,t){i(e,function(e,n){u(e)&&(B||(B={x:n,y:t}),P={x:n,y:t})})}),B&&(a=B.x,l=B.y,f=P.x,p=P.y)),y=c(a,l),b=c(f,p),y&&b&&y.part==b.part){for(v(),s(),y=c(a,l).elm,d(y,"colSpan",f-a+1),d(y,"rowSpan",p-l+1),g=l;p>=g;g++)for(m=a;f>=m;m++)A[g]&&A[g][m]&&(t=A[g][m].elm,t!=y&&(C=e.grep(t.childNodes),i(C,function(e){y.appendChild(e)}),C.length&&(C=e.grep(y.childNodes),x=0,i(C,function(e){"BR"==e.nodeName&&L.getAttrib(e,"data-mce-bogus")&&x++<C.length-1&&y.removeChild(e)})),L.remove(t)));h()}}function b(e){var n,o,a,s,c,f,p,h,g;if(i(A,function(t,r){return i(t,function(t){return u(t)&&(t=t.elm,c=t.parentNode,f=l(c,!1),n=r,e)?!1:void 0}),e?!n:void 0}),n!==t){for(s=0;s<A[0].length;s++)if(A[n][s]&&(o=A[n][s].elm,o!=a)){if(e){if(n>0&&A[n-1][s]&&(h=A[n-1][s].elm,g=r(h,"rowSpan"),g>1)){d(h,"rowSpan",g+1);continue}}else if(g=r(o,"rowspan"),g>1){d(o,"rowSpan",g+1);continue}p=m(o),d(p,"colSpan",o.colSpan),f.appendChild(p),a=o}f.hasChildNodes()&&(e?c.parentNode.insertBefore(f,c):L.insertAfter(f,c))}}function C(e){var t,n;i(A,function(n){return i(n,function(n,r){return u(n)&&(t=r,e)?!1:void 0}),e?!t:void 0}),i(A,function(i,o){var a,s,l;i[t]&&(a=i[t].elm,a!=n&&(l=r(a,"colspan"),s=r(a,"rowspan"),1==l?e?(a.parentNode.insertBefore(m(a),a),g(t,o,s-1,l)):(L.insertAfter(m(a),a),g(t,o,s-1,l)):d(a,"colSpan",a.colSpan+1),n=a))})}function x(){var t=[];i(A,function(n){i(n,function(n,o){u(n)&&-1===e.inArray(t,o)&&(i(A,function(e){var t=e[o].elm,n;n=r(t,"colSpan"),n>1?d(t,"colSpan",n-1):L.remove(t)}),t.push(o))})}),h()}function w(){function e(e){var t,n,o;t=L.getNext(e,"tr"),i(e.cells,function(e){var t=r(e,"rowSpan");t>1&&(d(e,"rowSpan",t-1),n=S(e),g(n.x,n.y,1,1))}),n=S(e.cells[0]),i(A[n.y],function(e){var t;e=e.elm,e!=o&&(t=r(e,"rowSpan"),1>=t?L.remove(e):d(e,"rowSpan",t-1),o=e)})}var t;t=f(),i(t.reverse(),function(t){e(t)}),h()}function _(){var e=f();return L.remove(e),h(),e}function N(){var e=f();return i(e,function(t,n){e[n]=l(t,!0)}),e}function E(e,t){var n=f(),r=n[t?0:n.length-1],o=r.cells.length;e&&(i(A,function(e){var t;return o=0,i(e,function(e){e.real&&(o+=e.colspan),e.elm.parentNode==r&&(t=1)}),t?!1:void 0}),t||e.reverse(),i(e,function(e){var n,i=e.cells.length,a;for(n=0;i>n;n++)a=e.cells[n],d(a,"colSpan",1),d(a,"rowSpan",1);for(n=i;o>n;n++)e.appendChild(m(e.cells[i-1]));for(n=o;i>n;n++)L.remove(e.cells[n]);t?r.parentNode.insertBefore(e,r):L.insertAfter(e,r)}),L.removeClass(L.select("td.mce-item-selected,th.mce-item-selected"),"mce-item-selected"))}function S(e){var t;return i(A,function(n,r){return i(n,function(n,i){return n.elm==e?(t={x:i,y:r},!1):void 0}),!t}),t}function k(e){B=S(e)}function T(){var e,t;return e=t=0,i(A,function(n,r){i(n,function(n,i){var o,a;u(n)&&(n=A[r][i],i>e&&(e=i),r>t&&(t=r),n.real&&(o=n.colspan-1,a=n.rowspan-1,o&&i+o>e&&(e=i+o),a&&r+a>t&&(t=r+a)))})}),{x:e,y:t}}function R(e){var t,n,r,i,o,a,s,l,c,d;if(P=S(e),B&&P){for(t=Math.min(B.x,P.x),n=Math.min(B.y,P.y),r=Math.max(B.x,P.x),i=Math.max(B.y,P.y),o=r,a=i,d=n;a>=d;d++)e=A[d][t],e.real||t-(e.colspan-1)<t&&(t-=e.colspan-1);for(c=t;o>=c;c++)e=A[n][c],e.real||n-(e.rowspan-1)<n&&(n-=e.rowspan-1);for(d=n;i>=d;d++)for(c=t;r>=c;c++)e=A[d][c],e.real&&(s=e.colspan-1,l=e.rowspan-1,s&&c+s>o&&(o=c+s),l&&d+l>a&&(a=d+l));for(L.removeClass(L.select("td.mce-item-selected,th.mce-item-selected"),"mce-item-selected"),d=n;a>=d;d++)for(c=t;o>=c;c++)A[d][c]&&L.addClass(A[d][c].elm,"mce-item-selected")}}var A,B,P,D,M=o.selection,L=M.dom;a=a||L.getParent(M.getStart(),"table"),s(),D=L.getParent(M.getStart(),"th,td"),D&&(B=S(D),P=T(),D=c(B.x,B.y)),e.extend(this,{deleteTable:p,split:v,merge:y,insertRow:b,insertCol:C,deleteCols:x,deleteRows:w,cutRows:_,copyRows:N,pasteRows:E,getPos:S,setStartCell:k,setEndCell:R})}}),r(u,[f,d,c],function(e,t,n){function r(e,t){return parseInt(e.getAttribute(t)||1,10)}var i=n.each;return function(n){function o(){function t(t){function o(e,r){var i=e?"previousSibling":"nextSibling",o=n.dom.getParent(r,"tr"),s=o[i];if(s)return g(n,r,s,e),t.preventDefault(),!0;var d=n.dom.getParent(o,"table"),u=o.parentNode,f=u.nodeName.toLowerCase();if("tbody"===f||f===(e?"tfoot":"thead")){var p=a(e,d,u,"tbody");if(null!==p)return l(e,p,r)}return c(e,o,i,d)}function a(e,t,r,i){var o=n.dom.select(">"+i,t),a=o.indexOf(r);if(e&&0===a||!e&&a===o.length-1)return s(e,t);if(-1===a){var l="thead"===r.tagName.toLowerCase()?0:o.length-1;return o[l]}return o[a+(e?-1:1)]}function s(e,t){var r=e?"thead":"tfoot",i=n.dom.select(">"+r,t);return 0!==i.length?i[0]:null}function l(e,r,i){var o=d(r,e);return o&&g(n,i,o,e),t.preventDefault(),!0}function c(e,r,i,a){var s=a[i];if(s)return u(s),!0;var l=n.dom.getParent(a,"td,th");if(l)return o(e,l,t);var c=d(r,!e);return u(c),t.preventDefault(),!1}function d(e,t){var r=e&&e[t?"lastChild":"firstChild"];return r&&"BR"===r.nodeName?n.dom.getParent(r,"td,th"):r}function u(e){n.selection.setCursorLocation(e,0)}function f(){return b==e.UP||b==e.DOWN}function p(e){var t=e.selection.getNode(),n=e.dom.getParent(t,"tr");return null!==n}function m(e){for(var t=0,n=e;n.previousSibling;)n=n.previousSibling,t+=r(n,"colspan");return t}function h(e,t){var n=0,o=0;return i(e.children,function(e,i){return n+=r(e,"colspan"),o=i,n>t?!1:void 0}),o}function g(e,t,r,i){var o=m(n.dom.getParent(t,"td,th")),a=h(r,o),s=r.childNodes[a],l=d(s,i);u(l||s)}function v(e){var t=n.selection.getNode(),r=n.dom.getParent(t,"td,th"),i=n.dom.getParent(e,"td,th");return r&&r!==i&&y(r,i)}function y(e,t){return n.dom.getParent(e,"TABLE")===n.dom.getParent(t,"TABLE")}var b=t.keyCode;if(f()&&p(n)){var C=n.selection.getNode();setTimeout(function(){v(C)&&o(!t.shiftKey&&b===e.UP,C,t)},0)}}n.on("KeyDown",function(e){t(e)})}function a(){function e(e,t){var n=t.ownerDocument,r=n.createRange(),i;return r.setStartBefore(t),r.setEnd(e.endContainer,e.endOffset),i=n.createElement("body"),i.appendChild(r.cloneContents()),0===i.innerHTML.replace(/<(br|img|object|embed|input|textarea)[^>]*>/gi,"-").replace(/<[^>]+>/g,"").length}n.on("KeyDown",function(t){var r,i,o=n.dom;(37==t.keyCode||38==t.keyCode)&&(r=n.selection.getRng(),i=o.getParent(r.startContainer,"table"),i&&n.getBody().firstChild==i&&e(r,i)&&(r=o.createRng(),r.setStartBefore(i),r.setEndBefore(i),n.selection.setRng(r),t.preventDefault()))})}function s(){n.on("KeyDown SetContent VisualAid",function(){var e;for(e=n.getBody().lastChild;e;e=e.previousSibling)if(3==e.nodeType){if(e.nodeValue.length>0)break}else if(1==e.nodeType&&!e.getAttribute("data-mce-bogus"))break;e&&"TABLE"==e.nodeName&&(n.settings.forced_root_block?n.dom.add(n.getBody(),n.settings.forced_root_block,n.settings.forced_root_block_attrs,t.ie&&t.ie<11?"&nbsp;":'<br data-mce-bogus="1" />'):n.dom.add(n.getBody(),"br",{"data-mce-bogus":"1"}))}),n.on("PreProcess",function(e){var t=e.node.lastChild;t&&("BR"==t.nodeName||1==t.childNodes.length&&("BR"==t.firstChild.nodeName||"\xa0"==t.firstChild.nodeValue))&&t.previousSibling&&"TABLE"==t.previousSibling.nodeName&&n.dom.remove(t)})}function l(){function e(e,t,n,r){var i=3,o=e.dom.getParent(t.startContainer,"TABLE"),a,s,l;return o&&(a=o.parentNode),s=t.startContainer.nodeType==i&&0===t.startOffset&&0===t.endOffset&&r&&("TR"==n.nodeName||n==a),l=("TD"==n.nodeName||"TH"==n.nodeName)&&!r,s||l}function t(){var t=n.selection.getRng(),r=n.selection.getNode(),i=n.dom.getParent(t.startContainer,"TD,TH");if(e(n,t,r,i)){i||(i=r);for(var o=i.lastChild;o.lastChild;)o=o.lastChild;t.setEnd(o,o.nodeValue.length),n.selection.setRng(t)}}n.on("KeyDown",function(){t()}),n.on("MouseDown",function(e){2!=e.button&&t()})}function c(){n.on("keydown",function(t){if((t.keyCode==e.DELETE||t.keyCode==e.BACKSPACE)&&!t.isDefaultPrevented()){var r=n.dom.getParent(n.selection.getStart(),"table");if(r){for(var i=n.dom.select("td,th",r),o=i.length;o--;)if(!n.dom.hasClass(i[o],"mce-item-selected"))return;t.preventDefault(),n.execCommand("mceTableDelete")}}})}c(),t.webkit&&(o(),l()),t.gecko&&(a(),s()),t.ie>10&&(a(),s())}}),r(p,[l,m,c],function(e,t,n){return function(r){function i(){r.getBody().style.webkitUserSelect="",d&&(r.dom.removeClass(r.dom.select("td.mce-item-selected,th.mce-item-selected"),"mce-item-selected"),d=!1)}function o(t){var n,i,o=t.target;if(l&&(s||o!=l)&&("TD"==o.nodeName||"TH"==o.nodeName)){i=a.getParent(o,"table"),i==c&&(s||(s=new e(r,i),s.setStartCell(l),r.getBody().style.webkitUserSelect="none"),s.setEndCell(o),d=!0),n=r.selection.getSel();try{n.removeAllRanges?n.removeAllRanges():n.empty()}catch(u){}t.preventDefault()}}var a=r.dom,s,l,c,d=!0;return r.on("MouseDown",function(e){2!=e.button&&(i(),l=a.getParent(e.target,"td,th"),c=a.getParent(l,"table"))}),r.on("mouseover",o),r.on("remove",function(){a.unbind(r.getDoc(),"mouseover",o)}),r.on("MouseUp",function(){function e(e,r){var o=new t(e,e);do{if(3==e.nodeType&&0!==n.trim(e.nodeValue).length)return void(r?i.setStart(e,0):i.setEnd(e,e.nodeValue.length));if("BR"==e.nodeName)return void(r?i.setStartBefore(e):i.setEndBefore(e))}while(e=r?o.next():o.prev())}var i,o=r.selection,d,u,f,p,m;if(l){if(s&&(r.getBody().style.webkitUserSelect=""),d=a.select("td.mce-item-selected,th.mce-item-selected"),d.length>0){i=a.createRng(),f=d[0],m=d[d.length-1],i.setStartBefore(f),i.setEndAfter(f),e(f,1),u=new t(f,a.getParent(d[0],"table"));do if("TD"==f.nodeName||"TH"==f.nodeName){if(!a.hasClass(f,"mce-item-selected"))break;p=f}while(f=u.next());e(p),o.setRng(i)}r.nodeChanged(),l=s=c=null}}),r.on("KeyUp Drop",function(){i(),l=s=c=null}),{clear:i}}}),r(h,[l,u,p,c,m,d,g],function(e,t,n,r,i,o,a){function s(r){function i(e){return e?e.replace(/px$/,""):""}function a(e){return/^[0-9]+$/.test(e)&&(e+="px"),e}function s(e){l("left center right".split(" "),function(t){r.formatter.remove("align"+t,{},e)})}function c(e){l("top middle bottom".split(" "),function(t){r.formatter.remove("valign"+t,{},e)})}function d(){var e=r.dom,t,n,c,d;t=e.getParent(r.selection.getStart(),"table"),d={width:i(e.getStyle(t,"width")||e.getAttrib(t,"width")),height:i(e.getStyle(t,"height")||e.getAttrib(t,"height")),cellspacing:t?e.getAttrib(t,"cellspacing"):"",cellpadding:t?e.getAttrib(t,"cellpadding"):"",border:t?e.getAttrib(t,"border"):"",caption:!!e.select("caption",t)[0]},l("left center right".split(" "),function(e){r.formatter.matchNode(t,"align"+e)&&(d.align=e)}),t||(n={label:"Cols",name:"cols"},c={label:"Rows",name:"rows"}),r.windowManager.open({title:"Table properties",items:{type:"form",layout:"grid",columns:2,data:d,defaults:{type:"textbox",maxWidth:50},items:[n,c,{label:"Width",name:"width"},{label:"Height",name:"height"},{label:"Cell spacing",name:"cellspacing"},{label:"Cell padding",name:"cellpadding"},{label:"Border",name:"border"},{label:"Caption",name:"caption",type:"checkbox"},{label:"Alignment",minWidth:90,name:"align",type:"listbox",text:"None",maxWidth:null,values:[{text:"None",value:""},{text:"Left",value:"left"},{text:"Center",value:"center"},{text:"Right",value:"right"}]}]},onsubmit:function(){var n=this.toJSON(),i;r.undoManager.transact(function(){t||(t=h(n.cols||1,n.rows||1)),r.dom.setAttribs(t,{cellspacing:n.cellspacing,cellpadding:n.cellpadding,border:n.border}),r.dom.setStyles(t,{width:a(n.width),height:a(n.height)}),i=e.select("caption",t)[0],i&&!n.caption&&e.remove(i),!i&&n.caption&&(i=e.create("caption"),i.innerHTML=o.ie?"\xa0":'<br data-mce-bogus="1"/>',t.insertBefore(i,t.firstChild)),s(t),n.align&&r.formatter.apply("align"+n.align,{},t),r.focus(),r.addVisual()})}})}function u(e,t){r.windowManager.open({title:"Merge cells",body:[{label:"Cols",name:"cols",type:"textbox",size:10},{label:"Rows",name:"rows",type:"textbox",size:10}],onsubmit:function(){var n=this.toJSON();r.undoManager.transact(function(){e.merge(t,n.cols,n.rows)})}})}function f(){var e=r.dom,t,n,o=[];o=r.dom.select("td.mce-item-selected,th.mce-item-selected"),t=r.dom.getParent(r.selection.getStart(),"td,th"),!o.length&&t&&o.push(t),t=t||o[0],t&&(n={width:i(e.getStyle(t,"width")||e.getAttrib(t,"width")),height:i(e.getStyle(t,"height")||e.getAttrib(t,"height")),scope:e.getAttrib(t,"scope")},n.type=t.nodeName.toLowerCase(),l("left center right".split(" "),function(e){r.formatter.matchNode(t,"align"+e)&&(n.align=e)}),l("top middle bottom".split(" "),function(e){r.formatter.matchNode(t,"valign"+e)&&(n.valign=e)}),r.windowManager.open({title:"Cell properties",items:{type:"form",data:n,layout:"grid",columns:2,defaults:{type:"textbox",maxWidth:50},items:[{label:"Width",name:"width"},{label:"Height",name:"height"},{label:"Cell type",name:"type",type:"listbox",text:"None",minWidth:90,maxWidth:null,values:[{text:"Cell",value:"td"},{text:"Header cell",value:"th"}]},{label:"Scope",name:"scope",type:"listbox",text:"None",minWidth:90,maxWidth:null,values:[{text:"None",value:""},{text:"Row",value:"row"},{text:"Column",value:"col"},{text:"Row group",value:"rowgroup"},{text:"Column group",value:"colgroup"}]},{label:"H Align",name:"align",type:"listbox",text:"None",minWidth:90,maxWidth:null,values:[{text:"None",value:""},{text:"Left",value:"left"},{text:"Center",value:"center"},{text:"Right",value:"right"}]},{label:"V Align",name:"valign",type:"listbox",text:"None",minWidth:90,maxWidth:null,values:[{text:"None",value:""},{text:"Top",value:"top"},{text:"Middle",value:"middle"},{text:"Bottom",value:"bottom"}]}]},onsubmit:function(){var t=this.toJSON();r.undoManager.transact(function(){l(o,function(n){r.dom.setAttrib(n,"scope",t.scope),r.dom.setStyles(n,{width:a(t.width),height:a(t.height)}),t.type&&n.nodeName.toLowerCase()!=t.type&&(n=e.rename(n,t.type)),s(n),t.align&&r.formatter.apply("align"+t.align,{},n),c(n),t.valign&&r.formatter.apply("valign"+t.valign,{},n)}),r.focus()})}}))}function p(){var e=r.dom,t,n,o,c,d=[];t=r.dom.getParent(r.selection.getStart(),"table"),n=r.dom.getParent(r.selection.getStart(),"td,th"),l(t.rows,function(t){l(t.cells,function(r){return e.hasClass(r,"mce-item-selected")||r==n?(d.push(t),!1):void 0})}),o=d[0],o&&(c={height:i(e.getStyle(o,"height")||e.getAttrib(o,"height")),scope:e.getAttrib(o,"scope")},c.type=o.parentNode.nodeName.toLowerCase(),l("left center right".split(" "),function(e){r.formatter.matchNode(o,"align"+e)&&(c.align=e)}),r.windowManager.open({title:"Row properties",items:{type:"form",data:c,columns:2,defaults:{type:"textbox"},items:[{type:"listbox",name:"type",label:"Row type",text:"None",maxWidth:null,values:[{text:"Header",value:"thead"},{text:"Body",value:"tbody"},{text:"Footer",value:"tfoot"}]},{type:"listbox",name:"align",label:"Alignment",text:"None",maxWidth:null,values:[{text:"None",value:""},{text:"Left",value:"left"},{text:"Center",value:"center"},{text:"Right",value:"right"}]},{label:"Height",name:"height"}]},onsubmit:function(){var t=this.toJSON(),n,i,o;r.undoManager.transact(function(){var c=t.type;l(d,function(l){r.dom.setAttrib(l,"scope",t.scope),r.dom.setStyles(l,{height:a(t.height)}),c!=l.parentNode.nodeName.toLowerCase()&&(n=e.getParent(l,"table"),i=l.parentNode,o=e.select(c,n)[0],o||(o=e.create(c),n.firstChild?n.insertBefore(o,n.firstChild):n.appendChild(o)),o.appendChild(l),i.hasChildNodes()||e.remove(i)),s(l),t.align&&r.formatter.apply("align"+t.align,{},l)}),r.focus()})}}))}function m(e){return function(){r.execCommand(e)}}function h(e,t){var n,i,a;for(a='<table id="__mce"><tbody>',n=0;t>n;n++){for(a+="<tr>",i=0;e>i;i++)a+="<td>"+(o.ie?" ":"<br>")+"</td>";a+="</tr>"}a+="</tbody></table>",r.insertContent(a);var s=r.dom.get("__mce");return r.dom.setAttrib(s,"id",null),s}function g(e,t){function n(){e.disabled(!r.dom.getParent(r.selection.getStart(),t)),r.selection.selectorChanged(t,function(t){e.disabled(!t)})}r.initialized?n():r.on("init",n)}function v(){g(this,"table")}function y(){g(this,"td,th")}function b(){var e="";e='<table role="grid" class="mce-grid mce-grid-border" aria-readonly="true">';for(var t=0;10>t;t++){e+="<tr>";for(var n=0;10>n;n++)e+='<td role="gridcell" tabindex="-1"><a id="mcegrid'+(10*t+n)+'" href="#" data-mce-x="'+n+'" data-mce-y="'+t+'"></a></td>';e+="</tr>"}return e+="</table>",e+='<div class="mce-text-center" role="presentation">1 x 1</div>'}function C(e,t,n){var i=n.getEl().getElementsByTagName("table")[0],o,a,s,l,c,d=n.isRtl()||"tl-tr"==n.parent().rel;for(i.nextSibling.innerHTML=e+1+" x "+(t+1),d&&(e=9-e),a=0;10>a;a++)for(o=0;10>o;o++)l=i.rows[a].childNodes[o].firstChild,c=(d?o>=e:e>=o)&&t>=a,r.dom.toggleClass(l,"mce-active",c),c&&(s=l);return s.parentNode}var x,w,_=this;r.settings.table_grid===!1?r.addMenuItem("inserttable",{text:"Insert table",icon:"table",context:"table",onclick:d}):r.addMenuItem("inserttable",{text:"Insert table",icon:"table",context:"table",ariaHideMenu:!0,onclick:function(e){e.aria&&(this.parent().hideAll(),e.stopImmediatePropagation(),d())},onshow:function(){C(0,0,this.menu.items()[0])},onhide:function(){var e=this.menu.items()[0].getEl().getElementsByTagName("a");r.dom.removeClass(e,"mce-active"),r.dom.addClass(e[0],"mce-active")},menu:[{type:"container",html:b(),onPostRender:function(){this.lastX=this.lastY=0},onmousemove:function(e){var t=e.target,n,r;"A"==t.tagName.toUpperCase()&&(n=parseInt(t.getAttribute("data-mce-x"),10),r=parseInt(t.getAttribute("data-mce-y"),10),(this.isRtl()||"tl-tr"==this.parent().rel)&&(n=9-n),(n!==this.lastX||r!==this.lastY)&&(C(n,r,e.control),this.lastX=n,this.lastY=r))},onkeydown:function(e){var t=this.lastX,n=this.lastY,r;switch(e.keyCode){case 37:t>0&&(t--,r=!0);break;case 39:r=!0,9>t&&t++;break;case 38:r=!0,n>0&&n--;break;case 40:r=!0,9>n&&n++}r&&(e.preventDefault(),e.stopPropagation(),C(t,n,e.control).focus(),this.lastX=t,this.lastY=n)},onclick:function(e){"A"==e.target.tagName.toUpperCase()&&(e.preventDefault(),e.stopPropagation(),this.parent().cancel(),h(this.lastX+1,this.lastY+1))}}]}),r.addMenuItem("tableprops",{text:"Table properties",context:"table",onPostRender:v,onclick:d}),r.addMenuItem("deletetable",{text:"Delete table",context:"table",onPostRender:v,cmd:"mceTableDelete"}),r.addMenuItem("cell",{separator:"before",text:"Cell",context:"table",menu:[{text:"Cell properties",onclick:m("mceTableCellProps"),onPostRender:y},{text:"Merge cells",onclick:m("mceTableMergeCells"),onPostRender:y},{text:"Split cell",onclick:m("mceTableSplitCells"),onPostRender:y}]}),r.addMenuItem("row",{text:"Row",context:"table",menu:[{text:"Insert row before",onclick:m("mceTableInsertRowBefore"),onPostRender:y},{text:"Insert row after",onclick:m("mceTableInsertRowAfter"),onPostRender:y},{text:"Delete row",onclick:m("mceTableDeleteRow"),onPostRender:y},{text:"Row properties",onclick:m("mceTableRowProps"),onPostRender:y},{text:"-"},{text:"Cut row",onclick:m("mceTableCutRow"),onPostRender:y},{text:"Copy row",onclick:m("mceTableCopyRow"),onPostRender:y},{text:"Paste row before",onclick:m("mceTablePasteRowBefore"),onPostRender:y},{text:"Paste row after",onclick:m("mceTablePasteRowAfter"),onPostRender:y}]}),r.addMenuItem("column",{text:"Column",context:"table",menu:[{text:"Insert column before",onclick:m("mceTableInsertColBefore"),onPostRender:y},{text:"Insert column after",onclick:m("mceTableInsertColAfter"),onPostRender:y},{text:"Delete column",onclick:m("mceTableDeleteCol"),onPostRender:y}]});var N=[];l("inserttable tableprops deletetable | cell row column".split(" "),function(e){N.push("|"==e?{text:"-"}:r.menuItems[e])}),r.addButton("table",{type:"menubutton",title:"Table",menu:N}),o.isIE||r.on("click",function(e){e=e.target,"TABLE"===e.nodeName&&(r.selection.select(e),r.nodeChanged())}),_.quirks=new t(r),r.on("Init",function(){x=r.windowManager,_.cellSelection=new n(r)}),l({mceTableSplitCells:function(e){e.split()},mceTableMergeCells:function(e){var t,n,i;i=r.dom.getParent(r.selection.getStart(),"th,td"),i&&(t=i.rowSpan,n=i.colSpan),r.dom.select("td.mce-item-selected,th.mce-item-selected").length?e.merge():u(e,i)},mceTableInsertRowBefore:function(e){e.insertRow(!0)},mceTableInsertRowAfter:function(e){e.insertRow()},mceTableInsertColBefore:function(e){e.insertCol(!0)},mceTableInsertColAfter:function(e){e.insertCol()},mceTableDeleteCol:function(e){e.deleteCols()},mceTableDeleteRow:function(e){e.deleteRows()},mceTableCutRow:function(e){w=e.cutRows()},mceTableCopyRow:function(e){w=e.copyRows()},mceTablePasteRowBefore:function(e){e.pasteRows(w,!0)},mceTablePasteRowAfter:function(e){e.pasteRows(w)},mceTableDelete:function(e){e.deleteTable()}},function(t,n){r.addCommand(n,function(){var n=new e(r);n&&(t(n),r.execCommand("mceRepaint"),_.cellSelection.clear())})}),l({mceInsertTable:function(){d()},mceTableRowProps:p,mceTableCellProps:f},function(e,t){r.addCommand(t,function(t,n){e(n)})})}var l=r.each;a.add("table",s)}),a([l,u,p,h])}(this); \ No newline at end of file
+!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.remove(t)));p()}}function x(e){var n,l,r,i,c,m,f,p,h;if(a(M,function(t,o){return a(t,function(t){return u(t)&&(t=t.elm,c=t.parentNode,m=s(c,!1),n=o,e)?!1:void 0}),e?!n:void 0}),n!==t){for(i=0;i<M[0].length;i++)if(M[n][i]&&(l=M[n][i].elm,l!=r)){if(e){if(n>0&&M[n-1][i]&&(p=M[n-1][i].elm,h=o(p,"rowSpan"),h>1)){d(p,"rowSpan",h+1);continue}}else if(h=o(l,"rowspan"),h>1){d(l,"rowSpan",h+1);continue}f=g(l),d(f,"colSpan",l.colSpan),m.appendChild(f),r=l}m.hasChildNodes()&&(e?c.parentNode.insertBefore(m,c):H.insertAfter(m,c))}}function y(e){var t,n;a(M,function(n){return a(n,function(n,o){return u(n)&&(t=o,e)?!1:void 0}),e?!t:void 0}),a(M,function(a,l){var r,i,s;a[t]&&(r=a[t].elm,r!=n&&(s=o(r,"colspan"),i=o(r,"rowspan"),1==s?e?(r.parentNode.insertBefore(g(r),r),h(t,l,i-1,s)):(H.insertAfter(g(r),r),h(t,l,i-1,s)):d(r,"colSpan",r.colSpan+1),n=r))})}function w(){var t=[];a(M,function(n){a(n,function(n,l){u(n)&&-1===e.inArray(t,l)&&(a(M,function(e){var t=e[l].elm,n;n=o(t,"colSpan"),n>1?d(t,"colSpan",n-1):H.remove(t)}),t.push(l))})}),p()}function C(){function e(e){var t,n;a(e.cells,function(e){var n=o(e,"rowSpan");n>1&&(d(e,"rowSpan",n-1),t=T(e),h(t.x,t.y,1,1))}),t=T(e.cells[0]),a(M[t.y],function(e){var t;e=e.elm,e!=n&&(t=o(e,"rowSpan"),1>=t?H.remove(e):d(e,"rowSpan",t-1),n=e)})}var t;t=m(),a(t.reverse(),function(t){e(t)}),p()}function R(){var e=m();return H.remove(e),p(),e}function N(){var e=m();return a(e,function(t,n){e[n]=s(t,!0)}),e}function S(e,t){var n=m(),o=n[t?0:n.length-1],l=o.cells.length;e&&(a(M,function(e){var t;return l=0,a(e,function(e){e.real&&(l+=e.colspan),e.elm.parentNode==o&&(t=1)}),t?!1:void 0}),t||e.reverse(),a(e,function(e){var n,a=e.cells.length,r;for(n=0;a>n;n++)r=e.cells[n],d(r,"colSpan",1),d(r,"rowSpan",1);for(n=a;l>n;n++)e.appendChild(g(e.cells[a-1]));for(n=l;a>n;n++)H.remove(e.cells[n]);t?o.parentNode.insertBefore(e,o):H.insertAfter(e,o)}),H.removeClass(H.select("td.mce-item-selected,th.mce-item-selected"),"mce-item-selected"))}function T(e){var t;return a(M,function(n,o){return a(n,function(n,a){return n.elm==e?(t={x:a,y:o},!1):void 0}),!t}),t}function P(e){D=T(e)}function A(){var e,t;return e=t=0,a(M,function(n,o){a(n,function(n,a){var l,r;u(n)&&(n=M[o][a],a>e&&(e=a),o>t&&(t=o),n.real&&(l=n.colspan-1,r=n.rowspan-1,l&&a+l>e&&(e=a+l),r&&o+r>t&&(t=o+r)))})}),{x:e,y:t}}function k(e){var t,n,o,a,l,r,i,s,c,d;if(I=T(e),D&&I){for(t=Math.min(D.x,I.x),n=Math.min(D.y,I.y),o=Math.max(D.x,I.x),a=Math.max(D.y,I.y),l=o,r=a,d=n;r>=d;d++)e=M[d][t],e.real||t-(e.colspan-1)<t&&(t-=e.colspan-1);for(c=t;l>=c;c++)e=M[n][c],e.real||n-(e.rowspan-1)<n&&(n-=e.rowspan-1);for(d=n;a>=d;d++)for(c=t;o>=c;c++)e=M[d][c],e.real&&(i=e.colspan-1,s=e.rowspan-1,i&&c+i>l&&(l=c+i),s&&d+s>r&&(r=d+s));for(H.removeClass(H.select("td.mce-item-selected,th.mce-item-selected"),"mce-item-selected"),d=n;r>=d;d++)for(c=t;l>=c;c++)M[d][c]&&H.addClass(M[d][c].elm,"mce-item-selected")}}function B(e,t){var n,o,a;n=T(e),o=n.y*_+n.x;do{if(o+=t,a=c(o%_,Math.floor(o/_)),!a)break;if(a.elm!=e)return L.select(a.elm,!0),H.isEmpty(a.elm)&&L.collapse(!0),!0}while(a.elm==e);return!1}var M,_,D,I,E,L=l.selection,H=L.dom;r=r||H.getParent(L.getStart(),"table"),i(),E=H.getParent(L.getStart(),"th,td"),E&&(D=T(E),I=A(),E=c(D.x,D.y)),e.extend(this,{deleteTable:f,split:b,merge:v,insertRow:x,insertCol:y,deleteCols:w,deleteRows:C,cutRows:R,copyRows:N,pasteRows:S,getPos:T,setStartCell:P,setEndCell:k,moveRelIdx:B,refresh:i})}}),o(u,[m,d,c],function(e,t,n){function o(e,t){return parseInt(e.getAttribute(t)||1,10)}var a=n.each;return function(n){function l(){function t(t){function l(e,o){var a=e?"previousSibling":"nextSibling",l=n.dom.getParent(o,"tr"),i=l[a];if(i)return h(n,o,i,e),t.preventDefault(),!0;var d=n.dom.getParent(l,"table"),u=l.parentNode,m=u.nodeName.toLowerCase();if("tbody"===m||m===(e?"tfoot":"thead")){var f=r(e,d,u,"tbody");if(null!==f)return s(e,f,o)}return c(e,l,a,d)}function r(e,t,o,a){var l=n.dom.select(">"+a,t),r=l.indexOf(o);if(e&&0===r||!e&&r===l.length-1)return i(e,t);if(-1===r){var s="thead"===o.tagName.toLowerCase()?0:l.length-1;return l[s]}return l[r+(e?-1:1)]}function i(e,t){var o=e?"thead":"tfoot",a=n.dom.select(">"+o,t);return 0!==a.length?a[0]:null}function s(e,o,a){var l=d(o,e);return l&&h(n,a,l,e),t.preventDefault(),!0}function c(e,o,a,r){var i=r[a];if(i)return u(i),!0;var s=n.dom.getParent(r,"td,th");if(s)return l(e,s,t);var c=d(o,!e);return u(c),t.preventDefault(),!1}function d(e,t){var o=e&&e[t?"lastChild":"firstChild"];return o&&"BR"===o.nodeName?n.dom.getParent(o,"td,th"):o}function u(e){n.selection.setCursorLocation(e,0)}function m(){return x==e.UP||x==e.DOWN}function f(e){var t=e.selection.getNode(),n=e.dom.getParent(t,"tr");return null!==n}function g(e){for(var t=0,n=e;n.previousSibling;)n=n.previousSibling,t+=o(n,"colspan");return t}function p(e,t){var n=0,l=0;return a(e.children,function(e,a){return n+=o(e,"colspan"),l=a,n>t?!1:void 0}),l}function h(e,t,o,a){var l=g(n.dom.getParent(t,"td,th")),r=p(o,l),i=o.childNodes[r],s=d(i,a);u(s||i)}function b(e){var t=n.selection.getNode(),o=n.dom.getParent(t,"td,th"),a=n.dom.getParent(e,"td,th");return o&&o!==a&&v(o,a)}function v(e,t){return n.dom.getParent(e,"TABLE")===n.dom.getParent(t,"TABLE")}var x=t.keyCode;if(m()&&f(n)){var y=n.selection.getNode();setTimeout(function(){b(y)&&l(!t.shiftKey&&x===e.UP,y,t)},0)}}n.on("KeyDown",function(e){t(e)})}function r(){function e(e,t){var n=t.ownerDocument,o=n.createRange(),a;return o.setStartBefore(t),o.setEnd(e.endContainer,e.endOffset),a=n.createElement("body"),a.appendChild(o.cloneContents()),0===a.innerHTML.replace(/<(br|img|object|embed|input|textarea)[^>]*>/gi,"-").replace(/<[^>]+>/g,"").length}n.on("KeyDown",function(t){var o,a,l=n.dom;(37==t.keyCode||38==t.keyCode)&&(o=n.selection.getRng(),a=l.getParent(o.startContainer,"table"),a&&n.getBody().firstChild==a&&e(o,a)&&(o=l.createRng(),o.setStartBefore(a),o.setEndBefore(a),n.selection.setRng(o),t.preventDefault()))})}function i(){n.on("KeyDown SetContent VisualAid",function(){var e;for(e=n.getBody().lastChild;e;e=e.previousSibling)if(3==e.nodeType){if(e.nodeValue.length>0)break}else if(1==e.nodeType&&("BR"==e.tagName||!e.getAttribute("data-mce-bogus")))break;e&&"TABLE"==e.nodeName&&(n.settings.forced_root_block?n.dom.add(n.getBody(),n.settings.forced_root_block,n.settings.forced_root_block_attrs,t.ie&&t.ie<11?"&nbsp;":'<br data-mce-bogus="1" />'):n.dom.add(n.getBody(),"br",{"data-mce-bogus":"1"}))}),n.on("PreProcess",function(e){var t=e.node.lastChild;t&&("BR"==t.nodeName||1==t.childNodes.length&&("BR"==t.firstChild.nodeName||"\xa0"==t.firstChild.nodeValue))&&t.previousSibling&&"TABLE"==t.previousSibling.nodeName&&n.dom.remove(t)})}function s(){function e(e,t,n,o){var a=3,l=e.dom.getParent(t.startContainer,"TABLE"),r,i,s;return l&&(r=l.parentNode),i=t.startContainer.nodeType==a&&0===t.startOffset&&0===t.endOffset&&o&&("TR"==n.nodeName||n==r),s=("TD"==n.nodeName||"TH"==n.nodeName)&&!o,i||s}function t(){var t=n.selection.getRng(),o=n.selection.getNode(),a=n.dom.getParent(t.startContainer,"TD,TH");if(e(n,t,o,a)){a||(a=o);for(var l=a.lastChild;l.lastChild;)l=l.lastChild;3==l.nodeType&&(t.setEnd(l,l.data.length),n.selection.setRng(t))}}n.on("KeyDown",function(){t()}),n.on("MouseDown",function(e){2!=e.button&&t()})}function c(){n.on("keydown",function(t){if((t.keyCode==e.DELETE||t.keyCode==e.BACKSPACE)&&!t.isDefaultPrevented()){var o=n.dom.getParent(n.selection.getStart(),"table");if(o){for(var a=n.dom.select("td,th",o),l=a.length;l--;)if(!n.dom.hasClass(a[l],"mce-item-selected"))return;t.preventDefault(),n.execCommand("mceTableDelete")}}})}c(),t.webkit&&(l(),s()),t.gecko&&(r(),i()),t.ie>10&&(r(),i())}}),o(f,[s,g,c],function(e,t,n){return function(o){function a(){o.getBody().style.webkitUserSelect="",d&&(o.dom.removeClass(o.dom.select("td.mce-item-selected,th.mce-item-selected"),"mce-item-selected"),d=!1)}function l(t){var n,a,l=t.target;if(s&&(i||l!=s)&&("TD"==l.nodeName||"TH"==l.nodeName)){a=r.getParent(l,"table"),a==c&&(i||(i=new e(o,a),i.setStartCell(s),o.getBody().style.webkitUserSelect="none"),i.setEndCell(l),d=!0),n=o.selection.getSel();try{n.removeAllRanges?n.removeAllRanges():n.empty()}catch(u){}t.preventDefault()}}var r=o.dom,i,s,c,d=!0;return o.on("MouseDown",function(e){2!=e.button&&(a(),s=r.getParent(e.target,"td,th"),c=r.getParent(s,"table"))}),o.on("mouseover",l),o.on("remove",function(){r.unbind(o.getDoc(),"mouseover",l)}),o.on("MouseUp",function(){function e(e,o){var l=new t(e,e);do{if(3==e.nodeType&&0!==n.trim(e.nodeValue).length)return void(o?a.setStart(e,0):a.setEnd(e,e.nodeValue.length));if("BR"==e.nodeName)return void(o?a.setStartBefore(e):a.setEndBefore(e))}while(e=o?l.next():l.prev())}var a,l=o.selection,d,u,m,f;if(s){if(i&&(o.getBody().style.webkitUserSelect=""),d=r.select("td.mce-item-selected,th.mce-item-selected"),d.length>0){a=r.createRng(),m=d[0],a.setStartBefore(m),a.setEndAfter(m),e(m,1),u=new t(m,r.getParent(d[0],"table"));do if("TD"==m.nodeName||"TH"==m.nodeName){if(!r.hasClass(m,"mce-item-selected"))break;f=m}while(m=u.next());e(f),l.setRng(a)}o.nodeChanged(),s=i=c=null}}),o.on("KeyUp Drop",function(){a(),s=i=c=null}),{clear:a}}}),o(p,[s,u,f,c,g,d,h],function(e,t,n,o,a,l,r){function i(a){function r(e){return e?e.replace(/px$/,""):""}function i(e){return/^[0-9]+$/.test(e)&&(e+="px"),e}function c(e){s("left center right".split(" "),function(t){a.formatter.remove("align"+t,{},e)})}function d(e){s("top middle bottom".split(" "),function(t){a.formatter.remove("valign"+t,{},e)})}function u(e,t){return o.each(t,function(t){t.textStyle=function(){return a.formatter.getCssText({block:e,classes:[t.value]})}}),t}function m(e,t,n,l){var r,i=[];return o.each(a.settings[t]||l,function(t){var o={text:t.text||t.title,value:t.value};i.push(o),(e[n]===t.value||!r&&t.selected)&&(r=o)}),r&&(e[n]=r.value,r.selected=!0),i}function f(){var e=a.dom,t,n,d,f,g;t=e.getParent(a.selection.getStart(),"table"),g={width:r(e.getStyle(t,"width")||e.getAttrib(t,"width")),height:r(e.getStyle(t,"height")||e.getAttrib(t,"height")),cellspacing:t?e.getAttrib(t,"cellspacing"):"",cellpadding:t?e.getAttrib(t,"cellpadding"):"",border:t?e.getAttrib(t,"border"):"",caption:!!e.select("caption",t)[0],"class":e.getAttrib(t,"class")},s("left center right".split(" "),function(e){a.formatter.matchNode(t,"align"+e)&&(g.align=e)}),t||(n={label:"Cols",name:"cols"},d={label:"Rows",name:"rows"}),a.settings.table_class_list&&(g["class"]&&(g["class"]=g["class"].replace(/\s*mce\-item\-table\s*/g,"")),f={name:"class",type:"listbox",label:"Class",values:u("table",m(g,"table_class_list","class"))}),a.windowManager.open({title:"Table properties",items:{type:"form",layout:"flex",direction:"column",labelGapCalc:"children",items:[{type:"form",labelGapCalc:!1,padding:0,layout:"grid",columns:2,data:g,defaults:{type:"textbox",maxWidth:50},items:[n,d,{label:"Width",name:"width"},{label:"Height",name:"height"},{label:"Cell spacing",name:"cellspacing"},{label:"Cell padding",name:"cellpadding"},{label:"Border",name:"border"},{label:"Caption",name:"caption",type:"checkbox"}]},{label:"Alignment",name:"align",type:"listbox",text:"None",values:[{text:"None",value:""},{text:"Left",value:"left"},{text:"Center",value:"center"},{text:"Right",value:"right"}]},f]},onsubmit:function(){var n;g=o.extend(g,this.toJSON()),a.undoManager.transact(function(){t||(t=v(g.cols||1,g.rows||1)),a.dom.setAttribs(t,{cellspacing:g.cellspacing,cellpadding:g.cellpadding,border:g.border,"class":g["class"]}),a.dom.setStyles(t,{width:i(g.width),height:i(g.height)}),n=e.select("caption",t)[0],n&&!g.caption&&e.remove(n),!n&&g.caption&&(n=e.create("caption"),n.innerHTML=l.ie?"\xa0":'<br data-mce-bogus="1"/>',t.insertBefore(n,t.firstChild)),c(t),g.align&&a.formatter.apply("align"+g.align,{},t),a.focus(),a.addVisual()})}})}function g(e,t){a.windowManager.open({title:"Merge cells",body:[{label:"Cols",name:"cols",type:"textbox",value:"1",size:10},{label:"Rows",name:"rows",type:"textbox",value:"1",size:10}],onsubmit:function(){var n=this.toJSON();a.undoManager.transact(function(){e.merge(t,n.cols,n.rows)})}})}function p(){var e=a.dom,t,n,l,f=[];f=a.dom.select("td.mce-item-selected,th.mce-item-selected"),t=a.dom.getParent(a.selection.getStart(),"td,th"),!f.length&&t&&f.push(t),t=t||f[0],t&&(n={width:r(e.getStyle(t,"width")||e.getAttrib(t,"width")),height:r(e.getStyle(t,"height")||e.getAttrib(t,"height")),scope:e.getAttrib(t,"scope"),"class":e.getAttrib(t,"class")},n.type=t.nodeName.toLowerCase(),s("left center right".split(" "),function(e){a.formatter.matchNode(t,"align"+e)&&(n.align=e)}),s("top middle bottom".split(" "),function(e){a.formatter.matchNode(t,"valign"+e)&&(n.valign=e)}),a.settings.table_cell_class_list&&(l={name:"class",type:"listbox",label:"Class",values:u("td",m(n,"table_cell_class_list","class"))}),a.windowManager.open({title:"Cell properties",items:{type:"form",layout:"flex",direction:"column",labelGapCalc:"children",items:[{type:"form",data:n,layout:"grid",columns:2,labelGapCalc:!1,padding:0,defaults:{type:"textbox",maxWidth:50},items:[{label:"Width",name:"width"},{label:"Height",name:"height"},{label:"Cell type",name:"type",type:"listbox",text:"None",minWidth:90,maxWidth:null,values:[{text:"Cell",value:"td"},{text:"Header cell",value:"th"}]},{label:"Scope",name:"scope",type:"listbox",text:"None",minWidth:90,maxWidth:null,values:[{text:"None",value:""},{text:"Row",value:"row"},{text:"Column",value:"col"},{text:"Row group",value:"rowgroup"},{text:"Column group",value:"colgroup"}]},{label:"H Align",name:"align",type:"listbox",text:"None",minWidth:90,maxWidth:null,values:[{text:"None",value:""},{text:"Left",value:"left"},{text:"Center",value:"center"},{text:"Right",value:"right"}]},{label:"V Align",name:"valign",type:"listbox",text:"None",minWidth:90,maxWidth:null,values:[{text:"None",value:""},{text:"Top",value:"top"},{text:"Middle",value:"middle"},{text:"Bottom",value:"bottom"}]}]},l]},onsubmit:function(){n=o.extend(n,this.toJSON()),a.undoManager.transact(function(){s(f,function(t){a.dom.setAttribs(t,{scope:n.scope,"class":n["class"]}),a.dom.setStyles(t,{width:i(n.width),height:i(n.height)}),n.type&&t.nodeName.toLowerCase()!=n.type&&(t=e.rename(t,n.type)),c(t),n.align&&a.formatter.apply("align"+n.align,{},t),d(t),n.valign&&a.formatter.apply("valign"+n.valign,{},t)}),a.focus()})}}))}function h(){var e=a.dom,t,n,l,d,f,g=[];t=a.dom.getParent(a.selection.getStart(),"table"),n=a.dom.getParent(a.selection.getStart(),"td,th"),s(t.rows,function(t){s(t.cells,function(o){return e.hasClass(o,"mce-item-selected")||o==n?(g.push(t),!1):void 0})}),l=g[0],l&&(f={height:r(e.getStyle(l,"height")||e.getAttrib(l,"height")),scope:e.getAttrib(l,"scope"),"class":e.getAttrib(l,"class")},f.type=l.parentNode.nodeName.toLowerCase(),s("left center right".split(" "),function(e){a.formatter.matchNode(l,"align"+e)&&(f.align=e)}),a.settings.table_row_class_list&&(d={name:"class",type:"listbox",label:"Class",values:u("tr",m(f,"table_row_class_list","class"))}),a.windowManager.open({title:"Row properties",items:{type:"form",data:f,columns:2,defaults:{type:"textbox"},items:[{type:"listbox",name:"type",label:"Row type",text:"None",maxWidth:null,values:[{text:"Header",value:"thead"},{text:"Body",value:"tbody"},{text:"Footer",value:"tfoot"}]},{type:"listbox",name:"align",label:"Alignment",text:"None",maxWidth:null,values:[{text:"None",value:""},{text:"Left",value:"left"},{text:"Center",value:"center"},{text:"Right",value:"right"}]},{label:"Height",name:"height"},d]},onsubmit:function(){var t,n,l;f=o.extend(f,this.toJSON()),a.undoManager.transact(function(){var o=f.type;s(g,function(r){a.dom.setAttribs(r,{scope:f.scope,"class":f["class"]}),a.dom.setStyles(r,{height:i(f.height)}),o!=r.parentNode.nodeName.toLowerCase()&&(t=e.getParent(r,"table"),n=r.parentNode,l=e.select(o,t)[0],l||(l=e.create(o),t.firstChild?t.insertBefore(l,t.firstChild):t.appendChild(l)),l.appendChild(r),n.hasChildNodes()||e.remove(n)),c(r),f.align&&a.formatter.apply("align"+f.align,{},r)}),a.focus()})}}))}function b(e){return function(){a.execCommand(e)}}function v(e,t){var n,o,r;for(r='<table id="__mce"><tbody>',n=0;t>n;n++){for(r+="<tr>",o=0;e>o;o++)r+="<td>"+(l.ie?" ":"<br>")+"</td>";r+="</tr>"}r+="</tbody></table>",a.insertContent(r);var i=a.dom.get("__mce");return a.dom.setAttrib(i,"id",null),a.dom.setAttribs(i,a.settings.table_default_attributes||{}),a.dom.setStyles(i,a.settings.table_default_styles||{}),i}function x(e,t){function n(){e.disabled(!a.dom.getParent(a.selection.getStart(),t)),a.selection.selectorChanged(t,function(t){e.disabled(!t)})}a.initialized?n():a.on("init",n)}function y(){x(this,"table")}function w(){x(this,"td,th")}function C(){var e="";e='<table role="grid" class="mce-grid mce-grid-border" aria-readonly="true">';for(var t=0;10>t;t++){e+="<tr>";for(var n=0;10>n;n++)e+='<td role="gridcell" tabindex="-1"><a id="mcegrid'+(10*t+n)+'" href="#" data-mce-x="'+n+'" data-mce-y="'+t+'"></a></td>';e+="</tr>"}return e+="</table>",e+='<div class="mce-text-center" role="presentation">1 x 1</div>'}function R(e,t,n){var o=n.getEl().getElementsByTagName("table")[0],l,r,i,s,c,d=n.isRtl()||"tl-tr"==n.parent().rel;for(o.nextSibling.innerHTML=e+1+" x "+(t+1),d&&(e=9-e),r=0;10>r;r++)for(l=0;10>l;l++)s=o.rows[r].childNodes[l].firstChild,c=(d?l>=e:e>=l)&&t>=r,a.dom.toggleClass(s,"mce-active",c),c&&(i=s);return i.parentNode}var N,S=this;a.settings.table_grid===!1?a.addMenuItem("inserttable",{text:"Insert table",icon:"table",context:"table",onclick:f}):a.addMenuItem("inserttable",{text:"Insert table",icon:"table",context:"table",ariaHideMenu:!0,onclick:function(e){e.aria&&(this.parent().hideAll(),e.stopImmediatePropagation(),f())},onshow:function(){R(0,0,this.menu.items()[0])},onhide:function(){var e=this.menu.items()[0].getEl().getElementsByTagName("a");a.dom.removeClass(e,"mce-active"),a.dom.addClass(e[0],"mce-active")},menu:[{type:"container",html:C(),onPostRender:function(){this.lastX=this.lastY=0},onmousemove:function(e){var t=e.target,n,o;"A"==t.tagName.toUpperCase()&&(n=parseInt(t.getAttribute("data-mce-x"),10),o=parseInt(t.getAttribute("data-mce-y"),10),(this.isRtl()||"tl-tr"==this.parent().rel)&&(n=9-n),(n!==this.lastX||o!==this.lastY)&&(R(n,o,e.control),this.lastX=n,this.lastY=o))},onkeydown:function(e){var t=this.lastX,n=this.lastY,o;switch(e.keyCode){case 37:t>0&&(t--,o=!0);break;case 39:o=!0,9>t&&t++;break;case 38:o=!0,n>0&&n--;break;case 40:o=!0,9>n&&n++}o&&(e.preventDefault(),e.stopPropagation(),R(t,n,e.control).focus(),this.lastX=t,this.lastY=n)},onclick:function(e){var t=this;"A"==e.target.tagName.toUpperCase()&&(e.preventDefault(),e.stopPropagation(),t.parent().cancel(),a.undoManager.transact(function(){v(t.lastX+1,t.lastY+1)}),a.addVisual())}}]}),a.addMenuItem("tableprops",{text:"Table properties",context:"table",onPostRender:y,onclick:f}),a.addMenuItem("deletetable",{text:"Delete table",context:"table",onPostRender:y,cmd:"mceTableDelete"}),a.addMenuItem("cell",{separator:"before",text:"Cell",context:"table",menu:[{text:"Cell properties",onclick:b("mceTableCellProps"),onPostRender:w},{text:"Merge cells",onclick:b("mceTableMergeCells"),onPostRender:w},{text:"Split cell",onclick:b("mceTableSplitCells"),onPostRender:w}]}),a.addMenuItem("row",{text:"Row",context:"table",menu:[{text:"Insert row before",onclick:b("mceTableInsertRowBefore"),onPostRender:w},{text:"Insert row after",onclick:b("mceTableInsertRowAfter"),onPostRender:w},{text:"Delete row",onclick:b("mceTableDeleteRow"),onPostRender:w},{text:"Row properties",onclick:b("mceTableRowProps"),onPostRender:w},{text:"-"},{text:"Cut row",onclick:b("mceTableCutRow"),onPostRender:w},{text:"Copy row",onclick:b("mceTableCopyRow"),onPostRender:w},{text:"Paste row before",onclick:b("mceTablePasteRowBefore"),onPostRender:w},{text:"Paste row after",onclick:b("mceTablePasteRowAfter"),onPostRender:w}]}),a.addMenuItem("column",{text:"Column",context:"table",menu:[{text:"Insert column before",onclick:b("mceTableInsertColBefore"),onPostRender:w},{text:"Insert column after",onclick:b("mceTableInsertColAfter"),onPostRender:w},{text:"Delete column",onclick:b("mceTableDeleteCol"),onPostRender:w}]});var T=[];s("inserttable tableprops deletetable | cell row column".split(" "),function(e){T.push("|"==e?{text:"-"}:a.menuItems[e])}),a.addButton("table",{type:"menubutton",title:"Table",menu:T}),l.isIE||a.on("click",function(e){e=e.target,"TABLE"===e.nodeName&&(a.selection.select(e),a.nodeChanged())}),S.quirks=new t(a),a.on("Init",function(){S.cellSelection=new n(a)}),s({mceTableSplitCells:function(e){e.split()},mceTableMergeCells:function(e){var t;t=a.dom.getParent(a.selection.getStart(),"th,td"),a.dom.select("td.mce-item-selected,th.mce-item-selected").length?e.merge():g(e,t)},mceTableInsertRowBefore:function(e){e.insertRow(!0)},mceTableInsertRowAfter:function(e){e.insertRow()},mceTableInsertColBefore:function(e){e.insertCol(!0)},mceTableInsertColAfter:function(e){e.insertCol()},mceTableDeleteCol:function(e){e.deleteCols()},mceTableDeleteRow:function(e){e.deleteRows()},mceTableCutRow:function(e){N=e.cutRows()},mceTableCopyRow:function(e){N=e.copyRows()},mceTablePasteRowBefore:function(e){e.pasteRows(N,!0)},mceTablePasteRowAfter:function(e){e.pasteRows(N)},mceTableDelete:function(e){e.deleteTable()}},function(t,n){a.addCommand(n,function(){var n=new e(a);n&&(t(n),a.execCommand("mceRepaint"),S.cellSelection.clear())})}),s({mceInsertTable:function(){f()},mceTableRowProps:h,mceTableCellProps:p},function(e,t){a.addCommand(t,function(t,n){e(n)})}),a.settings.table_tab_navigation!==!1&&a.on("keydown",function(t){var n,o,l;9==t.keyCode&&(n=a.dom.getParent(a.selection.getStart(),"th,td"),n&&(t.preventDefault(),o=new e(a),l=t.shiftKey?-1:1,a.undoManager.transact(function(){!o.moveRelIdx(n,l)&&l>0&&(o.insertRow(),o.refresh(),o.moveRelIdx(n,l))})))})}var s=o.each;r.add("table",i)}),r([])}(this); \ No newline at end of file