/*! * medium-editor-insert-plugin v0.3.2 - jQuery insert plugin for MediumEditor * * https://github.com/orthes/medium-editor-insert-plugin * * Copyright (c) 2014 Pavel Linkesch (http://linkesch.sk) * Released under the MIT license */ !function(a){a.fn.mediumInsert.registerAddon("tables",{defaults:{defaultRows:2,defaultCols:2},init:function(b){this.options=a.extend(this.defaults,b),this.$el=a.fn.mediumInsert.insert.$el,this.setTableButtonEvents()},insertButton:function(a){var b="Table";return("fontawesome"===a||"object"==typeof a&&a.fontawesome)&&(b=''),"object"==typeof a&&a.table&&(b=a.table),'"},add:function(b){a.fn.mediumInsert.insert.deselect();var c='
';a(c).appendTo(b.prev()),this.updateDemoTable(),setTimeout(function(){b.prev().find("input").focus()},50),a.fn.mediumInsert.insert.deselect(),this.currentPlaceholder=b},setTableButtonEvents:function(){var b=this;a(document).on("keyup","input.mediumInsert-tableRows, input.mediumInsert-tableCols",function(){b.updateDemoTable()}),a(document).on("click",function(c){0===a(c.target).parents(".mediumInsert-buttons").length&&b.removeToolbar()}),a(document).on("click","button.mediumInsert-tableReadyButton",function(){b.setEnterActionEvents(),b.removeToolbar()})},getDimensions:function(){return{rows:parseFloat(a("input.mediumInsert-tableRows").val())||1,cols:parseFloat(a("input.mediumInsert-tableCols").val())||1}},buildTable:function(b){var c,d,e,f=this.getDimensions(),g=a(b);for(c=0;c