PHP Classes

File: contents/apps/ledit/src/lib/tinymce/plugins/table/plugin.min.js

Recommend this page to a friend!
  Classes of Subin Siby   Lobby   contents/apps/ledit/src/lib/tinymce/plugins/table/plugin.min.js   Download  
File: contents/apps/ledit/src/lib/tinymce/plugins/table/plugin.min.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Lobby
Web OS to install and run Web applications
Author: By
Last change: Lobby 0.4
Date: 8 years ago
Size: 41,922 bytes
 

Contents

Class file image Download
!function(e,t){"use strict";function n(e,t){for(var n,r=[],a=0;a<e.length;++a){if(n=o[e[a]]||i(e[a]),!n)throw"module definition dependecy not found: "+e[a];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(){o[e]=i.apply(null,arguments)})}function i(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}var o={};r("tinymce/tableplugin/Utils",["tinymce/Env"],function(e){function t(e,t){return parseInt(e.getAttribute(t)||1,10)}function n(t){(!e.ie||e.ie>10)&&(t.innerHTML='<br data-mce-bogus="1" />')}return{getSpanVal:t,paddCell:n}}),r("tinymce/tableplugin/TableGrid",["tinymce/util/Tools","tinymce/Env","tinymce/tableplugin/Utils"],function(e,n,r){var i=e.each,o=r.getSpanVal;return function(a,s){function l(e){return e===a.getBody()}function c(){var e=0;L=[],H=0,i(["thead","tbody","tfoot"],function(t){var n=W.select("> "+t+" tr",s);i(n,function(n,r){r+=e,i(W.select("> td, > th",n),function(e,n){var i,a,s,l;if(L[r])for(;L[r][n];)n++;for(s=o(e,"rowspan"),l=o(e,"colspan"),a=r;r+s>a;a++)for(L[a]||(L[a]=[]),i=n;n+l>i;i++)L[a][i]={part:t,real:a==r&&i==n,elm:e,rowspan:s,colspan:l};H=Math.max(H,n+1)})}),e+=n.length})}function u(e,t){return e=e.cloneNode(t),e.removeAttribute("id"),e}function d(e,t){var n;return n=L[t],n?n[e]:void 0}function f(e,t,n){e&&(n=parseInt(n,10),1===n?e.removeAttribute(t,1):e.setAttribute(t,n,1))}function p(e){return e&&(W.hasClass(e.elm,"mce-item-selected")||e==F)}function m(){var e=[];return i(s.rows,function(t){i(t.cells,function(n){return W.hasClass(n,"mce-item-selected")||F&&n==F.elm?(e.push(t),!1):void 0})}),e}function h(){var e=W.createRng();l(s)||(e.setStartAfter(s),e.setEndAfter(s),z.setRng(e),W.remove(s))}function g(t){var o,s={};return a.settings.table_clone_elements!==!1&&(s=e.makeMap((a.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 r;return 3==e.nodeType?(i(W.getParents(e.parentNode,null,t).reverse(),function(e){s[e.nodeName]&&(e=u(e,!1),o?r&&r.appendChild(e):o=r=e,r=e)}),r&&(r.innerHTML=n.ie?"&nbsp;":'<br data-mce-bogus="1" />'),!1):void 0},"childNodes"),t=u(t,!1),f(t,"rowSpan",1),f(t,"colSpan",1),o?t.appendChild(o):r.paddCell(t),t}function v(){var e,t=W.createRng();return i(W.select("tr",s),function(e){0===e.cells.length&&W.remove(e)}),0===W.select("tr",s).length?(t.setStartBefore(s),t.setEndBefore(s),z.setRng(t),void W.remove(s)):(i(W.select("thead,tbody,tfoot",s),function(e){0===e.rows.length&&W.remove(e)}),c(),void(I&&(e=L[Math.min(L.length-1,I.y)],e&&(z.select(e[Math.min(e.length-1,I.x)].elm,!0),z.collapse(!0)))))}function y(e,t,n,r){var i,o,a,s,l;for(i=L[t][e].elm.parentNode,a=1;n>=a;a++)if(i=W.getNext(i,"tr")){for(o=e;o>=0;o--)if(l=L[t+a][o].elm,l.parentNode==i){for(s=1;r>=s;s++)W.insertAfter(g(l),l);break}if(-1==o)for(s=1;r>=s;s++)i.insertBefore(g(i.cells[0]),i.cells[0])}}function b(){i(L,function(e,t){i(e,function(e,n){var r,i,a;if(p(e)&&(e=e.elm,r=o(e,"colspan"),i=o(e,"rowspan"),r>1||i>1)){for(f(e,"rowSpan",1),f(e,"colSpan",1),a=0;r-1>a;a++)W.insertAfter(g(e),e);y(n,t,i-1,r)}})})}function x(t,n,r){var o,a,s,l,u,m,h,g,y,x,C;if(t?(o=A(t),a=o.x,s=o.y,l=a+(n-1),u=s+(r-1)):(I=O=null,i(L,function(e,t){i(e,function(e,n){p(e)&&(I||(I={x:n,y:t}),O={x:n,y:t})})}),I&&(a=I.x,s=I.y,l=O.x,u=O.y)),g=d(a,s),y=d(l,u),g&&y&&g.part==y.part){for(b(),c(),g=d(a,s).elm,f(g,"colSpan",l-a+1),f(g,"rowSpan",u-s+1),h=s;u>=h;h++)for(m=a;l>=m;m++)L[h]&&L[h][m]&&(t=L[h][m].elm,t!=g&&(x=e.grep(t.childNodes),i(x,function(e){g.appendChild(e)}),x.length&&(x=e.grep(g.childNodes),C=0,i(x,function(e){"BR"==e.nodeName&&W.getAttrib(e,"data-mce-bogus")&&C++<x.length-1&&g.removeChild(e)})),W.remove(t)));v()}}function C(e){var n,r,a,s,l,c,d,m,h;if(i(L,function(t,r){return i(t,function(t){return p(t)&&(t=t.elm,l=t.parentNode,c=u(l,!1),n=r,e)?!1:void 0}),e?!n:void 0}),n!==t){for(s=0;s<L[0].length;s++)if(L[n][s]&&(r=L[n][s].elm,r!=a)){if(e){if(n>0&&L[n-1][s]&&(m=L[n-1][s].elm,h=o(m,"rowSpan"),h>1)){f(m,"rowSpan",h+1);continue}}else if(h=o(r,"rowspan"),h>1){f(r,"rowSpan",h+1);continue}d=g(r),f(d,"colSpan",r.colSpan),c.appendChild(d),a=r}c.hasChildNodes()&&(e?l.parentNode.insertBefore(c,l):W.insertAfter(c,l))}}function w(e){var t,n;i(L,function(n){return i(n,function(n,r){return p(n)&&(t=r,e)?!1:void 0}),e?!t:void 0}),i(L,function(r,i){var a,s,l;r[t]&&(a=r[t].elm,a!=n&&(l=o(a,"colspan"),s=o(a,"rowspan"),1==l?e?(a.parentNode.insertBefore(g(a),a),y(t,i,s-1,l)):(W.insertAfter(g(a),a),y(t,i,s-1,l)):f(a,"colSpan",a.colSpan+1),n=a))})}function N(t){return e.grep(_(t),p)}function _(e){var t=[];return i(e,function(e){i(e,function(e){t.push(e)})}),t}function E(){var t=[];if(l(s)){if(1==L[0].length)return;if(N(L).length==_(L).length)return}i(L,function(n){i(n,function(n,r){p(n)&&-1===e.inArray(t,r)&&(i(L,function(e){var t,n=e[r].elm;t=o(n,"colSpan"),t>1?f(n,"colSpan",t-1):W.remove(n)}),t.push(r))})}),v()}function k(){function e(e){var t,n;i(e.cells,function(e){var n=o(e,"rowSpan");n>1&&(f(e,"rowSpan",n-1),t=A(e),y(t.x,t.y,1,1))}),t=A(e.cells[0]),i(L[t.y],function(e){var t;e=e.elm,e!=n&&(t=o(e,"rowSpan"),1>=t?W.remove(e):f(e,"rowSpan",t-1),n=e)})}var t;t=m(),l(s)&&t.length==s.rows.length||(i(t.reverse(),function(t){e(t)}),v())}function S(){var e=m();if(!l(s)||e.length!=s.rows.length)return W.remove(e),v(),e}function T(){var e=m();return i(e,function(t,n){e[n]=u(t,!0)}),e}function R(e,t){var n=m(),r=n[t?0:n.length-1],o=r.cells.length;e&&(i(L,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,a=e.cells.length;for(n=0;a>n;n++)i=e.cells[n],f(i,"colSpan",1),f(i,"rowSpan",1);for(n=a;o>n;n++)e.appendChild(g(e.cells[a-1]));for(n=o;a>n;n++)W.remove(e.cells[n]);t?r.parentNode.insertBefore(e,r):W.insertAfter(e,r)}),W.removeClass(W.select("td.mce-item-selected,th.mce-item-selected"),"mce-item-selected"))}function A(e){var t;return i(L,function(n,r){return i(n,function(n,i){return n.elm==e?(t={x:i,y:r},!1):void 0}),!t}),t}function B(e){I=A(e)}function D(){var e,t;return e=t=0,i(L,function(n,r){i(n,function(n,i){var o,a;p(n)&&(n=L[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 M(e){var t,n,r,i,o,a,s,l,c,u;if(O=A(e),I&&O){for(t=Math.min(I.x,O.x),n=Math.min(I.y,O.y),r=Math.max(I.x,O.x),i=Math.max(I.y,O.y),o=r,a=i,u=n;a>=u;u++)e=L[u][t],e.real||t-(e.colspan-1)<t&&(t-=e.colspan-1);for(c=t;o>=c;c++)e=L[n][c],e.real||n-(e.rowspan-1)<n&&(n-=e.rowspan-1);for(u=n;i>=u;u++)for(c=t;r>=c;c++)e=L[u][c],e.real&&(s=e.colspan-1,l=e.rowspan-1,s&&c+s>o&&(o=c+s),l&&u+l>a&&(a=u+l));for(W.removeClass(W.select("td.mce-item-selected,th.mce-item-selected"),"mce-item-selected"),u=n;a>=u;u++)for(c=t;o>=c;c++)L[u][c]&&W.addClass(L[u][c].elm,"mce-item-selected")}}function P(e,t){var n,r,i;n=A(e),r=n.y*H+n.x;do{if(r+=t,i=d(r%H,Math.floor(r/H)),!i)break;if(i.elm!=e)return z.select(i.elm,!0),W.isEmpty(i.elm)&&z.collapse(!0),!0}while(i.elm==e);return!1}var L,H,I,O,F,z=a.selection,W=z.dom;s=s||W.getParent(z.getStart(!0),"table"),c(),F=W.getParent(z.getStart(!0),"th,td"),F&&(I=A(F),O=D(),F=d(I.x,I.y)),e.extend(this,{deleteTable:h,split:b,merge:x,insertRow:C,insertCol:w,deleteCols:E,deleteRows:k,cutRows:S,copyRows:T,pasteRows:R,getPos:A,setStartCell:B,setEndCell:M,moveRelIdx:P,refresh:c})}}),r("tinymce/tableplugin/Quirks",["tinymce/util/VK","tinymce/util/Delay","tinymce/Env","tinymce/util/Tools","tinymce/tableplugin/Utils"],function(e,t,n,r,i){var o=r.each,a=i.getSpanVal;return function(s){function l(){function n(n){function r(e,t){var r=e?"previousSibling":"nextSibling",o=s.dom.getParent(t,"tr"),a=o[r];if(a)return v(s,t,a,e),n.preventDefault(),!0;var l=s.dom.getParent(o,"table"),d=o.parentNode,f=d.nodeName.toLowerCase();if("tbody"===f||f===(e?"tfoot":"thead")){var p=i(e,l,d,"tbody");if(null!==p)return c(e,p,t)}return u(e,o,r,l)}function i(e,t,n,r){var i=s.dom.select(">"+r,t),o=i.indexOf(n);if(e&&0===o||!e&&o===i.length-1)return l(e,t);if(-1===o){var a="thead"===n.tagName.toLowerCase()?0:i.length-1;return i[a]}return i[o+(e?-1:1)]}function l(e,t){var n=e?"thead":"tfoot",r=s.dom.select(">"+n,t);return 0!==r.length?r[0]:null}function c(e,t,r){var i=d(t,e);return i&&v(s,r,i,e),n.preventDefault(),!0}function u(e,t,i,o){var a=o[i];if(a)return f(a),!0;var l=s.dom.getParent(o,"td,th");if(l)return r(e,l,n);var c=d(t,!e);return f(c),n.preventDefault(),!1}function d(e,t){var n=e&&e[t?"lastChild":"firstChild"];return n&&"BR"===n.nodeName?s.dom.getParent(n,"td,th"):n}function f(e){s.selection.setCursorLocation(e,0)}function p(){return x==e.UP||x==e.DOWN}function m(e){var t=e.selection.getNode(),n=e.dom.getParent(t,"tr");return null!==n}function h(e){for(var t=0,n=e;n.previousSibling;)n=n.previousSibling,t+=a(n,"colspan");return t}function g(e,t){var n=0,r=0;return o(e.children,function(e,i){return n+=a(e,"colspan"),r=i,n>t?!1:void 0}),r}function v(e,t,n,r){var i=h(s.dom.getParent(t,"td,th")),o=g(n,i),a=n.childNodes[o],l=d(a,r);f(l||a)}function y(e){var t=s.selection.getNode(),n=s.dom.getParent(t,"td,th"),r=s.dom.getParent(e,"td,th");return n&&n!==r&&b(n,r)}function b(e,t){return s.dom.getParent(e,"TABLE")===s.dom.getParent(t,"TABLE")}var x=n.keyCode;if(p()&&m(s)){var C=s.selection.getNode();t.setEditorTimeout(s,function(){y(C)&&r(!n.shiftKey&&x===e.UP,C,n)},0)}}s.on("KeyDown",function(e){n(e)})}function c(){function e(e,t){var n,r=t.ownerDocument,i=r.createRange();return i.setStartBefore(t),i.setEnd(e.endContainer,e.endOffset),n=r.createElement("body"),n.appendChild(i.cloneContents()),0===n.innerHTML.replace(/<(br|img|object|embed|input|textarea)[^>]*>/gi,"-").replace(/<[^>]+>/g,"").length}s.on("KeyDown",function(t){var n,r,i=s.dom;(37==t.keyCode||38==t.keyCode)&&(n=s.selection.getRng(),r=i.getParent(n.startContainer,"table"),r&&s.getBody().firstChild==r&&e(n,r)&&(n=i.createRng(),n.setStartBefore(r),n.setEndBefore(r),s.selection.setRng(n),t.preventDefault()))})}function u(){s.on("KeyDown SetContent VisualAid",function(){var e;for(e=s.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&&(s.settings.forced_root_block?s.dom.add(s.getBody(),s.settings.forced_root_block,s.settings.forced_root_block_attrs,n.ie&&n.ie<11?"&nbsp;":'<br data-mce-bogus="1" />'):s.dom.add(s.getBody(),"br",{"data-mce-bogus":"1"}))}),s.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&&s.dom.remove(t)})}function d(){function e(e,t,n,r){var i,o,a,s=3,l=e.dom.getParent(t.startContainer,"TABLE");return l&&(i=l.parentNode),o=t.startContainer.nodeType==s&&0===t.startOffset&&0===t.endOffset&&r&&("TR"==n.nodeName||n==i),a=("TD"==n.nodeName||"TH"==n.nodeName)&&!r,o||a}function t(){var t=s.selection.getRng(),n=s.selection.getNode(),r=s.dom.getParent(t.startContainer,"TD,TH");if(e(s,t,n,r)){r||(r=n);for(var i=r.lastChild;i.lastChild;)i=i.lastChild;3==i.nodeType&&(t.setEnd(i,i.data.length),s.selection.setRng(t))}}s.on("KeyDown",function(){t()}),s.on("MouseDown",function(e){2!=e.button&&t()})}function f(){function t(e){s.selection.select(e,!0),s.selection.collapse(!0)}function n(e){s.$(e).empty(),i.paddCell(e)}s.on("keydown",function(i){if((i.keyCode==e.DELETE||i.keyCode==e.BACKSPACE)&&!i.isDefaultPrevented()){var o,a,l,c;if(o=s.dom.getParent(s.selection.getStart(),"table")){if(a=s.dom.select("td,th",o),l=r.grep(a,function(e){return s.dom.hasClass(e,"mce-item-selected")}),0===l.length)return c=s.dom.getParent(s.selection.getStart(),"td,th"),void(s.selection.isCollapsed()&&c&&s.dom.isEmpty(c)&&(i.preventDefault(),n(c),t(c)));i.preventDefault(),s.undoManager.transact(function(){a.length==l.length?s.execCommand("mceTableDelete"):(r.each(l,n),t(l[0]))})}}})}f(),n.webkit&&(l(),d()),n.gecko&&(c(),u()),n.ie>10&&(c(),u())}}),r("tinymce/tableplugin/CellSelection",["tinymce/tableplugin/TableGrid","tinymce/dom/TreeWalker","tinymce/util/Tools"],function(e,t,n){return function(r){function i(e){r.getBody().style.webkitUserSelect="",(e||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(!c&&s&&(a||o!=s)&&("TD"==o.nodeName||"TH"==o.nodeName)){i=u.getParent(o,"table"),i==l&&(a||(a=new e(r,i),a.setStartCell(s),r.getBody().style.webkitUserSelect="none"),a.setEndCell(o),d=!0),n=r.selection.getSel();try{n.removeAllRanges?n.removeAllRanges():n.empty()}catch(f){}t.preventDefault()}}var a,s,l,c,u=r.dom,d=!0;return r.on("MouseDown",function(e){2==e.button||c||(i(),s=u.getParent(e.target,"td,th"),l=u.getParent(s,"table"))}),r.on("mouseover",o),r.on("remove",function(){u.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,c,d,f,p=r.selection;if(s){if(a&&(r.getBody().style.webkitUserSelect=""),o=u.select("td.mce-item-selected,th.mce-item-selected"),o.length>0){i=u.createRng(),d=o[0],i.setStartBefore(d),i.setEndAfter(d),e(d,1),c=new t(d,u.getParent(o[0],"table"));do if("TD"==d.nodeName||"TH"==d.nodeName){if(!u.hasClass(d,"mce-item-selected"))break;f=d}while(d=c.next());e(f),p.setRng(i)}r.nodeChanged(),s=a=l=null}}),r.on("KeyUp Drop SetContent",function(e){i("setcontent"==e.type),s=a=l=null,c=!1}),r.on("ObjectResizeStart ObjectResized",function(e){c="objectresized"!=e.type}),{clear:i}}}),r("tinymce/tableplugin/Dialogs",["tinymce/util/Tools","tinymce/Env"],function(e,t){var n=e.each;return function(r){function i(){var e=r.settings.color_picker_callback;return e?function(){var t=this;e.call(r,function(e){t.value(e).fire("change")},t.value())}:void 0}function o(e){return{title:"Advanced",type:"form",defaults:{onchange:function(){d(e,this.parents().reverse()[0],"style"==this.name())}},items:[{label:"Style",name:"style",type:"textbox"},{type:"form",padding:0,formItemDefaults:{layout:"grid",alignH:["start","right"]},defaults:{size:7},items:[{label:"Border color",type:"colorbox",name:"borderColor",onaction:i()},{label:"Background color",type:"colorbox",name:"backgroundColor",onaction:i()}]}]}}function a(e){return e?e.replace(/px$/,""):""}function s(e){return/^[0-9]+$/.test(e)&&(e+="px"),e}function l(e){n("left center right".split(" "),function(t){r.formatter.remove("align"+t,{},e)})}function c(e){n("top middle bottom".split(" "),function(t){r.formatter.remove("valign"+t,{},e)})}function u(t,n,r){function i(t,r){return r=r||[],e.each(t,function(e){var t={text:e.text||e.title};e.menu?t.menu=i(e.menu):(t.value=e.value,n&&n(t)),r.push(t)}),r}return i(t,r||[])}function d(e,t,n){var r=t.toJSON(),i=e.parseStyle(r.style);n?(t.find("#borderColor").value(i["border-color"]||"")[0].fire("change"),t.find("#backgroundColor").value(i["background-color"]||"")[0].fire("change")):(i["border-color"]=r.borderColor,i["background-color"]=r.backgroundColor),t.find("#style").value(e.serializeStyle(e.parseStyle(e.serializeStyle(i))))}function f(e,t,n){var r=e.parseStyle(e.getAttrib(n,"style"));r["border-color"]&&(t.borderColor=r["border-color"]),r["background-color"]&&(t.backgroundColor=r["background-color"]),t.style=e.serializeStyle(r)}function p(e,t,r){var i=e.parseStyle(e.getAttrib(t,"style"));n(r,function(e){i[e.name]=e.value}),e.setAttrib(t,"style",e.serializeStyle(e.parseStyle(e.serializeStyle(i))))}var m=this;m.tableProps=function(){m.table(!0)},m.table=function(i){function c(){function n(e,t,r){if("TD"===e.tagName||"TH"===e.tagName)C.setStyle(e,t,r);else if(e.children)for(var i=0;i<e.children.length;i++)n(e.children[i],t,r)}var i;d(C,this),w=e.extend(w,this.toJSON()),w["class"]===!1&&delete w["class"],r.undoManager.transact(function(){if(h||(h=r.plugins.table.insertTable(w.cols||1,w.rows||1)),r.dom.setAttribs(h,{style:w.style,"class":w["class"]}),r.settings.table_style_by_css){if(x=[],x.push({name:"border",value:w.border}),x.push({name:"border-spacing",value:s(w.cellspacing)}),p(C,h,x),C.setAttribs(h,{"data-mce-border-color":w.borderColor,"data-mce-cell-padding":w.cellpadding,"data-mce-border":w.border}),h.children)for(var e=0;e<h.children.length;e++)n(h.children[e],"border",w.border),n(h.children[e],"padding",s(w.cellpadding))}else r.dom.setAttribs(h,{border:w.border,cellpadding:w.cellpadding,cellspacing:w.cellspacing});C.getAttrib(h,"width")&&!r.settings.table_style_by_css?C.setAttrib(h,"width",a(w.width)):C.setStyle(h,"width",s(w.width)),C.setStyle(h,"height",s(w.height)),i=C.select("caption",h)[0],i&&!w.caption&&C.remove(i),!i&&w.caption&&(i=C.create("caption"),i.innerHTML=t.ie?"\xa0":'<br data-mce-bogus="1"/>',h.insertBefore(i,h.firstChild)),l(h),w.align&&r.formatter.apply("align"+w.align,{},h),r.focus(),r.addVisual()})}function m(e,t){function n(e,n){for(var r=0;r<n.length;r++){var i=C.getStyle(n[r],t);if("undefined"==typeof e&&(e=i),e!=i)return""}return e}var i,o=r.dom.select("td,th",e);return i=n(i,o)}var h,g,v,y,b,x,C=r.dom,w={};i===!0?(h=C.getParent(r.selection.getStart(),"table"),h&&(w={width:a(C.getStyle(h,"width")||C.getAttrib(h,"width")),height:a(C.getStyle(h,"height")||C.getAttrib(h,"height")),cellspacing:a(C.getStyle(h,"border-spacing")||C.getAttrib(h,"cellspacing")),cellpadding:C.getAttrib(h,"data-mce-cell-padding")||C.getAttrib(h,"cellpadding")||m(h,"padding"),border:C.getAttrib(h,"data-mce-border")||C.getAttrib(h,"border")||m(h,"border"),borderColor:C.getAttrib(h,"data-mce-border-color"),caption:!!C.select("caption",h)[0],"class":C.getAttrib(h,"class")},n("left center right".split(" "),function(e){r.formatter.matchNode(h,"align"+e)&&(w.align=e)}))):(g={label:"Cols",name:"cols"},v={label:"Rows",name:"rows"}),r.settings.table_class_list&&(w["class"]&&(w["class"]=w["class"].replace(/\s*mce\-item\-table\s*/g,"")),y={name:"class",type:"listbox",label:"Class",values:u(r.settings.table_class_list,function(e){e.value&&(e.textStyle=function(){return r.formatter.getCssText({block:"table",classes:[e.value]})})})}),b={type:"form",layout:"flex",direction:"column",labelGapCalc:"children",padding:0,items:[{type:"form",labelGapCalc:!1,padding:0,layout:"grid",columns:2,defaults:{type:"textbox",maxWidth:50},items:r.settings.table_appearance_options!==!1?[g,v,{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"}]:[g,v,{label:"Width",name:"width"},{label:"Height",name:"height"}]},{label:"Alignment",name:"align",type:"listbox",text:"None",values:[{text:"None",value:""},{text:"Left",value:"left"},{text:"Center",value:"center"},{text:"Right",value:"right"}]},y]},r.settings.table_advtab!==!1?(f(C,w,h),r.windowManager.open({title:"Table properties",data:w,bodyType:"tabpanel",body:[{title:"General",type:"form",items:b},o(C)],onsubmit:c})):r.windowManager.open({title:"Table properties",data:w,body:b,onsubmit:c})},m.merge=function(e,t){r.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();r.undoManager.transact(function(){e.merge(t,n.cols,n.rows)})}})},m.cell=function(){function t(){d(h,this),p=e.extend(p,this.toJSON()),r.undoManager.transact(function(){n(g,function(e){r.dom.setAttribs(e,{scope:p.scope,style:p.style,"class":p["class"]}),r.dom.setStyles(e,{width:s(p.width),height:s(p.height)}),p.type&&e.nodeName.toLowerCase()!=p.type&&(e=h.rename(e,p.type)),l(e),p.align&&r.formatter.apply("align"+p.align,{},e),c(e),p.valign&&r.formatter.apply("valign"+p.valign,{},e)}),r.focus()})}var i,p,m,h=r.dom,g=[];if(g=r.dom.select("td.mce-item-selected,th.mce-item-selected"),i=r.dom.getParent(r.selection.getStart(),"td,th"),!g.length&&i&&g.push(i),i=i||g[0]){p={width:a(h.getStyle(i,"width")||h.getAttrib(i,"width")),height:a(h.getStyle(i,"height")||h.getAttrib(i,"height")),scope:h.getAttrib(i,"scope"),"class":h.getAttrib(i,"class")},p.type=i.nodeName.toLowerCase(),n("left center right".split(" "),function(e){r.formatter.matchNode(i,"align"+e)&&(p.align=e)}),n("top middle bottom".split(" "),function(e){r.formatter.matchNode(i,"valign"+e)&&(p.valign=e)}),r.settings.table_cell_class_list&&(m={name:"class",type:"listbox",label:"Class",values:u(r.settings.table_cell_class_list,function(e){e.value&&(e.textStyle=function(){return r.formatter.getCssText({block:"td",classes:[e.value]})})})});var v={type:"form",layout:"flex",direction:"column",labelGapCalc:"children",padding:0,items:[{type:"form",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"}]}]},m]};r.settings.table_cell_advtab!==!1?(f(h,p,i),r.windowManager.open({title:"Cell properties",bodyType:"tabpanel",data:p,body:[{title:"General",type:"form",items:v},o(h)],onsubmit:t})):r.windowManager.open({title:"Cell properties",data:p,body:v,onsubmit:t})}},m.row=function(){function t(){var t,i,o;d(v,this),h=e.extend(h,this.toJSON()),r.undoManager.transact(function(){var e=h.type;n(y,function(n){r.dom.setAttribs(n,{scope:h.scope,style:h.style,"class":h["class"]}),r.dom.setStyles(n,{height:s(h.height)}),e!=n.parentNode.nodeName.toLowerCase()&&(t=v.getParent(n,"table"),i=n.parentNode,o=v.select(e,t)[0],o||(o=v.create(e),t.firstChild?t.insertBefore(o,t.firstChild):t.appendChild(o)),o.appendChild(n),i.hasChildNodes()||v.remove(i)),l(n),h.align&&r.formatter.apply("align"+h.align,{},n)}),r.focus()})}var i,c,p,m,h,g,v=r.dom,y=[];i=r.dom.getParent(r.selection.getStart(),"table"),c=r.dom.getParent(r.selection.getStart(),"td,th"),n(i.rows,function(e){n(e.cells,function(t){return v.hasClass(t,"mce-item-selected")||t==c?(y.push(e),!1):void 0})}),p=y[0],p&&(h={height:a(v.getStyle(p,"height")||v.getAttrib(p,"height")),scope:v.getAttrib(p,"scope"),"class":v.getAttrib(p,"class")},h.type=p.parentNode.nodeName.toLowerCase(),n("left center right".split(" "),function(e){r.formatter.matchNode(p,"align"+e)&&(h.align=e)}),r.settings.table_row_class_list&&(m={name:"class",type:"listbox",label:"Class",values:u(r.settings.table_row_class_list,function(e){e.value&&(e.textStyle=function(){return r.formatter.getCssText({block:"tr",classes:[e.value]})})})}),g={type:"form",columns:2,padding:0,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"},m]},r.settings.table_row_advtab!==!1?(f(v,h,p),r.windowManager.open({title:"Row properties",data:h,bodyType:"tabpanel",body:[{title:"General",type:"form",items:g},o(v)],onsubmit:t})):r.windowManager.open({title:"Row properties",data:h,body:g,onsubmit:t}))}}}),r("tinymce/tableplugin/ResizeBars",["tinymce/util/Tools","tinymce/util/VK"],function(e,n){return function(r){function i(e,t){return{index:e,y:r.dom.getPos(t).y}}function o(e,t){return{index:e,y:r.dom.getPos(t).y+t.offsetHeight}}function a(e,t){return{index:e,x:r.dom.getPos(t).x}}function s(e,t){return{index:e,x:r.dom.getPos(t).x+t.offsetWidth}}function l(){var e=r.getBody().dir;return"rtl"===e}function c(){return r.inline}function u(){return c?r.getBody().ownerDocument.body:r.getBody()}function d(e,t){return l()?s(e,t):a(e,t)}function f(e,t){return l()?a(e,t):s(e,t)}function p(e,t){return m(e,"width")/m(t,"width")*100}function m(e,t){var n=r.dom.getStyle(e,t,!0),i=parseInt(n,10);return i}function h(e){var t=m(e,"width"),n=m(e.parentElement,"width");return t/n*100}function g(e,t){var n=m(e,"width");return t/n*100}function v(e,t){var n=m(e.parentElement,"width");return t/n*100}function y(e,t,n){for(var r=[],i=1;i<n.length;i++){var o=n[i].element;r.push(e(i-1,o))}var a=n[n.length-1];return r.push(t(n.length-1,a.element)),r}function b(){var t=r.dom.select("."+de,u());e.each(t,function(e){r.dom.remove(e)})}function x(e){b(),A(e)}function C(e,t,n,r,i,o,a,s){var l={"data-mce-bogus":"all","class":de+" "+e,unselectable:"on","data-mce-resize":!1,style:"cursor: "+t+"; margin: 0; padding: 0; position: absolute; left: "+n+"px; top: "+r+"px; height: "+i+"px; width: "+o+"px; "};return l[a]=s,l}function w(t,n,i){e.each(t,function(e){var t=i.x,o=e.y-xe/2,a=xe,s=n;r.dom.add(u(),"div",C(fe,pe,t,o,a,s,me,e.index))})}function N(t,n,i){e.each(t,function(e){var t=e.x-xe/2,o=i.y,a=n,s=xe;r.dom.add(u(),"div",C(ge,ve,t,o,a,s,ye,e.index))})}function _(t){return e.map(t.rows,function(t){var n=e.map(t.cells,function(e){var t=e.hasAttribute("rowspan")?parseInt(e.getAttribute("rowspan"),10):1,n=e.hasAttribute("colspan")?parseInt(e.getAttribute("colspan"),10):1;return{element:e,rowspan:t,colspan:n}});return{element:t,cells:n}})}function E(n){function r(e,t){return e+","+t}function i(e,t){return s[r(e,t)]}function o(){var t=[];return e.each(l,function(e){t=t.concat(e.cells)}),t}function a(){return l}var s={},l=[],c=0,u=0;return e.each(n,function(n,i){var o=[];e.each(n.cells,function(e){for(var n=0;s[r(i,n)]!==t;)n++;for(var a={element:e.element,colspan:e.colspan,rowspan:e.rowspan,rowIndex:i,colIndex:n},l=0;l<e.colspan;l++)for(var d=0;d<e.rowspan;d++){var f=i+d,p=n+l;s[r(f,p)]=a,c=Math.max(c,f+1),u=Math.max(u,p+1)}o.push(a)}),l.push({element:n.element,cells:o})}),{grid:{maxRows:c,maxCols:u},getAt:i,getAllCells:o,getAllRows:a}}function k(e,t){for(var n=[],r=e;t>r;r++)n.push(r);return n}function S(e,t,n){for(var r,i=e(),o=0;o<i.length;o++)t(i[o])&&(r=i[o]);return r?r:n()}function T(t){var n=k(0,t.grid.maxCols),r=k(0,t.grid.maxRows);return e.map(n,function(e){function n(){for(var n=[],i=0;i<r.length;i++){var o=t.getAt(i,e);o.colIndex===e&&n.push(o)}return n}function i(e){return 1===e.colspan}function o(){return t.getAt(0,e)}return S(n,i,o)})}function R(t){var n=k(0,t.grid.maxCols),r=k(0,t.grid.maxRows);return e.map(r,function(e){function r(){for(var r=[],i=0;i<n.length;i++){var o=t.getAt(e,i);o.rowIndex===e&&r.push(o)}return r}function i(e){return 1===e.rowspan}function o(){t.getAt(e,0)}return S(r,i,o)})}function A(e){var t=_(e),n=E(t),a=R(n),s=T(n),l=r.dom.getPos(e),c=a.length>0?y(i,o,a):[],u=s.length>0?y(d,f,s):[];w(c,e.offsetWidth,l),N(u,e.offsetHeight,l)}function B(e,t,n,r){if(0>t||t>=e.length-1)return"";var i=e[t];if(i)i={value:i,delta:0};else for(var o=e.slice(0,t).reverse(),a=0;a<o.length;a++)o[a]&&(i={value:o[a],delta:a+1});var s=e[t+1];if(s)s={value:s,delta:1};else for(var l=e.slice(t+1),c=0;c<l.length;c++)l[c]&&(s={value:l[c],delta:c+1});var u=s.delta-i.delta,d=Math.abs(s.value-i.value)/u;return n?d/m(r,"width")*100:d}function D(e,t){var n=r.dom.getStyle(e,t);return n||(n=r.dom.getAttrib(e,t)),n||(n=r.dom.getStyle(e,t,!0)),n}function M(e,t,n){var r=D(e,"width"),i=parseInt(r,10),o=t?p(e,n):m(e,"width");return(t&&!V(r)||!t&&!U(r))&&(i=0),!isNaN(i)&&i>0?i:o}function P(t,n,r){for(var i=T(t),o=e.map(i,function(e){return d(e.colIndex,e.element).x}),a=[],s=0;s<i.length;s++){var l=i[s].element.hasAttribute("colspan")?parseInt(i[s].element.getAttribute("colspan"),10):1,c=l>1?B(o,s):M(i[s].element,n,r);c=c?c:Ce,a.push(c)}return a}function L(e){var t=D(e,"height"),n=parseInt(t,10);return V(t)&&(n=0),!isNaN(n)&&n>0?n:m(e,"height")}function H(t){for(var n=R(t),r=e.map(n,function(e){return i(e.rowIndex,e.element).y}),o=[],a=0;a<n.length;a++){var s=n[a].element.hasAttribute("rowspan")?parseInt(n[a].element.getAttribute("rowspan"),10):1,l=s>1?B(r,a):L(n[a].element);l=l?l:we,o.push(l)}return o}function I(t,n,r,i,o){function a(t){return e.map(t,function(){return 0})}function s(){var e;if(o)e=[100-d[0]];else{var t=Math.max(i,d[0]+r);e=[t-d[0]]}return e}function l(e,t){var n,o=a(d.slice(0,e)),s=a(d.slice(t+1));if(r>=0){var l=Math.max(i,d[t]-r);n=o.concat([r,l-d[t]]).concat(s)}else{var c=Math.max(i,d[e]+r),u=d[e]-c;n=o.concat([c-d[e],u]).concat(s)}return n}function c(e,t){var n,o=a(d.slice(0,t));if(r>=0)n=o.concat([r]);else{var s=Math.max(i,d[t]+r);n=o.concat([s-d[t]])}return n}var u,d=t.slice(0);return u=0===t.length?[]:1===t.length?s():0===n?l(0,1):n>0&&n<t.length-1?l(n,n+1):n===t.length-1?c(n-1,n):[]}function O(e,t,n){for(var r=0,i=e;t>i;i++)r+=n[i];return r}function F(t,n){var r=t.getAllCells();return e.map(r,function(e){var t=O(e.colIndex,e.colIndex+e.colspan,n);return{element:e.element,width:t,colspan:e.colspan}})}function z(t,n){var r=t.getAllCells();return e.map(r,function(e){var t=O(e.rowIndex,e.rowIndex+e.rowspan,n);return{element:e.element,height:t,rowspan:e.rowspan}})}function W(t,n){var r=t.getAllRows();return e.map(r,function(e,t){return{element:e.element,height:n[t]}})}function V(e){return _e.test(e)}function U(e){return Ee.test(e)}function $(t,n,i){function o(t,n){e.each(t,function(e){r.dom.setStyle(e.element,"width",e.width+n),r.dom.setAttrib(e.element,"width",null)})}function a(){return i<u.grid.maxCols-1?h(t):h(t)+v(t,n)}function s(){return i<u.grid.maxCols-1?m(t,"width"):m(t,"width")+n}function l(e,n,o){i!=u.grid.maxCols-1&&o||(r.dom.setStyle(t,"width",e+n),r.dom.setAttrib(t,"width",null))}for(var c=_(t),u=E(c),d=V(t.width)||V(t.style.width),f=P(u,d,t),p=d?g(t,n):n,y=I(f,i,p,Ce,d,t),b=[],x=0;x<y.length;x++)b.push(y[x]+f[x]);var C=F(u,b),w=d?"%":"px",N=d?a():s();r.undoManager.transact(function(){o(C,w),l(N,w,d)})}function j(t,n,i){for(var o=_(t),a=E(o),s=H(a),l=[],c=0,u=0;u<s.length;u++)l.push(u===i?n+s[u]:s[u]),c+=c[u];var d=z(a,l),f=W(a,l);r.undoManager.transact(function(){e.each(f,function(e){r.dom.setStyle(e.element,"height",e.height+"px"),r.dom.setAttrib(e.element,"height",null)}),e.each(d,function(e){r.dom.setStyle(e.element,"height",e.height+"px"),r.dom.setAttrib(e.element,"height",null)}),r.dom.setStyle(t,"height",c+"px"),r.dom.setAttrib(t,"height",null)})}function q(){ie=setTimeout(function(){G()},200)}function Y(){clearTimeout(ie)}function X(){var e=document.createElement("div");return e.setAttribute("style","margin: 0; padding: 0; position: fixed; left: 0px; top: 0px; height: 100%; width: 100%;"),e.setAttribute("data-mce-bogus","all"),e}function K(e,t){r.dom.bind(e,"mouseup",function(){G()}),r.dom.bind(e,"mousemove",function(e){Y(),oe&&t(e)}),r.dom.bind(e,"mouseout",function(){q()})}function G(){if(r.dom.remove(ae),oe){r.dom.removeClass(se,Ne),oe=!1;var e,t;if(Q(se)){var n=parseInt(r.dom.getAttrib(se,be),10),i=r.dom.getPos(se).x;e=parseInt(r.dom.getAttrib(se,ye),10),t=l()?n-i:i-n,$(ue,t,e)}else if(Z(se)){var o=parseInt(r.dom.getAttrib(se,he),10),a=r.dom.getPos(se).y;e=parseInt(r.dom.getAttrib(se,me),10),t=a-o,j(ue,t,e)}x(ue),r.nodeChanged()}}function J(e,t){ae=ae?ae:X(),oe=!0,r.dom.addClass(e,Ne),se=e,K(ae,t),r.dom.add(u(),ae)}function Q(e){return r.dom.hasClass(e,ge)}function Z(e){return r.dom.hasClass(e,fe)}function ee(e){le=le!==t?le:e.clientX;var n=e.clientX-le;le=e.clientX;var i=r.dom.getPos(se).x;r.dom.setStyle(se,"left",i+n+"px")}function te(e){ce=ce!==t?ce:e.clientY;var n=e.clientY-ce;ce=e.clientY;var i=r.dom.getPos(se).y;r.dom.setStyle(se,"top",i+n+"px")}function ne(e){le=t,J(e,ee)}function re(e){ce=t,J(e,te)}var ie,oe,ae,se,le,ce,ue,de="mce-resize-bar",fe="mce-resize-bar-row",pe="row-resize",me="data-row",he="data-initial-top",ge="mce-resize-bar-col",ve="col-resize",ye="data-col",be="data-initial-left",xe=4,Ce=10,we=10,Ne="mce-resize-bar-dragging",_e=new RegExp(/(\d+(\.\d+)?%)/),Ee=new RegExp(/px|em/);return r.on("init",function(){r.dom.bind(u(),"mousedown",function(e){var t=e.target;if(Q(t)){e.preventDefault();var n=r.dom.getPos(t).x;r.dom.setAttrib(t,be,n),ne(t)}else if(Z(t)){e.preventDefault();var i=r.dom.getPos(t).y;r.dom.setAttrib(t,he,i),re(t)}})}),r.on("ObjectResized",function(t){var n=t.target;if("TABLE"===n.nodeName){var i=[];e.each(n.rows,function(t){e.each(t.cells,function(e){var t=r.dom.getStyle(e,"width",!0);i.push({cell:e,width:t})})}),e.each(i,function(e){r.dom.setStyle(e.cell,"width",e.width),r.dom.setAttrib(e.cell,"width",null)})}}),r.on("mouseover",function(e){if(!oe){var t=r.dom.getParent(e.target,"table");("table"===e.target.nodeName||t)&&(ue=t,x(t))}}),r.on("keydown",function(e){switch(e.keyCode){case n.LEFT:case n.RIGHT:case n.UP:case n.DOWN:b()}}),{adjustWidth:$,adjustHeight:j,clearBars:b,drawBars:A,determineDeltas:I,getTableGrid:E,getTableDetails:_,getWidths:P,getPixelHeights:H,isPercentageBasedSize:V,isPixelBasedSize:U,recalculateWidths:F,recalculateCellHeights:z,recalculateRowHeights:W}}}),r("tinymce/tableplugin/Plugin",["tinymce/tableplugin/TableGrid","tinymce/tableplugin/Quirks","tinymce/tableplugin/CellSelection","tinymce/tableplugin/Dialogs","tinymce/tableplugin/ResizeBars","tinymce/util/Tools","tinymce/dom/TreeWalker","tinymce/Env","tinymce/PluginManager"],function(e,t,n,r,i,o,a,s,l){function c(o){function a(e){return function(){o.execCommand(e)}}function l(e,t){var n,r,i,a;for(i='<table id="__mce"><tbody>',n=0;t>n;n++){for(i+="<tr>",r=0;e>r;r++)i+="<td>"+(s.ie?" ":"<br>")+"</td>";i+="</tr>"}return i+="</tbody></table>",o.undoManager.transact(function(){o.insertContent(i),a=o.dom.get("__mce"),o.dom.setAttrib(a,"id",null),o.dom.setAttribs(a,o.settings.table_default_attributes||{}),o.dom.setStyles(a,o.settings.table_default_styles||{})}),a}function c(e,t){function n(){e.disabled(!o.dom.getParent(o.selection.getStart(),t)),o.selection.selectorChanged(t,function(t){e.disabled(!t)})}o.initialized?n():o.on("init",n)}function d(){c(this,"table")}function f(){c(this,"td,th")}function p(){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 m(e,t,n){var r,i,a,s,l,c=n.getEl().getElementsByTagName("table")[0],u=n.isRtl()||"tl-tr"==n.parent().rel;for(c.nextSibling.innerHTML=e+1+" x "+(t+1),u&&(e=9-e),i=0;10>i;i++)for(r=0;10>r;r++)s=c.rows[i].childNodes[r].firstChild,l=(u?r>=e:e>=r)&&t>=i,o.dom.toggleClass(s,"mce-active",l),l&&(a=s);return a.parentNode}function h(){o.addButton("tableprops",{title:"Table properties",onclick:C.tableProps,icon:"table"}),o.addButton("tabledelete",{title:"Delete table",onclick:a("mceTableDelete")}),o.addButton("tablecellprops",{title:"Cell properties",onclick:a("mceTableCellProps")}),o.addButton("tablemergecells",{title:"Merge cells",onclick:a("mceTableMergeCells")}),o.addButton("tablesplitcells",{title:"Split cell",onclick:a("mceTableSplitCells")}),o.addButton("tableinsertrowbefore",{title:"Insert row before",onclick:a("mceTableInsertRowBefore")}),o.addButton("tableinsertrowafter",{title:"Insert row after",onclick:a("mceTableInsertRowAfter")}),o.addButton("tabledeleterow",{title:"Delete row",onclick:a("mceTableDeleteRow")}),o.addButton("tablerowprops",{title:"Row properties",onclick:a("mceTableRowProps")}),o.addButton("tablecutrow",{title:"Cut row",onclick:a("mceTableCutRow")}),o.addButton("tablecopyrow",{title:"Copy row",onclick:a("mceTableCopyRow")}),o.addButton("tablepasterowbefore",{title:"Paste row before",onclick:a("mceTablePasteRowBefore")}),o.addButton("tablepasterowafter",{title:"Paste row after",onclick:a("mceTablePasteRowAfter")}),o.addButton("tableinsertcolbefore",{title:"Insert column before",onclick:a("mceTableInsertColBefore")}),o.addButton("tableinsertcolafter",{title:"Insert column after",onclick:a("mceTableInsertColAfter")}),o.addButton("tabledeletecol",{title:"Delete column",onclick:a("mceTableDeleteCol")})}function g(e){var t=o.dom.is(e,"table")&&o.getBody().contains(e);return t}function v(){var e=o.settings.table_toolbar;""!==e&&e!==!1&&(e||(e="tableprops tabledelete | tableinsertrowbefore tableinsertrowafter tabledeleterow | tableinsertcolbefore tableinsertcolafter tabledeletecol"),o.addContextToolbar(g,e))}var y,b,x=this,C=new r(o);!o.settings.object_resizing||o.settings.object_resizing!==!0&&"table"!==o.settings.object_resizing||(b=i(o)),o.settings.table_grid===!1?o.addMenuItem("inserttable",{text:"Insert table",icon:"table",context:"table",onclick:C.table}):o.addMenuItem("inserttable",{text:"Insert table",icon:"table",context:"table",ariaHideMenu:!0,onclick:function(e){e.aria&&(this.parent().hideAll(),e.stopImmediatePropagation(),C.table())},onshow:function(){m(0,0,this.menu.items()[0])},onhide:function(){var e=this.menu.items()[0].getEl().getElementsByTagName("a");o.dom.removeClass(e,"mce-active"),o.dom.addClass(e[0],"mce-active")},menu:[{type:"container",html:p(),onPostRender:function(){this.lastX=this.lastY=0},onmousemove:function(e){var t,n,r=e.target;"A"==r.tagName.toUpperCase()&&(t=parseInt(r.getAttribute("data-mce-x"),10),n=parseInt(r.getAttribute("data-mce-y"),10),(this.isRtl()||"tl-tr"==this.parent().rel)&&(t=9-t),(t!==this.lastX||n!==this.lastY)&&(m(t,n,e.control),this.lastX=t,this.lastY=n))},onclick:function(e){var t=this;"A"==e.target.tagName.toUpperCase()&&(e.preventDefault(),e.stopPropagation(),t.parent().cancel(),o.undoManager.transact(function(){l(t.lastX+1,t.lastY+1)}),o.addVisual())}}]}),o.addMenuItem("tableprops",{text:"Table properties",context:"table",onPostRender:d,onclick:C.tableProps}),o.addMenuItem("deletetable",{text:"Delete table",context:"table",onPostRender:d,cmd:"mceTableDelete"}),o.addMenuItem("cell",{separator:"before",text:"Cell",context:"table",menu:[{text:"Cell properties",onclick:a("mceTableCellProps"),onPostRender:f},{text:"Merge cells",onclick:a("mceTableMergeCells"),onPostRender:f},{text:"Split cell",onclick:a("mceTableSplitCells"),onPostRender:f}]}),o.addMenuItem("row",{text:"Row",context:"table",menu:[{text:"Insert row before",onclick:a("mceTableInsertRowBefore"),onPostRender:f},{text:"Insert row after",onclick:a("mceTableInsertRowAfter"),onPostRender:f},{text:"Delete row",onclick:a("mceTableDeleteRow"),onPostRender:f},{text:"Row properties",onclick:a("mceTableRowProps"),onPostRender:f},{text:"-"},{text:"Cut row",onclick:a("mceTableCutRow"),onPostRender:f},{text:"Copy row",onclick:a("mceTableCopyRow"),onPostRender:f},{text:"Paste row before",onclick:a("mceTablePasteRowBefore"),onPostRender:f},{text:"Paste row after",onclick:a("mceTablePasteRowAfter"),onPostRender:f}]}),o.addMenuItem("column",{text:"Column",context:"table",menu:[{text:"Insert column before",onclick:a("mceTableInsertColBefore"),onPostRender:f},{text:"Insert column after",onclick:a("mceTableInsertColAfter"),onPostRender:f},{text:"Delete column",onclick:a("mceTableDeleteCol"),onPostRender:f}]});var w=[];u("inserttable tableprops deletetable | cell row column".split(" "),function(e){"|"==e?w.push({text:"-"}):w.push(o.menuItems[e])}),o.addButton("table",{type:"menubutton",title:"Table",menu:w}),s.isIE||o.on("click",function(e){e=e.target,"TABLE"===e.nodeName&&(o.selection.select(e),o.nodeChanged())}),x.quirks=new t(o),o.on("Init",function(){x.cellSelection=new n(o),x.resizeBars=b}),o.on("PreInit",function(){o.serializer.addAttributeFilter("data-mce-cell-padding,data-mce-border,data-mce-border-color",function(e,t){for(var n=e.length;n--;)e[n].attr(t,null)})}),u({mceTableSplitCells:function(e){e.split()},mceTableMergeCells:function(e){var t;t=o.dom.getParent(o.selection.getStart(),"th,td"),o.dom.select("td.mce-item-selected,th.mce-item-selected").length?e.merge():C.merge(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){y=e.cutRows()},mceTableCopyRow:function(e){y=e.copyRows()},mceTablePasteRowBefore:function(e){e.pasteRows(y,!0)},mceTablePasteRowAfter:function(e){e.pasteRows(y)},mceTableDelete:function(e){b&&b.clearBars(),e.deleteTable()}},function(t,n){o.addCommand(n,function(){var n=new e(o);n&&(t(n),o.execCommand("mceRepaint"),x.cellSelection.clear())})}),u({mceInsertTable:C.table,mceTableProps:function(){C.table(!0)},mceTableRowProps:C.row,mceTableCellProps:C.cell},function(e,t){o.addCommand(t,function(t,n){e(n)})}),h(),v(),o.settings.table_tab_navigation!==!1&&o.on("keydown",function(t){var n,r,i;9==t.keyCode&&(n=o.dom.getParent(o.selection.getStart(),"th,td"),n&&(t.preventDefault(),r=new e(o),i=t.shiftKey?-1:1,o.undoManager.transact(function(){!r.moveRelIdx(n,i)&&i>0&&(r.insertRow(),r.refresh(),r.moveRelIdx(n,i))})))}),x.insertTable=l}var u=o.each;l.add("table",c)})}(this);