define("editor/assert/js/plugins/tableview",["editor/assert/js/utils/object"],function(require,exports){var a=require("editor/assert/js/utils/object").instance,b=function(){this.canvas=null,this.dom=null,this.fobject=null,this.phtml=null,this.tablecot=null};b.prototype.addElemet=function(a){this.dom=a,a?(this.phtml=a.hcontent,this.showEditorBtn()):this.render()},b.prototype.render=function(){var a=this,b=$('<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"><div class="modal-dialog" style="width: 72%"><div class="modal-content"> <div class="modal-header"><button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button><h4 class="modal-title" id="myModalLabel">表格</h4></div><div class="modal-body" style="height: 500px;padding: 0"><iframe src="editor/assert/js/plugins/table/editor.html" width="100%" height="100%" frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling="" allowtransparency="yes"></iframe></div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button><button type="button" class="btn btn-primary" id="add_table_bt">添加</button></div></div></div></div>');$("body").append(b),setTimeout(function(){a.tablecot&&(a.phtml="<table>"+a.tablecot.find("table").html()+"</table>"),a.tablecot=$(window.frames[0].frames.ueditor_0.document.body),a.phtml&&a.tablecot.prepend(a.phtml)},1e3),b.on("hidden.bs.modal",function(){b.remove(),a.remove()}),$("#add_table_bt").on("click",function(){var c=a.tablecot.find("table");html2canvas(c,{onrendered:function(b){var c={hcontent:a.phtml||"table_"+commands._randomString(10)},d=b.toDataURL("png");a.phtml||(a.dom=a.print(d),a.dom.baseClass=a),a.update(d,c),PAGECURRENT.c.activeObject=a}}),b.modal("hide")}),commands.createHTPop(b)},b.prototype.print=function(a){var b=new Image;b.src=a;var c=new fabric.Table(b,{left:50,top:100,width:PAGECURRENT.c._canvas.width-100});return c},commands._extend(b,a),exports.instance=b});