/*! wangeditor.js 2016-04-11 */
!function(a){"function"==typeof window.define?window.define.amd?window.define("wangEditor",["jquery"],a):window.define.cmd?window.define(function(b,c,d){return a}):a(window.jQuery):"object"==typeof module&&"object"==typeof module.exports?module.exports=a(require("./wangEditor-jquery.js")):a(window.jQuery)}(function(a){if(!a||!a.fn||!a.fn.jquery)return void alert("在引用wangEditor.js之前，先引用jQuery，否则无法使用 wangEditor");var b=function(b){var c=window.wangEditor;c&&b(c,a)};return function(a,b){if(a.wangEditor)return void alert("一个页面不能重复引用 wangEditor.js 或 wangEditor.min.js ！！！");var c=function(a){var c=b("#"+a);if(1===c.length){var d=c[0].nodeName;("TEXTAREA"===d||"DIV"===d)&&(this.valueNodeName=d.toLowerCase(),this.$valueContainer=c,this.$prev=c.prev(),this.$parent=c.parent(),this.init())}};c.fn=c.prototype,c.$body=b("body"),c.$document=b(document),c.$window=b(a),c.userAgent=navigator.userAgent,c.getComputedStyle=a.getComputedStyle,c.w3cRange="function"==typeof document.createRange,c.hostname=location.hostname.toLowerCase(),c.websiteHost="wangeditor.github.io",c.isOnWebsite=c.hostname===c.websiteHost,c.docsite="http://www.kancloud.cn/wangfupeng/wangeditor2/113961",a.wangEditor=c,c.plugin=function(a){c._plugins||(c._plugins=[]),"function"==typeof a&&c._plugins.push(a)}}(window,a),b(function(a,b){a.fn.init=function(){this.initDefaultConfig(),this.addEditorContainer(),this.addTxt(),this.addMenuContainer(),this.menus={},this.commandHooks()}}),b(function(a,b){a.fn.ready=function(a){this.readyFns||(this.readyFns=[]),this.readyFns.push(a)},a.fn.readyHeadler=function(){for(var a=this.readyFns;a.length;)a.shift().call(this)},a.fn.updateValue=function(){var a=this,b=a.$valueContainer,c=a.txt.$txt;if(b!==c){var d=c.html();b.val(d)}},a.fn.getInitValue=function(){var a=this,b=a.$valueContainer,c="",d=a.valueNodeName;return"div"===d?c=b.html():"textarea"===d&&(c=b.val()),c},a.fn.updateMenuStyle=function(){var a=this.menus;b.each(a,function(a,b){b.updateSelected()})},a.fn.enableMenusExcept=function(a){this._disabled||(a=a||[],"string"==typeof a&&(a=[a]),b.each(this.menus,function(b,c){a.indexOf(b)>=0||c.disabled(!1)}))},a.fn.disableMenusExcept=function(a){this._disabled||(a=a||[],"string"==typeof a&&(a=[a]),b.each(this.menus,function(b,c){a.indexOf(b)>=0||c.disabled(!0)}))},a.fn.hideDropPanelAndModal=function(){var a=this.menus;b.each(a,function(a,b){var c=b.dropPanel||b.dropList||b.modal;c&&c.hide&&c.hide()})}}),b(function(a,b){function c(){}var d=!a.w3cRange;a.fn.currentRange=function(a){return a?void(this._rangeData=a):this._rangeData},a.fn.collapseRange=function(a,b){b=b||"end",b="start"===b?!0:!1,a=a||this.currentRange(),a&&(a.collapse(b),this.currentRange(a))},a.fn.getRangeText=d?c:function(a){return(a=a||this.currentRange())?a.toString():void 0},a.fn.getRangeElem=d?c:function(a){a=a||this.currentRange();var b=a.commonAncestorContainer;return 1===b.nodeType?b:b.parentNode},a.fn.isRangeEmpty=d?c:function(a){return a=a||this.currentRange(),a&&a.startContainer&&a.startContainer===a.endContainer&&a.startOffset===a.endOffset?!0:!1},a.fn.saveSelection=d?c:function(a){var c,d,e=this,f=e.txt.$txt.get(0);a?c=a.commonAncestorContainer:(d=document.getSelection(),d.getRangeAt&&d.rangeCount&&(a=document.getSelection().getRangeAt(0),c=a.commonAncestorContainer)),c&&(b.contains(f,c)||f===c)&&e.currentRange(a)},a.fn.restoreSelection=d?c:function(b){var c;if(b=b||this.currentRange())try{c=document.getSelection(),c.removeAllRanges(),c.addRange(b)}catch(d){a.error("执行 editor.restoreSelection 时，IE可能会有异常，不影响使用")}},a.fn.restoreSelectionByElem=d?c:function(a,b){a&&(b=b||"end",this.setRangeByElem(a),"start"===b&&this.collapseRange(this.currentRange(),"start"),"end"===b&&this.collapseRange(this.currentRange(),"end"),this.restoreSelection())},a.fn.initSelection=d?c:function(){var a=this;if(!a.currentRange()){var b=a.txt.$txt,c=b.children().first();c.length&&a.restoreSelectionByElem(c.get(0))}},a.fn.setRangeByElem=d?c:function(a){var c=this,d=c.txt.$txt.get(0);if(a&&b.contains(d,a)){for(var e=a.firstChild;e&&3!==e.nodeType;)e=e.firstChild;for(var f=a.lastChild;f&&3!==f.nodeType;)f=f.lastChild;var g=document.createRange();e&&f?(g.setStart(e,0),g.setEnd(f,f.textContent.length)):(g.setStart(a,0),g.setEnd(a,0)),c.saveSelection(g)}}}),b(function(a,b){a.w3cRange||(a.fn.getRangeText=function(a){return(a=a||this.currentRange())?a.text:void 0},a.fn.getRangeElem=function(a){if(a=a||this.currentRange()){var b=a.parentElement();return 1===b.nodeType?b:b.parentNode}},a.fn.isRangeEmpty=function(a){return a=a||this.currentRange(),a&&a.text?!1:!0},a.fn.saveSelection=function(a){var c,d=this,e=d.txt.$txt.get(0);a?c=a.parentElement():(a=document.selection.createRange(),c="undefined"==typeof a.parentElement?null:a.parentElement()),c&&(b.contains(e,c)||e===c)&&d.currentRange(a)},a.fn.restoreSelection=function(a){var b,c=this;if(a=a||c.currentRange()){b=document.selection.createRange();try{b.setEndPoint("EndToEnd",a)}catch(d){}if(0===a.text.length)try{b.collapse(!1)}catch(d){}else b.setEndPoint("StartToStart",a);b.select()}})}),b(function(a,b){a.fn.commandHooks=function(){var a=this,c={};c.insertHtml=function(c){var d,e=b(c),f=a.getRangeElem();d=a.getLegalTags(f),d&&b(d).after(e)},a.commandHooks=c}}),b(function(a,b){a.fn.command=function(a,b,c,d){function e(){b&&(g.queryCommandSupported(b)?document.execCommand(b,!1,c):(f=g.commandHooks,b in f&&f[b](c)))}var f,g=this;this.customCommand(a,e,d)},a.fn.commandForElem=function(a,b,c,d,e){var f,g;"string"==typeof a?f=a:(f=a.selector,g=a.check);var h=this.getRangeElem();h=this.getSelfOrParentByName(h,f,g),h&&this.setRangeByElem(h),this.command(b,c,d,e)},a.fn.customCommand=function(a,b,c){function d(){e.hideDropPanelAndModal()}var e=this,f=e.currentRange();return f?(e.undoRecord(),this.restoreSelection(f),b.call(e),this.saveSelection(),this.restoreSelection(),c&&"function"==typeof c&&c.call(e),e.txt.insertEmptyP(),e.txt.wrapImgAndText(),e.updateValue(),e.updateMenuStyle(),setTimeout(d,200),void(a&&a.preventDefault())):void(a&&a.preventDefault())},a.fn.queryCommandValue=function(a){var b="";try{b=document.queryCommandValue(a)}catch(c){}return b},a.fn.queryCommandState=function(a){var b=!1;try{b=document.queryCommandState(a)}catch(c){}return b},a.fn.queryCommandSupported=function(a){var b=!1;try{b=document.queryCommandSupported(a)}catch(c){}return b}}),b(function(a,b){function c(a){var c=this,d=b(a),e=!1;return d.each(function(){return this===c?(e=!0,!1):void 0}),e}var d;a.fn.getLegalTags=function(b){var c=this.config.legalTags;return c?this.getSelfOrParentByName(b,c):void a.error("配置项中缺少 legalTags 的配置")},a.fn.getSelfOrParentByName=function(a,e,f){if(a&&e){d||(d=a.webkitMatchesSelector||a.mozMatchesSelector||a.oMatchesSelector||a.matchesSelector),d||(d=c);for(var g=this.txt.$txt.get(0);a&&g!==a&&b.contains(g,a);){if(d.call(a,e)){if(!f)return a;if(f(a))return a}a=a.parentNode}}}}),b(function(a,b){function c(a,b,c){var d=b.val,e=a.txt.$txt.html();if(null!=d){if(d===e)return"redo"===c?void a.redo():"undo"===c?void a.undo():void 0;a.txt.$txt.html(d),a.updateValue(),a.onchange&&"function"==typeof a.onchange&&a.onchange.call(a)}}var d=[],e=[],f=20;a.fn.undoRecord=function(){var a=this,b=a.txt.$txt,c=b.html(),g=e.length?e[0]:"";c!==g.val&&(d.length&&(d=[]),e.unshift({range:a.currentRange(),val:c}),e.length>f&&e.pop())},a.fn.undo=function(){if(e.length){var a=e.shift();d.unshift(a),c(this,a,"undo")}},a.fn.redo=function(){if(d.length){var a=d.shift();e.unshift(a),c(this,a,"redo")}}}),b(function(a,b){a.fn.create=function(){var c=this;a.$body&&0!==a.$body.length||(a.$body=b("body"),a.$document=b(document),a.$window=b(window)),c.addMenus(),c.renderMenus(),c.renderMenuContainer(),c.renderTxt(),c.renderEditorContainer(),c.eventMenus(),c.eventMenuContainer(),c.eventTxt(),c.readyHeadler(),c.initSelection(),c.$txt=c.txt.$txt;var d=a._plugins;d&&d.length&&b.each(d,function(a,b){b.call(c)})},a.fn.disable=function(){this.txt.$txt.removeAttr("contenteditable"),this.disableMenusExcept(),this._disabled=!0},a.fn.enable=function(){this._disabled=!1,this.txt.$txt.attr("contenteditable","true"),this.enableMenusExcept()},a.fn.destroy=function(){var a=this,b=a.$valueContainer,c=a.$editorContainer,d=a.valueNodeName;"div"===d?(b.removeAttr("contenteditable"),c.after(b),c.hide()):(b.show(),c.hide())},a.fn.undestroy=function(){var a=this,b=a.$valueContainer,c=a.$editorContainer,d=a.menuContainer.$menuContainer,e=a.valueNodeName;"div"===e?(b.attr("contenteditable","true"),d.after(b),c.show()):(b.hide(),c.show())},a.fn.clear=function(){var a=this,b=a.txt.$txt;b.html("<p><br></p>"),a.restoreSelectionByElem(b.find("p").get(0))}}),b(function(a,b){var c=function(a){this.editor=a,this.init()};c.fn=c.prototype,a.MenuContainer=c}),b(function(a,b){var c=a.MenuContainer;c.fn.init=function(){var a=this,c=b('<div class="wangEditor-menu-container clearfix"></div>');a.$menuContainer=c,a.changeShadow()},c.fn.changeShadow=function(){var a=this.$menuContainer,b=this.editor,c=b.txt.$txt;c.on("scroll",function(){c.scrollTop()>10?a.addClass("wangEditor-menu-shadow"):a.removeClass("wangEditor-menu-shadow")})}}),b(function(a,b){var c=a.MenuContainer;c.fn.render=function(){var a=this.$menuContainer,b=this.editor.$editorContainer;b.append(a)},c.fn.height=function(){var a=this.$menuContainer;return a.height()},c.fn.appendMenu=function(a,b){return this._addGroup(a),this._addOneMenu(b)},c.fn._addGroup=function(a){var c,d=this.$menuContainer;this.$currentGroup&&this.currentGroupIdx===a||(c=b('<div class="menu-group clearfix"></div>'),d.append(c),this.$currentGroup=c,this.currentGroupIdx=a)},c.fn._addOneMenu=function(a){var c=a.$domNormal,d=a.$domSelected,e=this.$currentGroup,f=b('<div class="menu-item clearfix"></div>');return d.hide(),f.append(c).append(d),e.append(f),f}}),b(function(a,b){var c=function(a){this.editor=a.editor,this.id=a.id,this.title=a.title,this.$domNormal=a.$domNormal,this.$domSelected=a.$domSelected||a.$domNormal,this.commandName=a.commandName,this.commandValue=a.commandValue,this.commandNameSelected=a.commandNameSelected||a.commandName,this.commandValueSelected=a.commandValueSelected||a.commandValue};c.fn=c.prototype,a.Menu=c}),b(function(a,b){var c=a.Menu;c.fn.initUI=function(){var c=this.editor,d=c.UI.menus,e=this.id,f=d[e];this.$domNormal&&this.$domSelected||(null==f&&(a.warn('editor.UI配置中，没有菜单 "'+e+'" 的UI配置，只能取默认值'),f=d["default"]),this.$domNormal=b(f.normal),/^\./.test(f.selected)?this.$domSelected=this.$domNormal.clone().addClass(f.selected.slice(1)):this.$domSelected=b(f.selected))}}),b(function(a,b){var c=a.Menu;c.fn.render=function(a){this.initUI();var b=this.editor,c=b.menuContainer,d=c.appendMenu(a,this),e=this.onRender;this._renderTip(d),e&&"function"==typeof e&&e.call(this)},c.fn._renderTip=function(c){function d(){j.show()}function e(){j.hide()}var f,g=this,h=g.editor,i=g.title,j=b('<div class="menu-tip"></div>');g.tipWidth||(f=b('<p style="opacity:0; filter:Alpha(opacity=0); position:absolute;top:-10000px;">'+i+"</p>"),a.$body.append(f),h.ready(function(){var a=f.outerWidth()+5,b=j.outerWidth(),c=parseFloat(j.css("margin-left"),10);f.remove(),f=null,j.css({width:a,"margin-left":c+(b-a)/2}),g.tipWidth=a})),j.append(i),c.append(j);var k;c.find("a").on("mouseenter",function(a){g.active()||g.disabled()||(k=setTimeout(d,200))}).on("mouseleave",function(a){k&&clearTimeout(k),e()}).on("click",e)},c.fn.bindEvent=function(){var b=this,c=b.$domNormal,d=b.$domSelected,e=b.clickEvent;e||(e=function(c){var d=b.dropPanel||b.dropList||b.modal;if(d&&d.show)return void(d.isShowing?d.hide():d.show());var e,f,g=b.editor,h=b.selected;h?(e=b.commandNameSelected,f=b.commandValueSelected):(e=b.commandName,f=b.commandValue),e?g.command(c,e,f):(a.warn('菜单 "'+b.id+'" 未定义click事件'),c.preventDefault())});var f=b.clickEventSelected||e;c.click(function(a){b.disabled()||(e.call(b,a),b.updateSelected()),a.preventDefault()}),d.click(function(a){b.disabled()||(f.call(b,a),b.updateSelected()),a.preventDefault()})},c.fn.updateSelected=function(){var a=this,b=(a.editor,a.updateSelectedEvent);b||(b=function(){var a=this,b=a.editor,c=a.commandName,d=a.commandValue;if(d){if(b.queryCommandValue(c).toLowerCase()===d.toLowerCase())return!0}else if(b.queryCommandState(c))return!0;return!1});var c=b.call(a);c=!!c,a.changeSelectedState(c)},c.fn.changeSelectedState=function(a){var b=this,c=b.selected;if(null!=a&&"boolean"==typeof a){if(c===a)return;b.selected=a,a?(b.$domNormal.hide(),b.$domSelected.show()):(b.$domNormal.show(),b.$domSelected.hide())}},c.fn.active=function(a){return null==a?this._activeState:void(this._activeState=a)},c.fn.activeStyle=function(a){var b=(this.selected,this.$domNormal),c=this.$domSelected;a?(b.addClass("active"),c.addClass("active")):(b.removeClass("active"),c.removeClass("active")),this.active(a)},c.fn.disabled=function(a){if(null==a)return!!this._disabled;if(this._disabled!==a){var b=this.$domNormal,c=this.$domSelected;a?(b.addClass("disable"),c.addClass("disable")):(b.removeClass("disable"),c.removeClass("disable")),this._disabled=a}}}),b(function(a,b){var c=function(a,b,c){this.editor=a,this.menu=b,this.data=c.data,this.tpl=c.tpl,this.selectorForELemCommand=c.selectorForELemCommand,this.init()};c.fn=c.prototype,a.DropList=c}),b(function(a,b){var c=a.DropList;c.fn.init=function(){var a=this;a.initDOM(),a.bindEvent(),a.initHideEvent()},c.fn.initDOM=function(){var a,c,d=this,e=d.data,f=d.tpl||"<span>{#title}</span>",g=b('<div class="wangEditor-drop-list clearfix"></div>');b.each(e,function(d,e){a=f.replace(/{#commandValue}/gi,d).replace(/{#title}/gi,e),c=b('<a href="#" commandValue="'+d+'"></a>'),c.append(a),g.append(c)}),d.$list=g},c.fn.bindEvent=function(){var a=this,c=a.editor,d=a.menu,e=d.commandName,f=a.selectorForELemCommand,g=a.$list;g.on("click","a[commandValue]",function(a){var g=b(a.currentTarget).attr("commandValue");d.selected&&c.isRangeEmpty()&&f?c.commandForElem(f,a,e,g):c.command(a,e,g)})},c.fn.initHideEvent=function(){var c=this,d=c.$list.get(0);a.$body.on("click",function(a){if(c.isShowing){var e,f=a.target,g=c.menu;e=g.selected?g.$domSelected.get(0):g.$domNormal.get(0),e===f||b.contains(e,f)||d===f||b.contains(d,f)||c.hide()}}),a.$window.scroll(function(){c.hide()}),a.$window.on("resize",function(){c.hide()})}}),b(function(a,b){var c=a.DropList;c.fn._render=function(){var a=this,b=a.editor,c=a.$list;b.$editorContainer.append(c),a.rendered=!0},c.fn._position=function(){var a=this,b=a.$list,c=a.editor,d=a.menu,e=c.menuContainer.$menuContainer,f=d.selected?d.$domSelected:d.$domNormal,g=f.offsetParent().position(),h=g.top,i=g.left,j=f.offsetParent().height(),k=f.offsetParent().width(),l=b.outerWidth(),m=c.txt.$txt.outerWidth(),n=h+j,o=i+k/2,p=0-k/2,q=o+l-m;q>-10&&(p=p-q-10),b.css({top:n,left:o,"margin-left":p}),c._isMenufixed&&(n+=e.offset().top+e.outerHeight()-b.offset().top,b.css({top:n}))},c.fn.show=function(){var a=this,b=a.menu;if(a.rendered||a._render(),!a.isShowing){var c=a.$list;c.show(),a._position(),a.isShowing=!0,b.activeStyle(!0)}},c.fn.hide=function(){var a=this,b=a.menu;if(a.isShowing){var c=a.$list;c.hide(),a.isShowing=!1,b.activeStyle(!1)}}}),b(function(a,b){var c=function(a,b,c){this.editor=a,this.menu=b,this.$content=c.$content,this.width=c.width||200,this.height=c.height,this.onRender=c.onRender,this.init()};c.fn=c.prototype,a.DropPanel=c}),b(function(a,b){var c=a.DropPanel;c.fn.init=function(){var a=this;a.initDOM(),a.initHideEvent()},c.fn.initDOM=function(){var a=this,c=a.$content,d=a.width,e=a.height,f=b('<div class="wangEditor-drop-panel clearfix"></div>'),g=b('<div class="tip-triangle"></div>');f.css({width:d,height:e?e:"auto"}),f.append(g),f.append(c),a.$panel=f,a.$triangle=g},c.fn.initHideEvent=function(){var c=this,d=c.$panel.get(0);a.$body.on("click",function(a){if(c.isShowing){var e,f=a.target,g=c.menu;e=g.selected?g.$domSelected.get(0):g.$domNormal.get(0),e===f||b.contains(e,f)||d===f||b.contains(d,f)||c.hide()}}),a.$window.scroll(function(){c.hide()}),a.$window.on("resize",function(){c.hide()})}}),b(function(a,b){var c=a.DropPanel;c.fn._render=function(){var a=this,b=a.onRender,c=a.editor,d=a.$panel;c.$editorContainer.append(d),b&&b.call(a),a.rendered=!0},c.fn._position=function(){var a=this,b=a.$panel,c=a.$triangle,d=a.editor,e=d.menuContainer.$menuContainer,f=a.menu,g=f.selected?f.$domSelected:f.$domNormal,h=g.offsetParent().position(),i=h.top,j=h.left,k=g.offsetParent().height(),l=g.offsetParent().width(),m=b.outerWidth(),n=d.txt.$txt.outerWidth(),o=i+k,p=j+l/2,q=0-m/2,r=q;0-q>p-10&&(q=0-(p-10));var s=p+m+q-n;s>-10&&(q=q-s-10),b.css({top:o,left:p,"margin-left":q}),d._isMenufixed&&(o+=e.offset().top+e.outerHeight()-b.offset().top,b.css({top:o})),c.css({"margin-left":r-q-5})},c.fn.focusFirstInput=function(){var a=this,c=a.$panel;c.find("input[type=text],textarea").each(function(){var a=b(this);return null==a.attr("disabled")?(a.focus(),!1):void 0})},c.fn.show=function(){var b=this,c=b.menu;if(b.rendered||b._render(),!b.isShowing){var d=b.$panel;d.show(),b._position(),b.isShowing=!0,c.activeStyle(!0),a.w3cRange?b.focusFirstInput():a.placeholderForIE8(d)}},c.fn.hide=function(){var a=this,b=a.menu;if(a.isShowing){var c=a.$panel;c.hide(),a.isShowing=!1,b.activeStyle(!1)}}}),b(function(a,b){var c=function(a,b,c){this.editor=a,this.menu=b,this.$content=c.$content,this.init()};c.fn=c.prototype,a.Modal=c}),b(function(a,b){var c=a.Modal;c.fn.init=function(){var a=this;a.initDom(),a.initHideEvent()},c.fn.initDom=function(){var a=this,c=a.$content,d=b('<div class="wangEditor-modal"></div>'),e=b('<div class="wangEditor-modal-close"><i class="wangeditor-menu-img-cancel-circle"></i></div>');d.append(e),d.append(c),a.$modal=d,a.$close=e},c.fn.initHideEvent=function(){var c=this,d=c.$close,e=c.$modal.get(0);d.click(function(){c.hide()}),a.$body.on("click",function(a){if(c.isShowing){var d,f=a.target,g=c.menu;g&&(d=g.selected?g.$domSelected.get(0):g.$domNormal.get(0),d===f||b.contains(d,f))||e===f||b.contains(e,f)||c.hide()}})}}),b(function(a,b){var c=a.Modal;c.fn._render=function(){var b=this,c=b.editor,d=b.$modal;d.css("z-index",c.config.zindex+10+""),a.$body.append(d),b.rendered=!0},c.fn._position=function(){var b=this,c=b.$modal,d=c.offset().top,e=c.outerWidth(),f=c.outerHeight(),g=0-e/2,h=0-f/2,i=a.$window.scrollTop();f/2>d&&(h=0-d),c.css({"margin-left":g+"px","margin-top":h+i+"px"})},c.fn.show=function(){var a=this,b=a.menu;if(a.rendered||a._render(),!a.isShowing){a.isShowing=!0;var c=a.$modal;c.show(),a._position(),b&&b.activeStyle(!0)}},c.fn.hide=function(){var a=this,b=a.menu;if(a.isShowing){a.isShowing=!1;var c=a.$modal;c.hide(),b&&b.activeStyle(!1)}}}),b(function(a,b){var c=function(a){this.editor=a,this.init()};c.fn=c.prototype,a.Txt=c}),b(function(a,b){var c=a.Txt;c.fn.init=function(){var a,c=this,d=c.editor,e=d.$valueContainer,f=d.getInitValue();"DIV"===e.get(0).nodeName?(a=e,a.addClass("wangEditor-txt"),a.attr("contentEditable","true")):a=b('<div class="wangEditor-txt" contentEditable="true">'+f+"</div>"),d.ready(function(){c.insertEmptyP()}),c.$txt=a,c.contentEmptyHandle(),c.bindEnterForDiv(),c.bindEnterForText(),c.bindTabEvent(),c.bindPasteFilter(),c.bindFormatText(),c.bindHtml()},c.fn.contentEmptyHandle=function(){var a,c=this,d=c.editor,e=c.$txt;e.on("keyup",function(c){if(8===c.keyCode){var f=b.trim(e.html());f&&"<br>"!==f||(a=b("<p><br/></p>"),e.html(""),e.append(a),d.restoreSelectionByElem(a.get(0)))}})},c.fn.bindEnterForDiv=function(){function c(){if(d){var a=b("<p>"+d.html()+"</p>");d.after(a),d.remove()}}var d,e=(a.config.legalTags,this),f=e.editor,g=e.$txt;g.on("keydown keyup",function(a){if(13===a.keyCode){var e,g,h=f.getRangeElem(),i=f.getLegalTags(h);if(!i){if(i=f.getSelfOrParentByName(h,"div"),!i)return;e=b(i),"keydown"===a.type&&(d=e,setTimeout(c,0)),"keyup"===a.type&&(g=b("<p>"+e.html()+"</p>"),e.after(g),e.remove(),f.restoreSelectionByElem(g.get(0),"start"))}}})},c.fn.bindEnterForText=function(){var a,b=this,c=b.$txt;c.on("keyup",function(c){13===c.keyCode&&(a||(a=function(){b.wrapImgAndText()}),setTimeout(a))})},c.fn.bindTabEvent=function(){var a=this,b=a.editor,c=a.$txt;c.on("keydown",function(a){9===a.keyCode&&b.queryCommandSupported("insertHtml")&&b.command(a,"insertHtml","&nbsp;&nbsp;&nbsp;&nbsp;")})},c.fn.bindPasteFilter=function(){function a(e){if(e&&e.nodeType&&e.nodeName){var f,h=e.nodeName.toLowerCase(),i=e.nodeType;if(3===i||1===i){if(f=b(e),"div"===h)return void b.each(e.childNodes,function(){a(this)});if(j.indexOf(h)>=0)g+=c(e);else if(3===i)g+="<p>"+e.textContent+"</p>";else if("br"===h)g+="<br/>";else{if(["meta","style","script","object","form","iframe","hr"].indexOf(h)>=0)return;f=b(d(e)),g+=b("<div>").append(f.clone()).html()}}}}function c(a){var c,e=a.nodeName.toLowerCase(),f="",g="";return["blockquote"].indexOf(e)>=0?(c=b(a),"<"+e+">"+c.text()+"</"+e+">"):["p","h1","h2","h3","h4","h5"].indexOf(e)>=0?(a=d(a),c=b(a),f=c.html(),f=f.replace(/<.*?>/gi,function(a){return"</a>"===a||0===a.indexOf("<a ")||0===a.indexOf("<img ")?a:""}),"<"+e+">"+f+"</"+e+">"):["ul","ol"].indexOf(e)>=0?(c=b(a),c.children().each(function(){var a=b(d(this)),c=a.html();c=c.replace(/<.*?>/gi,function(a){return"</a>"===a||0===a.indexOf("<a ")||0===a.indexOf("<img ")?a:""}),g+="<li>"+c+"</li>"}),"<"+e+">"+g+"</"+e+">"):(c=b(d(a)),b("<div>").append(c).html())}function d(a){var c=a.attributes||[],e=[],f=["href","target","src","alt","rowspan","colspan"];b.each(c,function(a,b){b&&2===b.nodeType&&e.push(b.nodeName)}),b.each(e,function(b,c){f.indexOf(c)<0&&a.removeAttribute(c)});var g=a.childNodes;return g.length&&b.each(g,function(a,b){d(b)}),a}var e=this,f=e.editor,g="",h=e.$txt,i=f.config.legalTags,j=i.split(",");h.on("paste",function(c){if(f.config.pasteFilter){var d=f.getRangeElem().nodeName;if("TD"!==d&&"TH"!==d){g="";var h,i,j=c.clipboardData||c.originalEvent.clipboardData;if(j&&j.getData)h=j.getData("text/html"),h?(i=b("<div>"+h+"</div>"),a(i.get(0))):(h=j.getData("text/plain"),h&&(h=h.replace(/[ ]/g,"&nbsp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\n/g,"</p><p>"),g="<p>"+h+"</p>",g=g.replace(/<p>(https?:\/\/.*?)<\/p>/gi,function(a,b){return'<p><a href="'+b+'" target="_blank">'+b+"</p>"})));else{if(!window.clipboardData||!window.clipboardData.getData)return;if(g=window.clipboardData.getData("text"),!g)return;g="<p>"+g+"</p>",g=g.replace((new RegExp("\n","g"),"</p><p>"))}g&&(f.command(c,"insertHtml",g),e.clearEmptyOrNestP())}}})},c.fn.bindFormatText=function(){var c=this,d=(c.editor,c.$txt),e=a.config.legalTags,f=e.split(","),g=(f.length,[]);b.each(f,function(a,b){var c=">\\s*<("+b+")>";g.push(new RegExp(c,"ig"))}),g.push(new RegExp(">\\s*<(li)>","ig")),g.push(new RegExp(">\\s*<(tr)>","ig")),g.push(new RegExp(">\\s*<(code)>","ig")),d.formatText=function(){var a=b("<div>"),c=d.html();return c=c.replace(/\s*</gi,"<"),b.each(g,function(a,b){b.test(c)&&(c=c.replace(b,function(a,b){return">\n<"+b+">"}))}),a.html(c),a.text()}},c.fn.bindHtml=function(){var a=this,c=a.editor,d=a.$txt,e=c.$valueContainer,f=c.valueNodeName;d.html=function(a){var c;return"div"===f&&(c=b.fn.html.call(d,a)),void 0===a?c=b.fn.html.call(d):(c=b.fn.html.call(d,a),e.val(a)),void 0===a?c:void 0}}}),b(function(a,b){var c=a.Txt,d="propertychange change click keyup input paste";c.fn.render=function(){var a=this.$txt,b=this.editor.$editorContainer;b.append(a)},c.fn.initHeight=function(){var a=this.editor,b=this.$txt,c=a.$valueContainer.height(),d=a.menuContainer.height(),e=c-d;e=50>e?50:e,b.height(e),a.valueContainerHeight=c,this.initMaxHeight(e,d)},c.fn.initMaxHeight=function(a,c){var d=this.editor,e=d.menuContainer.$menuContainer,f=this.$txt,g=b("<div>");if(window.getComputedStyle&&"max-height"in window.getComputedStyle(f.get(0))){var h=parseInt(d.$valueContainer.css("max-height"));if(isNaN(h))return;d.useMaxHeight=!0,g.css({"max-height":h-c+"px","overflow-y":"auto"}),f.css({height:"auto","overflow-y":"visible","min-height":a+"px"}),g.on("scroll",function(){f.parent().scrollTop()>10?e.addClass("wangEditor-menu-shadow"):e.removeClass("wangEditor-menu-shadow")}),f.wrap(g)}},c.fn.saveSelectionEvent=function(){function a(){g.saveSelection()}function b(){Date.now()-h<100||(h=Date.now(),a())}function c(){e&&clearTimeout(e),e=setTimeout(a,300)}var e,f=this.$txt,g=this.editor,h=Date.now();f.on(d+" focus blur",function(a){b(),c()}),f.on("mousedown",function(){f.on("mouseleave.saveSelection",function(a){b(),c(),g.updateMenuStyle()})}).on("mouseup",function(){f.off("mouseleave.saveSelection")})},c.fn.updateValueEvent=function(){function a(){var a=e.html();c!==a&&(f.onchange&&"function"==typeof f.onchange&&f.onchange.call(f),f.updateValue(),c=a)}var b,c,e=this.$txt,f=this.editor;e.on(d,function(d){null==c&&(c=e.html()),b&&clearTimeout(b),b=setTimeout(a,100)})},c.fn.updateMenuStyleEvent=function(){var a=this.$txt,b=this.editor;a.on(d,function(a){b.updateMenuStyle()})},c.fn.insertEmptyP=function(){var a=this.$txt,c=a.children();return 0===c.length?void a.append(b("<p><br></p>")):void("<br>"!==c.last().html()&&a.append(b("<p><br></p>")))},c.fn.wrapImgAndText=function(){var a,c,d=this.$txt,e=d.children("img"),f=d[0],g=f.childNodes,h=g.length;for(e.length&&e.each(function(){b(this).wrap("<p>")}),a=0;h>a;a++)c=g[a],3===c.nodeType&&c.textContent&&b.trim(c.textContent)&&b(c).wrap("<p>")},c.fn.clearEmptyOrNestP=function(){var a=this.$txt,c=a.find("p");c.each(function(){var a,c=b(this),d=c.children(),e=d.length,f=b.trim(c.html());return f?void(1===e&&(a=d.first(),a.get(0)&&"P"===a.get(0).nodeName&&c.html(a.html()))):void c.remove()})},c.fn.scrollTop=function(a){var b=this,c=b.editor,d=b.$txt;return c.useMaxHeight?d.parent().scrollTop(a):d.scrollTop(a)},c.fn.showHeightOnHover=function(){function a(a){i||(e.append(h),i=!0);var b=(g.position().top,g.outerHeight(),a.height()),c=a.position().top,d=parseInt(a.css("margin-top"),10),j=parseInt(a.css("padding-top"),10),k=parseInt(a.css("margin-bottom"),10),l=parseInt(a.css("padding-bottom"),10);c+f.height();h.css({height:b+j+d+l+k,top:c+f.height()})}function c(){i&&(h.remove(),i=!1)}var d=this.editor,e=d.$editorContainer,f=d.menuContainer,g=this.$txt,h=b('<i class="height-tip"><i>'),i=!1;g.on("mouseenter","ul,ol,blockquote,p,h1,h2,h3,h4,h5,table,pre",function(c){a(b(c.currentTarget))}).on("mouseleave",function(){c()})}}),b(function(a,b){Array.prototype.indexOf||(Array.prototype.indexOf=function(a){for(var b=0,c=this.length;c>b;b++)if(this[b]===a)return b;return-1},Array.prototype.lastIndexOf=function(a){var b=this.length;for(b-=1;b>=0;b--)if(this[b]===a)return b;return-1}),Date.now||(Date.now=function(){return(new Date).valueOf()});var c=window.console,d=function(){};b.each(["info","log","warn","error"],function(b,e){null==c?a[e]=d:a[e]=function(b){a.config&&a.config.printLog&&c[e]("wangEditor提示: "+b)}}),a.random=function(){return Math.random().toString().slice(2)},a.placeholder="placeholder"in document.createElement("input"),a.placeholderForIE8=function(c){a.placeholder||c.find("input[placeholder]").each(function(){var a=b(this),c=a.attr("placeholder");""===a.val()&&(a.css("color","#666"),a.val(c),a.on("focus.placeholder click.placeholder",function(){a.val(""),a.css("color","#333"),a.off("focus.placeholder click.placeholder")}))})}}),b(function(a,b){a.langs={},a.langs["zh-cn"]={bold:"粗体",underline:"下划线",italic:"斜体",forecolor:"文字颜色",bgcolor:"背景色",strikethrough:"删除线",eraser:"清空格式",source:"源码",quote:"引用",fontfamily:"字体",fontsize:"字号",head:"标题",orderlist:"有序列表",unorderlist:"无序列表",alignleft:"左对齐",aligncenter:"居中",alignright:"右对齐",link:"链接",text:"文本",submit:"提交",cancel:"取消",unlink:"取消链接",table:"表格",emotion:"表情",img:"图片",video:"视频",width:"宽",height:"高",location:"位置",loading:"加载中",searchlocation:"搜索位置",dynamicMap:"动态地图",clearLocation:"清除位置",langDynamicOneLocation:"动态地图只能显示一个位置",insertcode:"插入代码",undo:"撤销",redo:"重复",fullscreen:"全屏"},a.langs.en={bold:"Bold",underline:"Underline",italic:"Italic",forecolor:"Color",bgcolor:"Backcolor",strikethrough:"Strikethrough",eraser:"Eraser",source:"Codeview",quote:"Quote",fontfamily:"Font family",fontsize:"Font size",head:"Head",orderlist:"Ordered list",unorderlist:"Unordered list",alignleft:"Align left",aligncenter:"Align center",alignright:"Align right",link:"Insert link",text:"Text",submit:"Submit",cancel:"Cancel",unlink:"Unlink",table:"Table",emotion:"Emotions",img:"Image",video:"Video",width:"width",height:"height",location:"Location",loading:"Loading",searchlocation:"search",dynamicMap:"Dynamic",clearLocation:"Clear",langDynamicOneLocation:"Only one location in dynamic map",insertcode:"Insert Code",undo:"Undo",redo:"Redo",fullscreen:"Full screnn"}}),b(function(a,b){a.config={},a.config.zindex=1e4,a.config.printLog=!0,a.config.menuFixed=0,a.config.jsFilter=!0,a.config.legalTags="p,h1,h2,h3,h4,h5,h6,blockquote,table,ul,ol,pre",a.config.lang=a.langs["zh-cn"],a.config.menus=["source","|","bold","underline","italic","strikethrough","eraser","forecolor","bgcolor","|","quote","fontfamily","fontsize","head","unorderlist","orderlist","alignleft","aligncenter","alignright","|","link","unlink","table","emotion","|","img","video","location","insertcode","|","undo","redo","fullscreen"],a.config.colors={"#880000":"暗红色","#800080":"紫色","#ff0000":"红色","#ff00ff":"鲜粉色","#000080":"深蓝色","#0000ff":"蓝色","#00ffff":"湖蓝色","#008080":"蓝绿色","#008000":"绿色","#808000":"橄榄色","#00ff00":"浅绿色","#ffcc00":"橙黄色","#808080":"灰色","#c0c0c0":"银色","#000000":"黑色","#ffffff":"白色"},a.config.familys=["宋体","黑体","楷体","微软雅黑","Arial","Verdana","Georgia","Times New Roman","Microsoft JhengHei","Trebuchet MS","Courier New","Impact","Comic Sans MS"],a.config.fontsizes={1:"10px",2:"13px",3:"16px",4:"19px",5:"22px",6:"25px",7:"28px"},a.config.emotionsShow="icon",a.config.emotions={"default":{title:"默认",data:"./emotions.data"},weibo:{title:"微博表情",data:[{icon:"http://img.t.sinajs.cn/t35/style/images/common/face/ext/normal/7a/shenshou_thumb.gif",value:"[草泥马]"},{icon:"http://img.t.sinajs.cn/t35/style/images/common/face/ext/normal/60/horse2_thumb.gif",value:"[神马]"},{icon:"http://img.t.sinajs.cn/t35/style/images/common/face/ext/normal/bc/fuyun_thumb.gif",value:"[浮云]"},{icon:"http://img.t.sinajs.cn/t35/style/images/common/face/ext/normal/c9/geili_thumb.gif",value:"[给力]"},{icon:"http://img.t.sinajs.cn/t35/style/images/common/face/ext/normal/f2/wg_thumb.gif",value:"[围观]"},{icon:"http://img.t.sinajs.cn/t35/style/images/common/face/ext/normal/70/vw_thumb.gif",value:"[威武]"},{icon:"http://img.t.sinajs.cn/t35/style/images/common/face/ext/normal/6e/panda_thumb.gif",value:"[熊猫]"},{icon:"http://img.t.sinajs.cn/t35/style/images/common/face/ext/normal/81/rabbit_thumb.gif",value:"[兔子]"},{icon:"http://img.t.sinajs.cn/t35/style/images/common/face/ext/normal/bc/otm_thumb.gif",value:"[奥特曼]"},{icon:"http://img.t.sinajs.cn/t35/style/images/common/face/ext/normal/15/j_thumb.gif",value:"[囧]"},{icon:"http://img.t.sinajs.cn/t35/style/images/common/face/ext/normal/89/hufen_thumb.gif",value:"[互粉]"},{icon:"http://img.t.sinajs.cn/t35/style/images/common/face/ext/normal/c4/liwu_thumb.gif",value:"[礼物]"},{icon:"http://img.t.sinajs.cn/t35/style/images/common/face/ext/normal/ac/smilea_thumb.gif",value:"[呵呵]"},{icon:"http://img.t.sinajs.cn/t35/style/images/common/face/ext/normal/0b/tootha_thumb.gif",value:"[哈哈]"}]}},a.config.mapAk="TVhjYjq1ICT2qqL5LdS8mwas",a.config.uploadImgUrl="",a.config.uploadTimeout=2e4,a.config.uploadImgFns={},a.config.customUpload=!1,a.config.pasteFilter=!0}),b(function(a,b){a.UI={},a.UI.menus={"default":{normal:'<a href="#" tabindex="-1"><i class="wangeditor-menu-img-command"></i></a>',selected:".selected"},bold:{normal:'<a href="#" tabindex="-1"><i class="wangeditor-menu-img-bold"></i></a>',selected:".selected"},underline:{normal:'<a href="#" tabindex="-1"><i class="wangeditor-menu-img-underline"></i></a>',selected:".selected"},italic:{normal:'<a href="#" tabindex="-1"><i class="wangeditor-menu-img-italic"></i></a>',selected:".selected"},forecolor:{normal:'<a href="#" tabindex="-1"><i class="wangeditor-menu-img-pencil"></i></a>',selected:".selected"},bgcolor:{normal:'<a href="#" tabindex="-1"><i class="wangeditor-menu-img-brush"></i></a>',selected:".selected"
},strikethrough:{normal:'<a href="#" tabindex="-1"><i class="wangeditor-menu-img-strikethrough"></i></a>',selected:".selected"},eraser:{normal:'<a href="#" tabindex="-1"><i class="wangeditor-menu-img-eraser"></i></a>',selected:".selected"},quote:{normal:'<a href="#" tabindex="-1"><i class="wangeditor-menu-img-quotes-left"></i></a>',selected:".selected"},source:{normal:'<a href="#" tabindex="-1"><i class="wangeditor-menu-img-code"></i></a>',selected:".selected"},fontfamily:{normal:'<a href="#" tabindex="-1"><i class="wangeditor-menu-img-font2"></i></a>',selected:".selected"},fontsize:{normal:'<a href="#" tabindex="-1"><i class="wangeditor-menu-img-text-height"></i></a>',selected:".selected"},head:{normal:'<a href="#" tabindex="-1"><i class="wangeditor-menu-img-header"></i></a>',selected:".selected"},orderlist:{normal:'<a href="#" tabindex="-1"><i class="wangeditor-menu-img-list-numbered"></i></a>',selected:".selected"},unorderlist:{normal:'<a href="#" tabindex="-1"><i class="wangeditor-menu-img-list-bullet"></i></a>',selected:".selected"},alignleft:{normal:'<a href="#" tabindex="-1"><i class="wangeditor-menu-img-align-left"></i></a>',selected:".selected"},aligncenter:{normal:'<a href="#" tabindex="-1"><i class="wangeditor-menu-img-align-center"></i></a>',selected:".selected"},alignright:{normal:'<a href="#" tabindex="-1"><i class="wangeditor-menu-img-align-right"></i></a>',selected:".selected"},link:{normal:'<a href="#" tabindex="-1"><i class="wangeditor-menu-img-link"></i></a>',selected:".selected"},unlink:{normal:'<a href="#" tabindex="-1"><i class="wangeditor-menu-img-unlink"></i></a>',selected:".selected"},table:{normal:'<a href="#" tabindex="-1"><i class="wangeditor-menu-img-table"></i></a>',selected:".selected"},emotion:{normal:'<a href="#" tabindex="-1"><i class="wangeditor-menu-img-happy"></i></a>',selected:".selected"},img:{normal:'<a href="#" tabindex="-1"><i class="wangeditor-menu-img-picture"></i></a>',selected:".selected"},video:{normal:'<a href="#" tabindex="-1"><i class="wangeditor-menu-img-play"></i></a>',selected:".selected"},location:{normal:'<a href="#" tabindex="-1"><i class="wangeditor-menu-img-location"></i></a>',selected:".selected"},insertcode:{normal:'<a href="#" tabindex="-1"><i class="wangeditor-menu-img-terminal"></i></a>',selected:".selected"},undo:{normal:'<a href="#" tabindex="-1"><i class="wangeditor-menu-img-ccw"></i></a>',selected:".selected"},redo:{normal:'<a href="#" tabindex="-1"><i class="wangeditor-menu-img-cw"></i></a>',selected:".selected"},fullscreen:{normal:'<a href="#" tabindex="-1"><i class="wangeditor-menu-img-enlarge2"></i></a>',selected:'<a href="#" tabindex="-1" class="selected"><i class="wangeditor-menu-img-shrink2"></i></a>'}}}),b(function(a,b){a.fn.initDefaultConfig=function(){var c=this;c.config=b.extend({},a.config),c.UI=b.extend({},a.UI)}}),b(function(a,b){a.fn.addEditorContainer=function(){this.$editorContainer=b('<div class="wangEditor-container"></div>')}}),b(function(a,b){a.fn.addTxt=function(){var b=this,c=new a.Txt(b);b.txt=c}}),b(function(a,b){a.fn.addMenuContainer=function(){var b=this;b.menuContainer=new a.MenuContainer(b)}}),b(function(a,b){a.createMenuFns=[],a.createMenu=function(b){a.createMenuFns.push(b)},a.fn.addMenus=function(){function c(a){return e.indexOf(a)>=0?!0:!1}var d=this,e=d.config.menus;b.each(a.createMenuFns,function(a,b){b.call(d,c)})}}),b(function(a,b){a.createMenu(function(b){var c="bold";if(b(c)){var d=this,e=d.config.lang,f=new a.Menu({editor:d,id:c,title:e.bold,commandName:"Bold"});f.clickEventSelected=function(a){var b=d.isRangeEmpty();b?d.commandForElem("b,strong,h1,h2,h3,h4,h5",a,"Bold"):d.command(a,"Bold")},d.menus[c]=f}})}),b(function(a,b){a.createMenu(function(b){var c="underline";if(b(c)){var d=this,e=d.config.lang,f=new a.Menu({editor:d,id:c,title:e.underline,commandName:"Underline"});f.clickEventSelected=function(a){var b=d.isRangeEmpty();b?d.commandForElem("u,a",a,"Underline"):d.command(a,"Underline")},d.menus[c]=f}})}),b(function(a,b){a.createMenu(function(b){var c="italic";if(b(c)){var d=this,e=d.config.lang,f=new a.Menu({editor:d,id:c,title:e.italic,commandName:"Italic"});f.clickEventSelected=function(a){var b=d.isRangeEmpty();b?d.commandForElem("i",a,"Italic"):d.command(a,"Italic")},d.menus[c]=f}})}),b(function(a,b){a.createMenu(function(c){var d="forecolor";if(c(d)){var e=this,f=e.config.lang,g=e.config.colors,h=new a.Menu({editor:e,id:d,title:f.forecolor}),i=b("<div></div>");b.each(g,function(a,b){i.append(['<a href="#" class="color-item"','    title="'+b+'" commandValue="'+a+'" ','    style="color: '+a+'" ','><i class="wangeditor-menu-img-pencil"></i></a>'].join(""))}),i.on("click","a[commandValue]",function(a){var c=b(this),d=c.attr("commandValue");h.selected&&e.isRangeEmpty()?e.commandForElem("font[color]",a,"forecolor",d):e.command(a,"forecolor",d)}),h.dropPanel=new a.DropPanel(e,h,{$content:i,width:125}),h.updateSelectedEvent=function(){var a=e.getRangeElem();return a=e.getSelfOrParentByName(a,"font[color]"),a?!0:!1},e.menus[d]=h}})}),b(function(a,b){a.createMenu(function(c){function d(a){var b;return a&&a.style&&null!=a.style.cssText&&(b=a.style.cssText,b&&b.indexOf("background-color:")>=0)?!0:!1}var e="bgcolor";if(c(e)){var f=this,g=f.config.lang,h=f.config.colors,i=new a.Menu({editor:f,id:e,title:g.bgcolor}),j=b("<div></div>");b.each(h,function(a,b){j.append(['<a href="#" class="color-item"','    title="'+b+'" commandValue="'+a+'" ','    style="color: '+a+'" ','><i class="wangeditor-menu-img-brush"></i></a>'].join(""))}),j.on("click","a[commandValue]",function(a){var c=b(this),e=c.attr("commandValue");i.selected&&f.isRangeEmpty()?f.commandForElem({selector:"span,font",check:d},a,"BackColor",e):f.command(a,"BackColor",e)}),i.dropPanel=new a.DropPanel(f,i,{$content:j,width:125}),i.updateSelectedEvent=function(){var a=f.getRangeElem();return a=f.getSelfOrParentByName(a,"span,font",d),a?!0:!1},f.menus[e]=i}})}),b(function(a,b){a.createMenu(function(b){var c="strikethrough";if(b(c)){var d=this,e=d.config.lang,f=new a.Menu({editor:d,id:c,title:e.strikethrough,commandName:"StrikeThrough"});f.clickEventSelected=function(a){var b=d.isRangeEmpty();b?d.commandForElem("strike",a,"StrikeThrough"):d.command(a,"StrikeThrough")},d.menus[c]=f}})}),b(function(a,b){a.createMenu(function(c){var d="eraser";if(c(d)){var e=this,f=e.config.lang,g=new a.Menu({editor:e,id:d,title:f.eraser,commandName:"RemoveFormat"});g.clickEvent=function(a){function c(){var a,c,d,e,f,h,i,j=this;a=j.getRangeElem(),e=j.getSelfOrParentByName(a,"blockquote"),e&&(f=b(e),g=b("<p>"+f.text()+"</p>"),f.after(g).remove()),c=j.getSelfOrParentByName(a,"p,h1,h2,h3,h4,h5"),c&&(d=b(c),g=b("<p>"+d.text()+"</p>"),d.after(g).remove()),h=j.getSelfOrParentByName(a,"ul,ol"),h&&(i=b(h),g=b("<p>"+i.text()+"</p>"),i.after(g).remove())}function d(){var a=this;g&&a.restoreSelectionByElem(g.get(0))}var f=e.isRangeEmpty();if(!f)return void e.command(a,"RemoveFormat");var g;e.customCommand(a,c,d)},e.menus[d]=g}})}),b(function(a,b){a.createMenu(function(c){function d(){var a=i.$codeTextarea,b=g.txt.$txt,c=a.val();g.config.jsFilter&&(c=c.replace(/<script[\s\S]*?<\/script>/gi,"")),b.html(c)}var e="source";if(c(e)){var f,g=this,h=g.config.lang,i=new a.Menu({editor:g,id:e,title:h.source});i.isShowCode=!1,i.clickEvent=function(a){var c=this,d=c.editor,e=d.txt.$txt,g=e.outerHeight(),h=e.height();c.$codeTextarea||(c.$codeTextarea=b('<textarea class="code-textarea"></textarea>'));var j=c.$codeTextarea;j.css({height:h,"margin-top":g-h}),j.val(e.html()),e.after(j).hide(),j.show(),i.isShowCode=!0,this.updateSelected(),d.disableMenusExcept("source"),f=e.html()},i.clickEventSelected=function(a){var b=this,c=b.editor,e=c.txt.$txt,g=b.$codeTextarea;g&&(d(),g.after(e).hide(),e.show(),i.isShowCode=!1,this.updateSelected(),c.enableMenusExcept("source"),e.html()!==f&&c.onchange&&"function"==typeof c.onchange&&c.onchange.call(c))},i.updateSelectedEvent=function(){return this.isShowCode},g.menus[e]=i}})}),b(function(a,b){a.createMenu(function(c){var d="quote";if(c(d)){var e=this,f=e.config.lang,g=new a.Menu({editor:e,id:d,title:f.quote,commandName:"formatBlock",commandValue:"blockquote"});g.clickEvent=function(a){function c(){h=b("<p>"+f.text()+"</p>"),f.after(h).remove(),h.wrap("<blockquote>")}function d(){var a=this;h&&a.restoreSelectionByElem(h.get(0))}var f,g=e.getRangeElem();if(!g)return void a.preventDefault();var h,i=e.getSelfOrParentByName(g,"blockquote");return i?void a.preventDefault():(g=e.getLegalTags(g),f=b(g),f.text()?g?void e.customCommand(a,c,d):void e.command(a,"formatBlock","blockquote"):void 0)},g.clickEventSelected=function(a){function c(){var a,c;return a=b(g),c=a.children(),c.length?(c.each(function(c){var d=b(this);"P"===d.get(0).nodeName?a.after(d):a.after("<p>"+d.text()+"</p>"),h=d}),void a.remove()):void 0}function d(){var a=this;h&&a.restoreSelectionByElem(h.get(0))}var f,g,h;return f=e.getRangeElem(),(g=e.getSelfOrParentByName(f,"blockquote"))?void e.customCommand(a,c,d):void a.preventDefault()},g.updateSelectedEvent=function(){var a,b=this,c=b.editor;return a=c.getRangeElem(),a=c.getSelfOrParentByName(a,"blockquote"),a?!0:!1},e.menus[d]=g,e.ready(function(){var a=this,c=a.txt.$txt,d=!1;c.on("keydown",function(c){if(13!==c.keyCode)return void(d=!1);var e=a.getRangeElem();if(e=a.getSelfOrParentByName(e,"blockquote"),!e)return void(d=!1);if(!d)return void(d=!0);var f=a.getRangeElem(),g=b(f);g.length&&g.parent().after(g),a.restoreSelectionByElem(f,"start"),d=!1,c.preventDefault()})}),e.ready(function(){function a(){d&&d.remove()}function c(){if(d){var a=d.prev();a.length?e.restoreSelectionByElem(a.get(0)):e.initSelection()}}var d,e=this,f=e.txt.$txt;f.on("keydown",function(f){if(8===f.keyCode){var g=e.getRangeElem();if(g=e.getSelfOrParentByName(g,"blockquote")){d=b(g);var h=d.text();h||e.customCommand(f,a,c)}}})})}})}),b(function(a,b){a.createMenu(function(c){var d="fontfamily";if(c(d)){var e=this,f=e.config.lang,g=e.config.familys,h=new a.Menu({editor:e,id:d,title:f.fontfamily,commandName:"fontName"}),i={};b.each(g,function(a,b){i[b]=b});var j='<span style="font-family:{#commandValue};">{#title}</span>';h.dropList=new a.DropList(e,h,{data:i,tpl:j,selectorForELemCommand:"font[face]"}),h.updateSelectedEvent=function(){var a=e.getRangeElem();return a=e.getSelfOrParentByName(a,"font[face]"),a?!0:!1},e.menus[d]=h}})}),b(function(a,b){a.createMenu(function(b){var c="fontsize";if(b(c)){var d=this,e=d.config.lang,f=d.config.fontsizes,g=new a.Menu({editor:d,id:c,title:e.fontsize,commandName:"fontSize"}),h=f,i='<span style="font-size:{#title};">{#title}</span>';g.dropList=new a.DropList(d,g,{data:h,tpl:i,selectorForELemCommand:"font[size]"}),g.updateSelectedEvent=function(){var a=d.getRangeElem();return a=d.getSelfOrParentByName(a,"font[size]"),a?!0:!1},d.menus[c]=g}})}),b(function(a,b){a.createMenu(function(b){var c="head";if(b(c)){var d=this,e=d.config.lang,f=new a.Menu({editor:d,id:c,title:e.head,commandName:"formatBlock"}),g={"<h1>":"标题1","<h2>":"标题2","<h3>":"标题3","<h4>":"标题4","<h5>":"标题5"},h="{#commandValue}{#title}";f.dropList=new a.DropList(d,f,{data:g,tpl:h}),f.updateSelectedEvent=function(){var a=d.getRangeElem();return a=d.getSelfOrParentByName(a,"h1,h2,h3,h4,h5"),a?!0:!1},d.menus[c]=f}})}),b(function(a,b){a.createMenu(function(b){var c="unorderlist";if(b(c)){var d=this,e=d.config.lang,f=new a.Menu({editor:d,id:c,title:e.unorderlist,commandName:"InsertUnorderedList"});d.menus[c]=f}})}),b(function(a,b){a.createMenu(function(b){var c="orderlist";if(b(c)){var d=this,e=d.config.lang,f=new a.Menu({editor:d,id:c,title:e.orderlist,commandName:"InsertOrderedList"});d.menus[c]=f}})}),b(function(a,b){a.createMenu(function(b){var c="alignleft";if(b(c)){var d=this,e=d.config.lang,f=new a.Menu({editor:d,id:c,title:e.alignleft,commandName:"JustifyLeft"});f.updateSelectedEvent=function(){var a=d.getRangeElem();return a=d.getSelfOrParentByName(a,"p,h1,h2,h3,h4,h5,li",function(a){var b;return a&&a.style&&null!=a.style.cssText&&(b=a.style.cssText,b&&/text-align:\s*left;/.test(b))?!0:!1}),a?!0:!1},d.menus[c]=f}})}),b(function(a,b){a.createMenu(function(b){var c="aligncenter";if(b(c)){var d=this,e=d.config.lang,f=new a.Menu({editor:d,id:c,title:e.aligncenter,commandName:"JustifyCenter"});f.updateSelectedEvent=function(){var a=d.getRangeElem();return a=d.getSelfOrParentByName(a,"p,h1,h2,h3,h4,h5,li",function(a){var b;return a&&a.style&&null!=a.style.cssText&&(b=a.style.cssText,b&&/text-align:\s*center;/.test(b))?!0:!1}),a?!0:!1},d.menus[c]=f}})}),b(function(a,b){a.createMenu(function(b){var c="alignright";if(b(c)){var d=this,e=d.config.lang,f=new a.Menu({editor:d,id:c,title:e.alignright,commandName:"JustifyRight"});f.updateSelectedEvent=function(){var a=d.getRangeElem();return a=d.getSelfOrParentByName(a,"p,h1,h2,h3,h4,h5,li",function(a){var b;return a&&a.style&&null!=a.style.cssText&&(b=a.style.cssText,b&&/text-align:\s*right;/.test(b))?!0:!1}),a?!0:!1},d.menus[c]=f}})}),b(function(a,b){a.createMenu(function(c){var d="link";if(c(d)){var e=this,f=e.config.lang,g=new a.Menu({editor:e,id:d,title:f.link}),h=b("<div></div>"),i=b('<div style="margin:20px 10px;" class="clearfix"></div>'),j=i.clone(),k=i.clone().css("margin","0 10px"),l=b('<input type="text" class="block" placeholder="'+f.text+'"/>'),m=b('<input type="text" class="block" placeholder="'+f.link+'"/>'),n=b('<button class="right">'+f.submit+"</button>"),o=b('<button class="right gray">'+f.cancel+"</button>");i.append(l),j.append(m),k.append(n).append(o),h.append(i).append(j).append(k),g.dropPanel=new a.DropPanel(e,g,{$content:h,width:300}),g.clickEvent=function(a){var b=this,c=b.dropPanel;if(c.isShowing)return void c.hide();l.val(""),m.val("");var d="",f=e.getRangeElem();f=e.getSelfOrParentByName(f,"a"),f&&(d=f.href||"");var g="",h=e.isRangeEmpty();h?f&&(g=f.textContent||f.innerHTML):g=e.getRangeText()||"",d&&m.val(d),g&&l.val(g),h?l.removeAttr("disabled"):l.attr("disabled",!0),c.show()},g.updateSelectedEvent=function(){var a=e.getRangeElem();return a=e.getSelfOrParentByName(a,"a"),a?!0:!1},o.click(function(a){a.preventDefault(),g.dropPanel.hide()}),n.click(function(c){c.preventDefault();var d,f,h,i,j,k,n=e.getRangeElem(),o=e.getSelfOrParentByName(n,"a"),p=e.isRangeEmpty(),q=e.txt.$txt,r="link"+a.random(),s=b.trim(m.val()),t=b.trim(l.val());return s?(t||(t=s),void(p?o?(d=b(o),h=function(){d.attr("href",s),d.text(t)},i=function(){var a=this;a.restoreSelectionByElem(o)},e.customCommand(c,h,i)):(f='<a href="'+s+'" target="_blank">'+t+"</a>",a.userAgent.indexOf("Firefox")>0&&(f+="<span>&nbsp;</span>"),e.command(c,"insertHtml",f)):(j=q.find("a"),j.attr(r,"1"),e.command(c,"createLink",s),k=q.find("a").not("["+r+"]"),k.attr("target","_blank"),j.removeAttr(r)))):void g.dropPanel.focusFirstInput()}),e.menus[d]=g}})}),b(function(a,b){a.createMenu(function(c){var d="unlink";if(c(d)){var e=this,f=e.config.lang,g=new a.Menu({editor:e,id:d,title:f.unlink,commandName:"unLink"});g.clickEvent=function(a){function c(){i.after(j).remove()}function d(){e.restoreSelectionByElem(j.get(0))}var f=e.isRangeEmpty();if(!f)return void e.command(a,"unLink");var g=e.getRangeElem(),h=e.getSelfOrParentByName(g,"a");if(!h)return void a.preventDefault();var i=b(h),j=b("<span>"+i.text()+"</span>");e.customCommand(a,c,d)},e.menus[d]=g}})}),b(function(a,b){a.createMenu(function(c){var d="table";if(c(d)){var e,f,g,h=this,i=h.config.lang,j=new a.Menu({editor:h,id:d,title:i.table}),k=b('<div style="font-size: 14px; color: #666; text-align:right;"></div>'),l=b('<table class="choose-table" style="margin-bottom:10px;margin-top:5px;">'),m=b("<span>0</span>"),n=b("<span> 行 </span>"),o=b("<span>0</span>"),p=b("<span> 列</span>");for(f=0;10>f;f++){for(e=b('<tr index="'+(f+1)+'">'),g=0;10>g;g++)e.append(b('<td index="'+(g+1)+'">'));l.append(e)}k.append(l),k.append(m).append(n).append(o).append(p),l.on("mouseenter","td",function(a){var c=b(a.currentTarget),d=c.attr("index"),e=c.parent(),f=e.attr("index");m.text(f),o.text(d),l.find("tr").each(function(){var a=b(this),c=a.attr("index");parseInt(c,10)<=parseInt(f,10)?a.find("td").each(function(){var a=b(this),c=a.attr("index");parseInt(c,10)<=parseInt(d,10)?a.addClass("active"):a.removeClass("active")}):a.find("td").removeClass("active")})}).on("mouseleave",function(a){l.find("td").removeClass("active")}),l.on("click","td",function(a){var c,d,e=b(a.currentTarget),f=e.attr("index"),g=e.parent(),i=g.attr("index"),j=parseInt(i,10),k=parseInt(f,10),l="\n<table>";for(c=0;j>c;c++){for(l+="\n  <tr>",d=0;k>d;d++)l+="\n    <td><span>&nbsp;</span></td>";l+="\n  </tr>"}l+="\n</table>\n",h.command(a,"insertHtml",l)}),j.dropPanel=new a.DropPanel(h,j,{$content:k,width:181}),h.menus[d]=j}})}),b(function(a,b){a.createMenu(function(c){function d(a,c){b.each(a,function(a,d){var e=d.icon||d.url,g=d.value||d.title,h="icon"===j?e:g,i=b('<a href="#" commandValue="'+h+'"></a>'),k=b("<img>");k.attr("_src",e),i.append(k),c.append(i),f.emotionUrls.push(e)})}var e="emotion";if(c(e)){var f=this,g=f.config,h=g.lang,i=g.emotions,j=g.emotionsShow;f.emotionUrls=[];var k=new a.Menu({editor:f,id:e,title:h.emotion}),l=b('<div class="panel-tab"></div>'),m=b('<div class="tab-container"></div>'),n=b('<div class="content-container emotion-content-container"></div>');b.each(i,function(c,e){var f=e.title,g=e.data;a.log("正在处理 "+f+" 表情的数据...");var h=b('<a href="#">'+f+" </a>");m.append(h);var i=b('<div class="content"></div>');if(n.append(i),h.click(function(a){m.children().removeClass("selected"),n.children().removeClass("selected"),i.addClass("selected"),h.addClass("selected"),a.preventDefault()}),"string"==typeof g)a.log("将通过 "+g+" 地址ajax下载表情包"),b.get(g,function(c){c=b.parseJSON(c),a.log("下载完毕，得到 "+c.length+" 个表情"),d(c,i)});else{if(!(Object.prototype.toString.call(g).toLowerCase().indexOf("array")>0))return void a.error("data 数据格式错误，请修改为正确格式，参考文档："+a.docsite);d(g,i)}}),l.append(m).append(n),m.children().first().addClass("selected"),n.children().first().addClass("selected"),n.on("click","a[commandValue]",function(a){var c=b(a.currentTarget),d=c.attr("commandValue"),e=document.createElement("img");e.onload=function(){f.command(a,"InsertImage",d),e=null},e.onerror=function(){f.command(a,"insertHtml","<span>"+d+"</span>"),e=null},e.src=d,a.preventDefault()}),k.dropPanel=new a.DropPanel(f,k,{$content:l,width:350}),k.clickEvent=function(c){var d=this,e=d.dropPanel;return e.isShowing?void e.hide():(e.show(),void(d.imgLoaded||(n.find("img").each(function(){var c=b(this),d=c.attr("_src");c.on("error",function(){a.error("加载不出表情图片 "+d)}),c.attr("src",d),c.removeAttr("_src")}),d.imgLoaded=!0)))},f.menus[e]=k}})}),b(function(a,b){function c(a,c,d){function e(){h.val("")}var f=a.config.lang,g=b('<div style="margin:20px 10px 10px 10px;"></div>'),h=b('<input type="text" class="block" placeholder="http://"/>');g.append(h);var i=b('<button class="right">'+f.submit+"</button>"),j=b('<button class="right gray">'+f.cancel+"</button>");d.append(g).append(i).append(j),j.click(function(a){a.preventDefault(),c.dropPanel.hide()}),i.click(function(c){c.preventDefault();var d=b.trim(h.val());if(!d)return void h.focus();var f='<img style="max-width:100%;" src="'+d+'"/>';a.command(c,"insertHtml",f,e)})}a.createMenu(function(d){function e(){n.click(function(a){l.children().removeClass("selected"),m.children().removeClass("selected"),p.addClass("selected"),n.addClass("selected"),a.preventDefault()}),o.click(function(b){l.children().removeClass("selected"),m.children().removeClass("selected"),q.addClass("selected"),o.addClass("selected"),b.preventDefault(),a.placeholder&&q.find("input[type=text]").focus()}),n.click()}function f(){l.remove(),p.remove(),q.addClass("selected")}var g="img";if(d(g)){var h=this,i=h.config.lang,j=new a.Menu({editor:h,id:g,title:i.img}),k=b('<div class="panel-tab"></div>'),l=b('<div class="tab-container"></div>'),m=b('<div class="content-container"></div>');k.append(l).append(m);var n=b('<a href="#">上传图片</a>'),o=b('<a href="#">网络图片</a>');l.append(n).append(o);var p=b('<div class="content"></div>');m.append(p);var q=b('<div class="content"></div>');m.append(q),c(h,j,q),j.dropPanel=new a.DropPanel(h,j,{$content:k,width:400,onRender:function(){var a=h.config.customUploadInit;a&&a.call(h)}}),h.menus[g]=j,h.ready(function(){function a(){j.dropPanel.hide()}var b=this,c=b.config,d=c.uploadImgUrl,g=c.customUpload;d||g?(b.$uploadContent=p,e()):f(),p.click(function(){setTimeout(a)})})}})}),b(function(a,b){a.createMenu(function(c){var d="video";if(c(d)){var e=this,f=e.config.lang,g=/^<(iframe)|(embed)/i,h=new a.Menu({editor:e,id:d,title:f.video}),i=b("<div></div>"),j=b('<div style="margin:20px 10px;"></div>'),k=b('<input type="text" class="block" placeholder=\'格式如：<iframe src="..." frameborder=0 allowfullscreen></iframe>\'/>');j.append(k);var l=b('<div style="margin:20px 10px;"></div>'),m=b('<input type="text" value="640" style="width:50px;text-align:center;"/>'),n=b('<input type="text" value="498" style="width:50px;text-align:center;"/>');l.append("<span> "+f.width+" </span>").append(m).append("<span> px &nbsp;&nbsp;&nbsp;</span>").append("<span> "+f.height+" </span>").append(n).append("<span> px </span>");var o=b("<div></div>"),p=b('<a href="http://www.kancloud.cn/wangfupeng/wangeditor2/134973" target="_blank" style="display:inline-block;margin-top:10px;margin-left:10px;color:#999;">如何复制视频链接？</a>'),q=b('<button class="right">'+f.submit+"</button>"),r=b('<button class="right gray">'+f.cancel+"</button>");o.append(p).append(q).append(r),i.append(j).append(l).append(o),r.click(function(a){a.preventDefault(),k.val(""),h.dropPanel.hide()}),q.click(function(a){a.preventDefault();var c,d=b.trim(k.val()),f=parseInt(m.val()),i=parseInt(n.val()),j=b("<div>"),l='<p style="text-align:center;">{content}</p>';return d?g.test(d)?isNaN(f)||isNaN(i)?void alert("宽度或高度不是数字！"):(c=b(d),c.attr("width",f).attr("height",i),l=l.replace("{content}",j.append(c).html()),e.command(a,"insertHtml",l),void k.val("")):(alert("视频链接格式错误！"),void h.dropPanel.focusFirstInput()):void h.dropPanel.focusFirstInput()}),h.dropPanel=new a.DropPanel(e,h,{$content:i,width:400}),e.menus[d]=h}})}),b(function(a,b){var c=function(a){return"onkeyup"in a}(document.createElement("input"));a.baiduMapAk="TVhjYjq1ICT2qqL5LdS8mwas";var d=1;a.createMenu(function(e){function f(){r.val("")}var g="location";if(e(g)){if(d++>1)return void a.error("目前不支持在一个页面多个编辑器上同时使用地图，可通过自定义菜单配置去掉地图菜单");var h=this,i=h.config,j=i.lang,k=i.mapAk;h.mapData={};var l=h.mapData;l.markers=[],l.mapContainerId="map"+a.random(),l.clearLocations=function(){var a=l.map;a&&(a.clearOverlays(),l.markers=[])},l.searchMap=function(){var a=l.map;if(a){var b,c,d=window.BMap,e=q.val(),f=r.val();""!==e&&(f&&""!==f||a.centerAndZoom(e,11),f&&""!==f&&(b=new d.Geocoder,b.getPoint(f,function(b){b?(a.centerAndZoom(b,13),c=new d.Marker(b),a.addOverlay(c),c.enableDragging(),l.markers.push(c)):a.centerAndZoom(e,11)},e)))}};var m=!1;window.baiduMapCallBack=function(){function b(b){var d=b.name;e.setCenter(d),q.val(d),a.placeholder&&r.focus();var f,g;c?(g=function(a){"keyup"===a.type&&13===a.keyCode&&a.preventDefault(),f&&clearTimeout(f),f=setTimeout(l.searchMap,500)},q.on("keyup change paste",g),r.on("keyup change paste",g)):(g=function(){if(!o.is(":visible"))return void clearTimeout(f);var a="",b="",c=q.val(),d=r.val();(c!==a||d!==b)&&(l.searchMap(),a=c,b=d),f&&clearTimeout(f),f=setTimeout(g,1e3)},f=setTimeout(g,1e3))}if(!m){m=!0;var d=window.BMap;l.map||(l.map=new d.Map(l.mapContainerId));var e=l.map;e.centerAndZoom(new d.Point(116.404,39.915),11),e.addControl(new d.MapTypeControl),e.setCurrentCity("北京"),e.enableScrollWheelZoom(!0);var f=new d.LocalCity;f.get(b),e.addEventListener("click",function(a){var b=new d.Marker(new d.Point(a.point.lng,a.point.lat));e.addOverlay(b),b.enableDragging(),l.markers.push(b)},!1)}},l.loadMapScript=function(){var b=document.createElement("script");b.type="text/javascript",b.src="http://api.map.baidu.com/api?v=2.0&ak="+k+"&callback=baiduMapCallBack";try{document.body.appendChild(b)}catch(c){a.error("加载地图过程中发生错误")}},l.initMap=function(){window.BMap?window.baiduMapCallBack():l.loadMapScript()};var n=new a.Menu({editor:h,id:g,title:j.location});h.menus[g]=n;var o=b("<div></div>"),p=b('<div style="margin:10px 0;"></div>'),q=b('<input type="text"/>');q.css({width:"80px","text-align":"center"});var r=b('<input type="text"/>');r.css({width:"300px","margin-left":"10px"}).attr("placeholder",j.searchlocation);var s=b('<button class="right link">'+j.clearLocation+"</button>");p.append(s).append(q).append(r),o.append(p),s.click(function(a){r.val(""),r.focus(),l.clearLocations(),a.preventDefault()});var t=b('<div id="'+l.mapContainerId+'"></div>');t.css({height:"260px",width:"100%",position:"relative","margin-top":"10px",border:"1px solid #f1f1f1"});var u=b("<span>"+j.loading+"</span>");u.css({position:"absolute",width:"100px","text-align":"center",top:"45%",left:"50%","margin-left":"-50px"}),t.append(u),o.append(t);var v=b('<div style="margin:10px 0;"></div>'),w=b('<button class="right">'+j.submit+"</button>"),x=b('<button class="right gray">'+j.cancel+"</button>"),y=b('<label style="display:inline-block;margin-top:10px;color:#666;"></label>'),z=b('<input type="checkbox">');y.append(z).append('<span style="display:inline-block;margin-left:5px;">  '+j.dynamicMap+"</span>"),v.append(y).append(w).append(x),o.append(v),x.click(function(a){a.preventDefault(),f(),n.dropPanel.hide()}),w.click(function(a){a.preventDefault();var c,d,e,g=l.map,i=z.is(":checked"),k=l.markers,m=g.getCenter(),n=m.lng,o=m.lat,p=g.getZoom(),q=g.getSize(),r=q.width,s=q.height;if(d=i?"http://ueditor.baidu.com/ueditor/dialogs/map/show.html#":"http://api.map.baidu.com/staticimage?",d=d+"center="+n+","+o+"&zoom="+p+"&width="+r+"&height="+s,k.length>0&&(d+="&markers=",b.each(k,function(a,b){c=b.getPosition(),a>0&&(d+="|"),d=d+c.lng+","+c.lat})),i){if(k.length>1)return void alert(j.langDynamicOneLocation);d+="&markerStyles=l,A",e='<iframe class="ueditor_baidumap" src="{src}" frameborder="0" width="'+r+'" height="'+s+'"></iframe>',e=e.replace("{src}",d),h.command(a,"insertHtml",e,f)}else h.command(a,"insertHtml",'<img style="max-width:100%;" src="'+d+'"/>',f)}),n.dropPanel=new a.DropPanel(h,n,{$content:o,width:500}),n.onRender=function(){k===a.baiduMapAk&&a.warn("建议在配置中自定义百度地图的mapAk，否则可能影响地图功能，文档："+a.docsite)},n.clickEvent=function(a){var b=this,c=b.dropPanel,d=!1;return c.isShowing?void c.hide():(l.map||(d=!0),l.initMap(),c.show(),void(d||r.focus()))}}})}),b(function(a,b){function c(){if(!(a.userAgent.indexOf("MSIE 8")>0)){var b=document.createElement("script");b.type="text/javascript",b.src="/static/editor/js/highlight.min.js",document.body.appendChild(b)}}a.createMenu(function(d){function e(a){var c=b("<div></div>");c.css({margin:"15px 5px 5px 5px",height:"160px","text-align":"center"}),m.css({width:"100%",height:"100%",padding:"10px"}),m.on("keydown",function(a){9===a.keyCode&&a.preventDefault()}),c.append(m),a.append(c);var d=b("<div></div>"),e=b('<button class="right">'+i.submit+"</button>"),f=b('<button class="right gray">'+i.cancel+"</button>");d.append(e).append(f).append(n),a.append(d),f.click(function(a){a.preventDefault(),k.dropPanel.hide()});var g='<pre style="max-width:100%;overflow-x:auto;"><code{#langClass}>{#content}</code></pre>';e.click(function(a){function c(){var a;i&&(a=p.attr("class"),a!==i+" hljs"&&p.attr("class",i+" hljs")),p.html(e)}function d(){h.restoreSelectionByElem(q),l()}a.preventDefault();var e=m.val();if(!e)return void m.focus();var f=h.getRangeElem();b.trim(b(f).text())&&(g="<p><br></p>"+g);var i=n?n.val():"",j="",l=function(){b("pre code").each(function(a,b){window.hljs&&window.hljs.highlightBlock(b)})};if(i&&(j=' class="'+i+' hljs"'),e=e.replace(/&/gm,"&amp;").replace(/</gm,"&lt;").replace(/>/gm,"&gt;"),!k.selected){var o=g.replace("{#langClass}",j).replace("{#content}",e);return void h.command(a,"insertHtml",o,l)}var p,q=h.getSelfOrParentByName(f,"pre");q&&(q=h.getSelfOrParentByName(f,"code")),q&&(p=b(q),h.customCommand(a,c,d))})}function f(){var a=h.getRangeElem(),b=h.getSelfOrParentByName(a,"code");b?h.disableMenusExcept("insertcode"):h.enableMenusExcept("insertcode")}var g="insertcode";if(d(g)){setTimeout(c,0);var h=this,i=h.config.lang,j=h.txt.$txt,k=new a.Menu({editor:h,id:g,title:i.insertcode});k.clickEvent=function(a){var c=this,d=c.dropPanel;if(d.isShowing)return void d.hide();m.val(""),d.show();var e=window.hljs;e&&e.listLanguages?(n.css({"margin-top":"9px","margin-left":"5px"}),b.each(e.listLanguages(),function(a,b){n.append('<option value="'+b+'">'+b+"</option>")})):n.hide()},k.clickEventSelected=function(a){var c=this,d=c.dropPanel;if(d.isShowing)return void d.hide();d.show();var e,f,g=h.getRangeElem(),i=h.getSelfOrParentByName(g,"pre");i&&(i=h.getSelfOrParentByName(g,"code")),i&&(e=b(i),m.val(e.text()),n&&(f=e.attr("class"),f&&n.val(f.split(" ")[0])))},k.updateSelectedEvent=function(){var a,b=this,c=b.editor;return a=c.getRangeElem(),a=c.getSelfOrParentByName(a,"pre"),a?!0:!1};var l=b("<div></div>"),m=b("<textarea></textarea>"),n=b("<select></select>");e(l),k.dropPanel=new a.DropPanel(h,k,{$content:l,width:500}),h.menus[g]=k,j.on("keydown",function(a){if(13===a.keyCode){var b=h.getRangeElem(),c=h.getSelfOrParentByName(b,"code");c&&h.command(a,"insertHtml","\n")}}),j.on("keydown click",function(a){setTimeout(f)})}})}),b(function(a,b){a.createMenu(function(b){var c="undo";if(b(c)){var d=this,e=d.config.lang,f=new a.Menu({editor:d,id:c,title:e.undo});f.clickEvent=function(a){d.undo()},d.menus[c]=f,d.ready(function(){function a(){c.undoRecord()}var b,c=this,d=c.txt.$txt;d.on("keydown",function(d){var e=d.keyCode;return d.ctrlKey&&90===e?void c.undo():void(13===e?a():(b&&clearTimeout(b),b=setTimeout(a,1e3)))}),c.undoRecord()})}})}),b(function(a,b){a.createMenu(function(b){var c="redo";if(b(c)){var d=this,e=d.config.lang,f=new a.Menu({editor:d,id:c,title:e.redo});f.clickEvent=function(a){d.redo()},d.menus[c]=f}})}),b(function(a,b){var c;a.createMenu(function(b){var d="fullscreen";if(b(d)){var e,f,g=this,h=g.txt.$txt,i=g.config,j=i.zindex||1e4,k=i.lang,l=!1,m=new a.Menu({editor:g,id:d,title:k.fullscreen});m.clickEvent=function(b){var d=g.$editorContainer;d.addClass("wangEditor-fullscreen"),e=d.css("z-index"),d.css("z-index",j);var i,k=h.height(),m=h.outerHeight();g.useMaxHeight&&(f=h.css("max-height"),h.css("max-height","none"),i=h.parent(),i.after(h),i.remove(),h.css("overflow-y","auto"));var n=g.menuContainer;h.height(a.$window.height()-n.height()-(m-k)),g.menuContainer.$menuContainer.attr("style",""),l=!0,g.isFullScreen=!0,c=a.$window.scrollTop()},m.clickEventSelected=function(b){var d=g.$editorContainer;d.removeClass("wangEditor-fullscreen"),d.css("z-index",e),g.useMaxHeight?h.css("max-height",f):g.$valueContainer.css("height",g.valueContainerHeight),g.txt.initHeight(),l=!1,g.isFullScreen=!1,null!=c&&a.$window.scrollTop(c)},m.updateSelectedEvent=function(a){return l},g.menus[d]=m}})}),b(function(a,b){a.fn.renderMenus=function(){var a,c=this,d=c.menus,e=c.config.menus,f=(c.menuContainer,0);b.each(e,function(b,c){return"|"===c?void f++:(a=d[c],void(a&&a.render(f)))})}}),b(function(a,b){a.fn.renderMenuContainer=function(){var a=this,b=a.menuContainer;a.$editorContainer;b.render()}}),b(function(a,b){a.fn.renderTxt=function(){var a=this,b=a.txt;b.render(),a.ready(function(){b.initHeight()})}}),b(function(a,b){a.fn.renderEditorContainer=function(){var a,b,c=this,d=c.$valueContainer,e=c.$editorContainer,f=c.txt.$txt;d===f?(a=c.$prev,b=c.$parent,a&&a.length?a.after(e):b.prepend(e)):(d.after(e),d.hide())}}),b(function(a,b){a.fn.eventMenus=function(){var a=this.menus;b.each(a,function(a,b){b.bindEvent()})}}),b(function(a,b){a.fn.eventMenuContainer=function(){}}),b(function(a,b){a.fn.eventTxt=function(){var a=this.txt;a.saveSelectionEvent(),a.updateValueEvent(),a.updateMenuStyleEvent()}}),b(function(a,b){a.plugin(function(){var b=this,c=b.config.uploadImgFns;c.onload||(c.onload=function(b,c){a.log("上传结束，返回结果为 "+b);var d,e=this;0===b.indexOf("error|")?(a.warn("上传失败："+b.split("|")[1]),
alert(b.split("|")[1])):(a.log("上传成功，即将插入编辑区域，结果为："+b),d=document.createElement("img"),d.onload=function(){var c='<img src="'+b+'" style="max-width:100%;"/>';e.command(null,"insertHtml",c),a.log("已插入图片，地址 "+b),d=null},d.onerror=function(){a.error("使用返回的结果获取图片，发生错误。请确认以下结果是否正确："+b),d=null},d.src=b)}),c.ontimeout||(c.ontimeout=function(b){a.error("上传上图片发生错误"),alert("上传上图片发生错误")}),c.onerror||(c.onerror=function(b){a.error("上传图片超时"),alert("上传图片超时")})})}),b(function(a,b){window.FileReader&&window.FormData&&a.plugin(function(){function b(a,b){var c,d=window.atob(a.split(",")[1]),e=new ArrayBuffer(d.length),f=new Uint8Array(e);for(c=0;c<d.length;c++)f[c]=d.charCodeAt(c);return new Blob([e],{type:b})}function c(b,c){var d=document.createElement("img");d.onload=function(){var f='<img src="'+b+'" style="max-width:100%;"/>';e.command(c,"insertHtml",f),a.log("已插入图片，地址 "+b),d=null},d.onerror=function(){a.error("使用返回的结果获取图片，发生错误。请确认以下结果是否正确："+b),d=null},d.src=b}function d(a){if(a.lengthComputable){var b=a.loaded/a.total;e.showUploadProgress(100*b)}}var e=this,f=e.config,g=f.uploadImgUrl,h=f.uploadTimeout,i=f.uploadImgFns,j=i.onload,k=i.ontimeout,l=i.onerror;g&&(e.xhrUploadImg=function(f){function i(){u&&clearTimeout(u),v&&v.abort&&v.abort(),m.preventDefault(),s&&s.call(e,v),e.hideUploadProgress()}var m=f.event,n=f.base64,o=f.fileType||"image/png",p=f.name||"wangEditor_upload_file",q=f.loadfn||j,r=f.errorfn||l,s=f.timeoutfn||k,t="png";if(o.indexOf("/")>0&&o.split("/")[1]&&(t=o.split("/")[1]),a.isOnWebsite)return a.log("预览模拟上传"),void c(n,m);var u,v=new XMLHttpRequest,w=new FormData;v.onload=function(){u&&clearTimeout(u),q&&q.call(e,v.responseText,v),e.hideUploadProgress()},v.onerror=function(){u&&clearTimeout(u),m.preventDefault(),r&&r.call(e,v),e.hideUploadProgress()},v.upload.onprogress=d,w.append(p,b(n,o),a.random()+"."+t),v.open("POST",g,!0),v.send(w),u=setTimeout(i,h),a.log("开始上传...并开始超时计算")})})}),b(function(a,b){a.plugin(function(){function a(){j||(j=!0,i.css({top:f+"px"}),g.append(i))}function c(){i.hide(),k=null}var d=this,e=d.menuContainer,f=e.height(),g=d.$editorContainer,h=g.width(),i=b('<div class="wangEditor-upload-progress"></div>'),j=!1;d.showUploadProgress=function(b){k&&clearTimeout(k),a(),i.show(),i.width(b*h/100)};var k;d.hideUploadProgress=function(a){k&&clearTimeout(k),a=a||750,k=setTimeout(c,a)}})}),b(function(a,b){a.plugin(function(){var c,d=this,e=d.config,f=e.uploadImgUrl,g=e.uploadTimeout;if(f){var h=d.$uploadContent;if(h){var i=b('<div class="upload-icon-container"><i class="wangeditor-menu-img-upload"></i></div>');h.append(i);var j=new a.UploadFile({editor:d,uploadUrl:f,timeout:g,fileAccept:"image/*"});i.click(function(a){c=a,j.selectFiles()})}}})}),b(function(a,b){if(window.FileReader&&window.FormData){var c=function(a){this.editor=a.editor,this.uploadUrl=a.uploadUrl,this.timeout=a.timeout,this.fileAccept=a.fileAccept,this.multiple=!0};c.fn=c.prototype,c.fn.clear=function(){this.$input.val(""),a.log("input value 已清空")},c.fn.render=function(){var c=this;if(!c._hasRender){a.log("渲染dom");var d=c.fileAccept,e=d?'accept="'+d+'"':"",f=c.multiple,g=f?'multiple="multiple"':"",h=b('<input type="file" '+e+" "+g+"/>"),i=b('<div style="visibility:hidden;"></div>');i.append(h),a.$body.append(i),h.on("change",function(a){c.selected(a,h.get(0))}),c.$input=h,c._hasRender=!0}},c.fn.selectFiles=function(){var b=this;a.log("使用 html5 方式上传"),b.render(),a.log("选择文件"),b.$input.click()},c.fn.selected=function(c,d){var e=this,f=d.files||[];0!==f.length&&(a.log("选中 "+f.length+" 个文件"),b.each(f,function(a,b){e.upload(b)}))},c.fn.upload=function(b){function c(){d.clear()}var d=this,e=d.editor,f=b.name||"",g=b.type||"",h=e.config.uploadImgFns,i=h.onload,j=h.ontimeout,k=h.onerror,l=new FileReader;return i&&j&&k?(a.log("开始执行 "+f+" 文件的上传"),l.onload=function(b){a.log("已读取"+f+"文件");var d=b.target.result||this.result;e.xhrUploadImg({event:b,base64:d,fileType:g,name:"wangEditorH5File",loadfn:function(a,b){c();var d=this;i.call(d,a,b)},errorfn:function(b){c(),a.isOnWebsite&&alert("wangEditor官网暂时没有服务端，因此报错。实际项目中不会发生");var d=this;k.call(d,b)},timeoutfn:function(b){c(),a.isOnWebsite&&alert("wangEditor官网暂时没有服务端，因此超时。实际项目中不会发生");var d=this;j(d,b)}})},void l.readAsDataURL(b)):void a.error("请为编辑器配置上传图片的 onload ontimeout onerror 回调事件")},a.UploadFile=c}}),b(function(a,b){if(!window.FileReader||!window.FormData){var c=function(a){this.editor=a.editor,this.uploadUrl=a.uploadUrl,this.timeout=a.timeout,this.fileAccept=a.fileAccept,this.multiple=!1};c.fn=c.prototype,c.fn.clear=function(){this.$input.val(""),a.log("input value 已清空")},c.fn.hideModal=function(){this.modal.hide()},c.fn.render=function(){var c=this,d=c.editor;if(!c._hasRender){var e=c.uploadUrl;a.log("渲染dom");var f="iframe"+a.random(),g=b('<iframe name="'+f+'" id="'+f+'" frameborder="0" width="0" height="0"></iframe>'),h=c.multiple,i=h?'multiple="multiple"':"",j=b("<p>选择图片并上传</p>"),k=b('<input type="file" '+i+' name="wangEditorFormFile"/>'),l=b('<input type="submit" value="上传"/>'),m=b('<form enctype="multipart/form-data" method="post" action="'+e+'" target="'+f+'"></form>'),n=b('<div style="margin:10px 20px;"></div>');m.append(j).append(k).append(l),n.append(m),n.append(g),c.$input=k,c.$iframe=g;var o=new a.Modal(d,void 0,{$content:n});c.modal=o,c._hasRender=!0}},c.fn.bindLoadEvent=function(){function a(){var a=b.trim(g.document.body.innerHTML);a&&(h.call(d,a),c.clear(),c.hideModal())}var c=this;if(!c._hasBindLoad){var d=c.editor,e=c.$iframe,f=e.get(0),g=f.contentWindow,h=d.config.uploadImgFns.onload;f.attachEvent?f.attachEvent("onload",a):f.onload=a,c._hasBindLoad=!0}},c.fn.show=function(){function a(){c.show(),b.bindLoadEvent()}var b=this,c=b.modal;setTimeout(a)},c.fn.selectFiles=function(){var b=this;a.log("使用 form 方式上传"),b.render(),b.clear(),b.show()},a.UploadFile=c}}),b(function(a,b){a.plugin(function(){function c(){var c=/^data:(image\/\w+);base64/,g=h.find("img");a.log("粘贴后，检查到编辑器有"+g.length+"个图片。开始遍历图片，试图找到刚刚粘贴过来的图片"),b.each(g,function(){var g,h,i=this,j=b(i),k=j.attr("src");e.each(function(){return i===this?(g=!0,!1):void 0}),g||(a.log("找到一个粘贴过来的图片"),c.test(k)?(a.log("src 是 base64 格式，可以上传"),h=k.match(c)[1],f.xhrUploadImg({event:d,base64:k,fileType:h,name:"wangEditorPasteFile"})):a.log("src 为 "+k+" ，不是 base64 格式，暂时不支持上传"),j.remove())}),a.log("遍历结束")}var d,e,f=this,g=f.txt,h=g.$txt,i=f.config,j=i.uploadImgUrl;j&&h.on("paste",function(g){d=g;var i,j,k=d.clipboardData||d.originalEvent.clipboardData;i=null==k?window.clipboardData&&window.clipboardData.getData("text"):k.getData("text/plain")||k.getData("text/html"),i||(j=k&&k.items,j?(a.log("通过 data.items 得到了数据"),b.each(j,function(b,c){var e=c.type||"";if(!(e.indexOf("image")<0)){var g=c.getAsFile(),h=new FileReader;a.log("得到一个粘贴图片"),h.onload=function(b){a.log("读取到粘贴的图片");var c=b.target.result||this.result;f.xhrUploadImg({event:d,base64:c,fileType:e,name:"wangEditorPasteFile"})},h.readAsDataURL(g)}})):(a.log("未从 data.items 得到数据，使用检测粘贴图片的方式"),e=h.find("img"),a.log("粘贴前，检查到编辑器有"+e.length+"个图片"),setTimeout(c,0)))})})}),b(function(a,b){a.plugin(function(){var c=this,d=c.txt,e=d.$txt,f=c.config,g=f.uploadImgUrl;g&&(a.$document.on("dragleave drop dragenter dragover",function(a){a.preventDefault()}),e.on("drop",function(d){d.preventDefault();var e=d.originalEvent,f=e.dataTransfer&&e.dataTransfer.files;f&&f.length&&b.each(f,function(b,e){var f=e.type,g=e.name;if(!(f.indexOf("image/")<0)){a.log("得到图片 "+g);var h=new FileReader;h.onload=function(b){a.log("读取到图片 "+g);var e=b.target.result||this.result;c.xhrUploadImg({event:d,base64:e,fileType:f,name:"wangEditorDragFile"})},h.readAsDataURL(e)}})}))})}),b(function(a,b){a.plugin(function(){function c(){l||(d(),m.append(n).append(o).append(p).append(q),h.$editorContainer.append(m),l=!0)}function d(){function a(a,c){b&&h.customCommand(a,b,c)}var b;o.click(function(c){b=function(){g.remove()},a(c,function(){setTimeout(f,100)})}),q.click(function(c){b=function(){g.css({width:"100%"})},a(c,function(){setTimeout(e)})}),p.click(function(c){b=function(){g.css({width:"auto"})},a(c,function(){setTimeout(e)})})}function e(){if(!h._disabled&&null!=g){g.addClass("clicked");var a=g.position(),b=a.top,c=a.left,d=g.outerHeight(),e=g.outerWidth(),f=b+d,i=c,j=0,l=k.position().top,o=k.outerHeight();f>l+o&&(f=l+o),m.show();var p=m.outerWidth();j=e/2-p/2,m.css({top:f+5,left:i,"margin-left":j}),0>j?(m.css("margin-left","0"),n.hide()):n.show()}}function f(){null!=g&&(g.removeClass("clicked"),g=null,m.hide())}var g,h=this,i=h.txt,j=i.$txt,k=h.useMaxHeight?j.parent():j,l=!1,m=b('<div class="txt-toolbar"></div>'),n=b('<div class="tip-triangle"></div>'),o=b('<a href="#"><i class="wangeditor-menu-img-trash-o"></i></a>'),p=b('<a href="#"><i class="wangeditor-menu-img-search-minus"></i></a>'),q=b('<a href="#"><i class="wangeditor-menu-img-search-plus"></i></a>');k.on("click","table",function(a){var d=b(a.currentTarget);return c(),g&&g.get(0)===d.get(0)?void setTimeout(f,100):(g=d,e(),a.preventDefault(),void a.stopPropagation())}).on("click keypress scroll",function(a){setTimeout(f,100)}),a.$body.on("click keypress scroll",function(a){setTimeout(f,100)})})}),b(function(a,b){a.userAgent.indexOf("MSIE 8")>0||a.plugin(function(){function c(){n||(d(),e(),p.append(q).append(r).append(s).append(t).append(u).append(v).append(w),j.$editorContainer.append(p).append(o),n=!0)}function d(){function a(a,c){b&&j.customCommand(a,b,c)}var b;r.click(function(c){b=function(){i.remove()},a(c,function(){setTimeout(g,100)})}),t.click(function(c){b=function(){var a=i.get(0),b=a.width,c=a.height;b=1.1*b,c=1.1*c,i.css({width:b+"px",height:c+"px"})},a(c,function(){setTimeout(f)})}),s.click(function(c){b=function(){var a=i.get(0),b=a.width,c=a.height;b=.9*b,c=.9*c,i.css({width:b+"px",height:c+"px"})},a(c,function(){setTimeout(f)})}),u.click(function(c){b=function(){i.parent().css({"text-align":"left"}).attr("align","left")},a(c,function(){setTimeout(g,100)})}),w.click(function(c){b=function(){i.parent().css({"text-align":"right"}).attr("align","right")},a(c,function(){setTimeout(g,100)})}),v.click(function(c){b=function(){i.parent().css({"text-align":"center"}).attr("align","center")},a(c,function(){setTimeout(g,100)})})}function e(){function b(a){var b,g;b=a.pageX-c,g=a.pageY-d;var k=e+b,l=f+g;o.css({"margin-left":k,"margin-top":l});var m=h+b,n=j+g;i&&i.css({width:m,height:n})}var c,d,e,f,h,j;o.on("mousedown",function(k){i&&(c=k.pageX,d=k.pageY,e=parseFloat(o.css("margin-left"),10),f=parseFloat(o.css("margin-top"),10),h=i.width(),j=i.height(),p.hide(),a.$document.on("mousemove._dragResizeImg",b),a.$document.on("mouseup._dragResizeImg",function(b){a.$document.off("mousemove._dragResizeImg"),a.$document.off("mouseup._dragResizeImg"),g(),o.css({"margin-left":e,"margin-top":f}),x=!1}),x=!0)})}function f(){if(!j._disabled&&null!=i){i.addClass("clicked");var a=i.position(),b=a.top,c=a.left,d=i.outerHeight(),e=i.outerWidth();o.css({top:b+d,left:c+e});var f=b+d,g=c,h=0,k=m.position().top,l=m.outerHeight();f>k+l?f=k+l:o.show(),p.show();var n=p.outerWidth();h=e/2-n/2,p.css({top:f+5,left:g,"margin-left":h}),0>h?(p.css("margin-left","0"),q.hide()):q.show(),j.disableMenusExcept()}}function g(){null!=i&&(i.removeClass("clicked"),i=null,p.hide(),o.hide(),j.enableMenusExcept())}function h(a){var c=!1;return j.emotionUrls?(b.each(j.emotionUrls,function(b,d){var e=!1;return a===d&&(c=!0,e=!0),e?!1:void 0}),c):c}var i,j=this,k=j.txt,l=k.$txt,m=j.useMaxHeight?l.parent():l,n=(j.$editorContainer,!1),o=b('<div class="img-drag-point"></div>'),p=b('<div class="txt-toolbar"></div>'),q=b('<div class="tip-triangle"></div>'),r=b('<a href="#"><i class="wangeditor-menu-img-trash-o"></i></a>'),s=b('<a href="#"><i class="wangeditor-menu-img-search-minus"></i></a>'),t=b('<a href="#"><i class="wangeditor-menu-img-search-plus"></i></a>'),u=b('<a href="#"><i class="wangeditor-menu-img-align-left"></i></a>'),v=b('<a href="#"><i class="wangeditor-menu-img-align-center"></i></a>'),w=b('<a href="#"><i class="wangeditor-menu-img-align-right"></i></a>'),x=!1;m.on("mousedown","img",function(a){a.preventDefault()}).on("click","img",function(a){var d=b(a.currentTarget),e=d.attr("src");if(e&&!h(e)){if(c(),i&&i.get(0)===d.get(0))return void setTimeout(g,100);i=d,f(),a.preventDefault(),a.stopPropagation()}}).on("click keypress scroll",function(a){x||setTimeout(g,100)})})}),b(function(a,b){a.plugin(function(){var b=this,c=b.config.menuFixed;if(c!==!1&&"number"==typeof c){var d=parseFloat(a.$body.css("margin-top"),10);isNaN(d)&&(d=0);var e,f=b.$editorContainer,g=f.offset().top,h=f.outerHeight(),i=b.menuContainer.$menuContainer,j=i.css("position"),k=i.css("top"),l=i.outerHeight(),m=i.offset().top;b.txt.$txt;a.$window.scroll(function(){if(!b.isFullScreen){e=i.width();var f=a.$window.scrollTop();f>=m&&g+h>f+c+l+30?(i.css({position:"fixed",top:c}),i.width(e),a.$body.css({"margin-top":d+l}),b._isMenufixed||(b._isMenufixed=!0)):(i.css({position:j,top:k}),i.css("width","100%"),a.$body.css({"margin-top":d}),b._isMenufixed&&(b._isMenufixed=!1))}})}})}),b(function(a,b){a.createMenu(function(c){var d="indent";if(c(d)){var e=this,f=new a.Menu({editor:e,id:d,title:"缩进",$domNormal:b('<a href="#" tabindex="-1"><i class="wangeditor-menu-img-indent-left"></i></a>'),$domSelected:b('<a href="#" tabindex="-1" class="selected"><i class="wangeditor-menu-img-indent-left"></i></a>')});f.clickEvent=function(a){function c(){d.css("text-indent","2em")}var d,f=e.getRangeElem(),g=e.getSelfOrParentByName(f,"p");return g?(d=b(g),void e.customCommand(a,c)):a.preventDefault()},f.clickEventSelected=function(a){function c(){d.css("text-indent","0")}var d,f=e.getRangeElem(),g=e.getSelfOrParentByName(f,"p");return g?(d=b(g),void e.customCommand(a,c)):a.preventDefault()},f.updateSelectedEvent=function(){var a,c,d=e.getRangeElem(),f=e.getSelfOrParentByName(d,"p");return f?(a=b(f),c=a.css("text-indent"),c&&"0px"!==c?!0:!1):!1},e.menus[d]=f}})}),b(function(a,b){a.createMenu(function(c){var d="lineheight";if(c(d)){var e=this;e.commandHooks.lineHeight=function(a){var c=e.getRangeElem(),d=e.getSelfOrParentByName(c,"p,h1,h2,h3,h4,h5,pre");d&&b(d).css("line-height",a+"")};var f=new a.Menu({editor:e,id:d,title:"行高",commandName:"lineHeight",$domNormal:b('<a href="#" tabindex="-1"><i class="wangeditor-menu-img-arrows-v"></i></a>'),$domSelected:b('<a href="#" tabindex="-1" class="selected"><i class="wangeditor-menu-img-arrows-v"></i></a>')}),g={"1.0":"1.0倍",1.5:"1.5倍",1.8:"1.8倍","2.0":"2.0倍",2.5:"2.5倍","3.0":"3.0倍"},h='<span style="line-height:{#commandValue}">{#title}</span>';f.dropList=new a.DropList(e,f,{data:g,tpl:h}),e.menus[d]=f}})}),b(function(a,b){a.plugin(function(){var c=this,d=c.config.customUpload;if(d){if(c.config.uploadImgUrl)return alert("自定义上传无效，详看浏览器日志console.log"),void a.error("已经配置了 uploadImgUrl ，就不能再配置 customUpload ，两者冲突。将导致自定义上传无效。");var e=c.$uploadContent;e||a.error("自定义上传，无法获取 editor.$uploadContent");var f=b('<a href="#" class="upload-icon-container"><i class="wangeditor-menu-img-upload"></i></a>');e.append(f);var g="upload"+a.random(),h="upload"+a.random();f.attr("id",g),e.attr("id",h),c.customUploadBtnId=g,c.customUploadContainerId=h}})}),b(function(a,b){a.info("本页面富文本编辑器由 wangEditor 提供 http://wangeditor.github.io/ ")}),window.wangEditor});