/*! * froala_editor v1.2.4 (http://editor.froala.com) * Copyright 2014-2014 Froala */ !function(a){a.Editable.commands=a.extend(a.Editable.commands,{table:{title:"Table",icon:"fa fa-table",callback:function(a,b,c){this.table_commands[b]?this.table_commands[b].apply(this,[b,c]):this.table_commands.insertTable.apply(this,[b,c])}}}),a.Editable.DEFAULTS.buttons[a.Editable.DEFAULTS.buttons.indexOf("insertHorizontalRule")]="table",a.Editable.prototype.table_commands={insertTable:function(a,b){this.insertTable(a,b)},insertRowAbove:function(){this.insertRow("above")},insertRowBelow:function(){this.insertRow("below")},insertColumnBefore:function(){this.insertColumn("before")},insertColumnAfter:function(){this.insertColumn("after")},deleteColumn:function(){this.deleteColumn()},deleteRow:function(){this.deleteRow()},insertCellBefore:function(){this.insertCell("before")},insertCellAfter:function(){this.insertCell("after")},mergeCells:function(){this.mergeCells()},deleteCell:function(){this.deleteCell()},splitVertical:function(){this.splitVertical()},splitHorizontal:function(){this.splitHorizontal()},insertHeader:function(){this.insertHeader()},deleteHeader:function(){this.deleteHeader()},deleteTable:function(){this.deleteTable()}},a.Editable.prototype.command_dispatcher=a.extend(a.Editable.prototype.command_dispatcher,{table:function(a){var b=this.buildDropdownTable(),c=this.buildDropdownButton(a,b,"fr-table");return this.bindTableDropdownEvents(),c}}),a.Editable.prototype.tableTab=function(){var b;this.currentCell&&(b=this.currentCell());var c=a(this.getSelectionElement());return c.parents("ul, ol").length>0?!0:b&&this.nextCell()?(this.setSelection(this.nextCell()),!1):void 0},a.Editable.prototype.tableShiftTab=function(){var b;this.currentCell&&(b=this.currentCell());var c=a(this.getSelectionElement());return c.parents("ul, ol").length>0?!0:b&&this.prevCell()?(this.setSelection(this.prevCell()),!1):void 0},a.Editable.prototype.initTable=function(){var b=this;this.$editor.on("click mouseup touch touchend",".fr-table a",function(c){c.preventDefault(),c.stopPropagation(),b.android()&&(a(this).parent().siblings().removeClass("hover"),a(this).parent().addClass("hover"))}),this.addListener("tab",this.tableTab),this.addListener("shift+tab",this.tableShiftTab)},a.Editable.initializers.push(a.Editable.prototype.initTable),a.Editable.prototype.buildDropdownTable=function(){var a='
"},a.Editable.prototype.bindTableDropdownEvents=function(){var b=this;this.$bttn_wrapper.on("mouseenter",".fr-table .select-table > span",function(){var c=a(this).data("val"),d=a(this).data("param");b.$bttn_wrapper.find(".fr-table .select-table .fr-t-info").text(c+" x "+d),b.$bttn_wrapper.find(".fr-table .select-table > span").removeClass("hover");for(var e=1;10>=e;e++)for(var f=0;10>=f;f++){var g=b.$bttn_wrapper.find('.fr-table .select-table > span[data-val="'+e+'"][data-param="'+f+'"]');c>=e&&d>=f?g.addClass("hover"):(c+1>=e||5>=e)&&(d+1>=f||5>=f)?g.css("display","inline-block"):(e>5||f>5)&&g.css("display","none")}}),this.$bttn_wrapper.on("mouseleave",".fr-table .select-table",function(){b.$bttn_wrapper.find('.fr-table .select-table > span[data-val="1"][data-param="1"]').trigger("mouseenter")}),this.android()&&this.$bttn_wrapper.on("touchend",".fr-table .fr-trigger",function(){a(this).parents(".fr-table").find(".hover").removeClass("hover")})},a.Editable.prototype.tableMap=function(){var b=this.currentTable(),c=[];return b&&b.find("tr:not(:empty)").each(function(b,d){var e=a(d),f=0;e.find("th, td").each(function(d,e){for(var g=a(e),h=parseInt(g.attr("colspan"),10)||1,i=parseInt(g.attr("rowspan"),10)||1,j=b;b+i>j;j++)for(var k=f;f+h>k;k++)c[j]||(c[j]=[]),c[j][k]?f++:c[j][k]=e;f+=h})}),c},a.Editable.prototype.cellOrigin=function(a,b){for(var c=0;c