(function(){CKEDITOR.plugins.add("tablebuttons",{requires:["tabletools"],init:function(A){var B=A.lang.table;A.ui.addButton("InsertRowBefore",{label:B.row.insertBefore,command:"vbRowInsertBefore"});A.addCommand("vbRowInsertBefore",{exec:function(E){var D=E.getSelection(),C=D&&D.getStartElement(),F=C&&C.getAscendant("table",1);if(!F){return }E.getCommand("rowInsertBefore").exec()}});A.ui.addButton("InsertRowAfter",{label:B.row.insertAfter,command:"vbRowInsertAfter"});A.addCommand("vbRowInsertAfter",{exec:function(E){var D=E.getSelection(),C=D&&D.getStartElement(),F=C&&C.getAscendant("table",1);if(!F){return }E.getCommand("rowInsertAfter").exec()}});A.ui.addButton("DeleteRow",{label:B.row.deleteRow,command:"vbRowDelete"});A.addCommand("vbRowDelete",{exec:function(E){var D=E.getSelection(),C=D&&D.getStartElement(),F=C&&C.getAscendant("table",1);if(!F){return }E.getCommand("rowDelete").exec()}});A.ui.addButton("InsertColumnBefore",{label:B.column.insertBefore,command:"vbColumnInsertBefore"});A.addCommand("vbColumnInsertBefore",{exec:function(E){var D=E.getSelection(),C=D&&D.getStartElement(),F=C&&C.getAscendant("table",1);if(!F){return }E.getCommand("columnInsertBefore").exec()}});A.ui.addButton("InsertColumnAfter",{label:B.column.insertAfter,command:"vbColumnInsertAfter"});A.addCommand("vbColumnInsertAfter",{exec:function(E){var D=E.getSelection(),C=D&&D.getStartElement(),F=C&&C.getAscendant("table",1);if(!F){return }E.getCommand("columnInsertAfter").exec()}});A.ui.addButton("DeleteColumn",{label:B.column.deleteColumn,command:"vbColumnDelete"});A.addCommand("vbColumnDelete",{exec:function(E){var D=E.getSelection(),C=D&&D.getStartElement(),F=C&&C.getAscendant("table",1);if(!F){return }E.getCommand("columnDelete").exec()}});A.addCommand("vbTableProperties",{exec:function(F){if(CKEDITOR.env.ie){F.selectedTable=null;var E=F.getSelection(),D=null;if(E){var C=E.getRanges();if((D=E.getSelectedElement())){F.selectedTable=D.getAscendant("table",true)}else{if(C&&C.length>0){if(CKEDITOR.env.webkit){C[0].shrink(CKEDITOR.NODE_ELEMENT)}var G=C[0].getCommonAncestor(true);F.selectedTable=G.getAscendant("table",true)}}}}F.getCommand("tableProperties").exec()}});A.ui.addButton("TableProperties",{label:B.menu,command:"vbTableProperties"});A.ui.addButton("DeleteTable",{label:B.deleteTable,command:"tableDelete"})}})})();