/*
Copyright 2013, KISSY UI Library v1.31
MIT Licensed
build time: Jul 29 13:11
*/
/*
 thanks to CKSource's intelligent work on CKEditor
 @author yiminghe@gmail.com
*/
KISSY.add("editor/core/base",function(e,g,i){g=i.Controller.extend({initializer:function(){this.__commands={};this.__controls={}}},{Config:{},XHTML_DTD:g.DTD,ATTRS:{textarea:{},iframe:{},window:{},document:{},toolBarEl:{},statusBarEl:{},handleMouseEvents:{value:!1},focusable:{value:!1},mode:{value:1},data:{getter:function(){return this._getData()},setter:function(e){return this._setData(e)}},formatData:{getter:function(){return this._getData(1)},setter:function(e){return this._setData(e)}},customStyle:{value:""},
customLink:{value:[]}}},{xclass:"editor"});g.HTML_PARSER={textarea:function(e){return e.one("."+this.get("prefixCls")+"editor-textarea")}};e.mix(g,e.EventTarget);return KISSY.Editor=g},{requires:["htmlparser","component/base","core"]});
KISSY.add("editor/core/clipboard",function(e,g,i,h){function f(a){this.editor=a;this._init()}function c(b){var m=b.get("document")[0],l=b.getSelection(),d;if(l.getType()==h.SELECTION_ELEMENT&&(d=l.getSelectedElement())){var b=l.getRanges()[0],j=a(m.createTextNode(""));j.insertBefore(d);b.setStartBefore(j);b.setEndAfter(d);l.selectRanges([b]);setTimeout(function(){d.parent()&&(j.remove(),l.selectElement(d))},0)}}var a=e.all,d=e.UA,b=d.ie?"beforepaste":"paste",n=g.RANGE;e.augment(f,{_init:function(){var a=
this,m=a.editor,l=m.get("document"),e=l.one("body"),j=function(a){this.type=a};j.prototype={exec:function(m){var l=this.type;m.focus();setTimeout(function(){d.ie&&("cut"==l?c(m):"paste"==l&&(a._preventPasteEvent(),a._getClipboardDataFromPasteBin()));o(m,l)||alert(s[l])},0)}};e.on(b,a._getClipboardDataFromPasteBin,a);d.ie&&(e.on("paste",a._iePaste,a),l.on("keydown",a._onKeyDown,a),l.on("contextmenu",function(){a._isPreventBeforePaste=1;setTimeout(function(){a._isPreventBeforePaste=0},0)}));m.addCommand("copy",
new j("copy"));m.addCommand("cut",new j("cut"));m.addCommand("paste",new j("paste"))},_onKeyDown:function(a){this.editor.get("mode")==g.WYSIWYG_MODE&&(a.ctrlKey&&86==a.keyCode||a.shiftKey&&45==a.keyCode)&&this._preventPasteEvent()},_stateFromNamedCommand:function(a){var m,l=this.editor;if("paste"==a){this._isPreventBeforePaste=1;try{m=l.get("document")[0].queryCommandEnabled(a)}catch(b){}this._isPreventBeforePaste=0}else m=(a=(a=l.getSelection())&&a.getRanges())&&!(1==a.length&&a[0].collapsed);return m},
_preventPasteEvent:function(){var a=this;a._preventPasteTimer&&clearTimeout(a._preventPasteTimer);a._isPreventPaste=1;a._preventPasteTimer=setTimeout(function(){a._isPreventPaste=0},70)},_iePaste:function(a){var m=this.editor;this._isPreventPaste||(a.preventDefault(),m.execCommand("paste"))},_getClipboardDataFromPasteBin:function(){if(!this._isPreventBeforePaste){var b=this.editor,m=b.get("document")[0];if(!m.getElementById("ke_pastebin")){var l=b.getSelection(),c=new i(m),j=a(d.webkit?"<body></body>":
"<div></div>",m);j.attr("id","ke_pastebin");d.webkit&&j[0].appendChild(m.createTextNode("\u200b"));m.body.appendChild(j[0]);j.css({position:"absolute",top:l.getStartElement().offset().top+"px",width:"1px",height:"1px",overflow:"hidden"});j.css("left","-1000px");var f=l.createBookmarks();c.setStartAt(j,n.POSITION_AFTER_START);c.setEndAt(j,n.POSITION_BEFORE_END);c.select(!0);setTimeout(function(){var a,m=j;j=d.webkit&&(a=j.first())&&a.hasClass("Apple-style-span")?a:j;l.selectBookmarks(f);var c=j.html();
m.remove();if(c=e.trim(c.replace(/<span[^>]+_ke_bookmark[^<]*?<\/span>(&nbsp;)*/ig,"")))a=b.fire("paste",{html:c}),!1!==a&&(void 0!==a&&(c=a),/(class="?Mso|style="[^"]*\bmso\-|w:WordDocument)/.test(c)?e.use("editor/plugin/word-filter",function(a,m){b.insertHtml(m.toDataFormat(c,b))}):b.insertHtml(c))},0)}}}});var k=function(b,m){var l=b.get("document")[0],c=a(l.body),j=!1,e=function(){j=!0};c.on(m,e);(7<d.ie?l:l.selection.createRange()).execCommand(m);c.detach(m,e);return j},o=d.ie?function(a,m){return k(a,
m)}:function(a,m){try{return a.get("document")[0].execCommand(m)}catch(l){return!1}},s={cut:"\u60a8\u7684\u6d4f\u89c8\u5668\u5b89\u5168\u8bbe\u7f6e\u4e0d\u5141\u8bb8\u7f16\u8f91\u5668\u81ea\u52a8\u6267\u884c\u526a\u5207\u64cd\u4f5c\uff0c\u8bf7\u4f7f\u7528\u952e\u76d8\u5feb\u6377\u952e(Ctrl/Cmd+X)\u6765\u5b8c\u6210",copy:"\u60a8\u7684\u6d4f\u89c8\u5668\u5b89\u5168\u8bbe\u7f6e\u4e0d\u5141\u8bb8\u7f16\u8f91\u5668\u81ea\u52a8\u6267\u884c\u590d\u5236\u64cd\u4f5c\uff0c\u8bf7\u4f7f\u7528\u952e\u76d8\u5feb\u6377\u952e(Ctrl/Cmd+C)\u6765\u5b8c\u6210",paste:"\u60a8\u7684\u6d4f\u89c8\u5668\u5b89\u5168\u8bbe\u7f6e\u4e0d\u5141\u8bb8\u7f16\u8f91\u5668\u81ea\u52a8\u6267\u884c\u7c98\u8d34\u64cd\u4f5c\uff0c\u8bf7\u4f7f\u7528\u952e\u76d8\u5feb\u6377\u952e(Ctrl/Cmd+V)\u6765\u5b8c\u6210"},r={copy:"\u590d\u5236",paste:"\u7c98\u8d34",cut:"\u526a\u5207"};return{init:function(a){var m;a.docReady(function(){m=new f(a)});var l={copy:1,cut:1,paste:1},b=["copy","cut","paste"];a.on("contextmenu",function(j){var d=j.contextmenu;if(!d.__copy_fix){d.__copy_fix=1;for(j=0;j<
b.length;j++)d.addChild({content:r[b[j]],value:b[j]});d.on("click",function(m){var b=m.target.get("value");l[b]&&(d.hide(),setTimeout(function(){a.execCommand("save");a.execCommand(b);setTimeout(function(){a.execCommand("save")},10)},30))})}for(var c=d.get("children"),j=c.length-1;j--;0<=j){var e=c[j],f;f=e.get?e.get("value"):e.value;l[f]&&(f=!m._stateFromNamedCommand(f),e.set?e.set("disabled",f):e.disabled=f)}})}}},{requires:["./base","./range","./selection","node"]});
KISSY.add("editor/core/dom",function(e,g,i){function h(a,b){var c=a[b?"next":"prev"](f,1);if(c&&c[0].nodeType==d.ELEMENT_NODE){for(var j=[];c.attr("_ke_bookmark")||c._4e_isEmptyInlineRemovable(f);)if(j.push(c),c=b?c.next(f,1):c.prev(f,1),!c)return;if(a._4e_isIdentical(c,f)){for(var e=new n(b?a[0].lastChild:a[0].firstChild);j.length;)j.shift()._4e_move(a,!b,f);c._4e_moveChildren(a,!b,f);c.remove();e[0]&&e[0].nodeType==d.ELEMENT_NODE&&e._4e_mergeSiblings()}}}var f=f,c=g.XHTML_DTD,a=e.DOM,d=a.NodeType,
b=e.UA,n=e.Node,k={a:1,abbr:1,acronym:1,address:1,b:1,bdo:1,big:1,cite:1,code:1,del:1,dfn:1,em:1,font:1,i:1,ins:1,label:1,kbd:1,q:1,s:1,samp:1,small:1,span:1,strike:1,strong:1,sub:1,sup:1,tt:1,u:1,"var":1};g.POSITION={POSITION_IDENTICAL:0,POSITION_DISCONNECTED:1,POSITION_FOLLOWING:2,POSITION_PRECEDING:4,POSITION_IS_CONTAINED:8,POSITION_CONTAINS:16};var o=g.POSITION,s={block:1,"list-item":1,table:1,"table-row-group":1,"table-header-group":1,"table-footer-group":1,"table-row":1,"table-column-group":1,
"table-column":1,"table-cell":1,"table-caption":1},r={hr:1},q=function(a){return a&&(a[0]||a)};i.injectDom({_4e_sameLevel:function(a,b){var b=q(b),d=a.parentNode;return d&&d==b.parentNode},_4e_isBlockBoundary:function(b,l){var d=e.merge(r,l);return!(!s[a.css(b,"display")]&&!d[a.nodeName(b)])},_4e_index:function(a,b){for(var d=a.parentNode.childNodes,j,c=-1,p=0;p<d.length;p++)if(j=d[p],!b||!(3==j.nodeType&&j.previousSibling&&3==j.previousSibling.nodeType))if(c++,j===a)return c;return-1},_4e_move:function(a,
b,d){b=q(b);d?b.insertBefore(a,b.firstChild):b.appendChild(a)},_4e_isIdentical:function(b,l){if(!l)return!1;l=q(l);if(a.nodeName(b)!=a.nodeName(l))return!1;var d=b.attributes,j=l.attributes,c=d.length,p=j.length;if(c!=p)return!1;for(var e=0;e<c;e++){var f=d[e],k=f.name;if(f.specified&&a.attr(b,k)!=a.attr(l,k))return!1}if(8>i.ieEngine)for(e=0;e<p;e++)if(f=j[e],k=f.name,f.specified&&a.attr(b,k)!=a.attr(l,k))return!1;return!0},_4e_isEmptyInlineRemovable:function(b){if(!c.$removeEmpty[a.nodeName(b)])return!1;
for(var b=b.childNodes,l=0,f=b.length;l<f;l++){var j=b[l],k=j.nodeType;if(!(k==d.ELEMENT_NODE&&j.getAttribute("_ke_bookmark"))&&(k==d.ELEMENT_NODE&&!a._4e_isEmptyInlineRemovable(j)||k==a.NodeType.TEXT_NODE&&e.trim(j.nodeValue)))return!1}return!0},_4e_moveChildren:function(a,b,d){b=q(b);if(a!=b)if(d)for(;d=a.lastChild;)b.insertBefore(a.removeChild(d),b.firstChild);else for(;d=a.firstChild;)b.appendChild(a.removeChild(d))},_4e_mergeSiblings:function(a){a=new n(a);k[a.nodeName()]&&(h(a,!0),h(a))},_4e_splitText:function(m,
l){var d=m.ownerDocument;if(m.nodeType==a.NodeType.TEXT_NODE){if(b.ie&&l==m.nodeValue.length){var j=d.createTextNode("");a.insertAfter(j,m);return j}j=m.splitText(l);d.documentMode&&(d=d.createTextNode(""),a.insertAfter(d,j),a.remove(d));return j}},_4e_parents:function(a,b){var d=[];d.__IS_NODELIST=1;do d[b?"push":"unshift"](a);while(a=a.parentNode);return d},_4e_nextSourceNode:function(b,l,c,j){if(j&&!j.call)var e=q(j),j=function(a){return a!==e};var l=!l&&b.firstChild,p=b;if(!l){if(b.nodeType==
d.ELEMENT_NODE&&j&&!1===j(b,!0))return null;l=b.nextSibling}for(;!l&&(p=p.parentNode);){if(j&&!1===j(p,!0))return null;l=p.nextSibling}return!l||j&&!1===j(l)?null:c&&c!=l.nodeType?a._4e_nextSourceNode(l,!1,c,j):l},_4e_previousSourceNode:function(b,l,c,j){if(j&&!j.call)var e=q(j),j=function(a){return a!==e};var l=!l&&b.lastChild,p=b;if(!l){if(b.nodeType==d.ELEMENT_NODE&&j&&!1===j(b,!0))return null;l=b.previousSibling}for(;!l&&(p=p.parentNode);){if(j&&!1===j(p,!0))return null;l=p.previousSibling}return!l||
j&&!1===j(l)?null:c&&l.nodeType!=c?a._4e_previousSourceNode(l,!1,c,j):l},_4e_commonAncestor:function(b,d){d=q(d);if(b===d)return b;if(a.contains(d,b))return d;var c=b;do if(a.contains(c,d))return c;while(c=c.parentNode);return null},_4e_hasAttributes:9>i.ieEngine?function(a){for(var b=a.attributes,d=0;d<b.length;d++){var j=b[d];switch(j.name){case "class":if(a.getAttribute("class"))return!0;break;default:if(j.specified)return!0}}return!1}:function(a){b.gecko&&a.removeAttribute("_moz_dirty");return a.hasAttributes()},
_4e_position:function(b,c){var e=q(c);if(b.compareDocumentPosition)return b.compareDocumentPosition(e);if(b==e)return o.POSITION_IDENTICAL;if(b.nodeType==d.ELEMENT_NODE&&e.nodeType==d.ELEMENT_NODE){if(a.contains(b,e))return o.POSITION_CONTAINS+o.POSITION_PRECEDING;if(a.contains(e,b))return o.POSITION_IS_CONTAINED+o.POSITION_FOLLOWING;if("sourceIndex"in b)return 0>b.sourceIndex||0>e.sourceIndex?o.POSITION_DISCONNECTED:b.sourceIndex<e.sourceIndex?o.POSITION_PRECEDING:o.POSITION_FOLLOWING}for(var j=
a._4e_address(b),e=a._4e_address(e),f=Math.min(j.length,e.length),p=0;p<=f-1;p++)if(j[p]!=e[p])return j[p]<e[p]?o.POSITION_PRECEDING:o.POSITION_FOLLOWING;return j.length<e.length?o.POSITION_CONTAINS+o.POSITION_PRECEDING:o.POSITION_IS_CONTAINED+o.POSITION_FOLLOWING},_4e_address:function(b,d){for(var c=[],j=b.ownerDocument.documentElement,e=b;e&&e!=j;)c.unshift(a._4e_index(e,d)),e=e.parentNode;return c},_4e_remove:function(a,b){var d=a.parentNode;if(d){if(b)for(var j;j=a.firstChild;)d.insertBefore(a.removeChild(j),
a);d.removeChild(a)}return a},_4e_trim:function(b){a._4e_ltrim(b);a._4e_rtrim(b)},_4e_ltrim:function(b){for(var d;d=b.firstChild;){if(d.nodeType==a.NodeType.TEXT_NODE){var c=i.ltrim(d.nodeValue),j=d.nodeValue.length;if(c)c.length<j&&(a._4e_splitText(d,j-c.length),b.removeChild(b.firstChild));else{b.removeChild(d);continue}}break}},_4e_rtrim:function(d){for(var c;c=d.lastChild;){if(c.type==a.NodeType.TEXT_NODE){var e=i.rtrim(c.nodeValue),j=c.nodeValue.length;if(e)e.length<j&&(a._4e_splitText(c,e.length),
d.removeChild(d.lastChild));else{d.removeChild(c);continue}}break}!b.ie&&!b.opera&&(c=d.lastChild)&&1==c.nodeType&&"br"==a.nodeName(c)&&d.removeChild(c)},_4e_appendBogus:function(d){for(var c=d.lastChild;c&&c.nodeType==a.NodeType.TEXT_NODE&&!e.trim(c.nodeValue);)c=c.previousSibling;if(!c||c.nodeType==a.NodeType.TEXT_NODE||"br"!==a.nodeName(c))c=b.opera?d.ownerDocument.createTextNode(""):d.ownerDocument.createElement("br"),d.appendChild(c)},_4e_setMarker:function(a,b,d,c){var a=new n(a),f=a.data("list_marker_id")||
a.data("list_marker_id",e.guid()).data("list_marker_id"),p=a.data("list_marker_names")||a.data("list_marker_names",{}).data("list_marker_names");b[f]=a;p[d]=1;return a.data(d,c)},_4e_clearMarkers:function(a,b,d){var a=new n(a),c=a.data("list_marker_names"),e=a.data("list_marker_id"),p;for(p in c)a.removeData(p);a.removeData("list_marker_names");d&&(a.removeData("list_marker_id"),delete b[e])},_4e_copyAttributes:function(d,c,e){for(var c=new n(c),j=d.attributes,e=e||{},f=0;f<j.length;f++){var p=j[f],
k=p.name.toLowerCase(),o;if(!(k in e))if("checked"==k&&(o=a.attr(d,k)))c.attr(k,o);else if(p.specified||b.ie&&p.value&&"value"==k)o=a.attr(d,k),null===o&&(o=p.nodeValue),c.attr(k,o)}""!==d.style.cssText&&(c[0].style.cssText=d.style.cssText)},_4e_isEditable:function(b){b=a.nodeName(b);return(b=!c.$nonEditable[b]&&(c[b]||c.span))&&b["#text"]},_4e_getByAddress:function(a,b,d){for(var a=a.documentElement,c=0;a&&c<b.length;c++){var e=b[c];if(d)for(var f=-1,k=0;k<a.childNodes.length;k++){var n=a.childNodes[k];
if(!(!0===d&&3==n.nodeType&&n.previousSibling&&3==n.previousSibling.nodeType)&&(f++,f==e)){a=n;break}}else a=a.childNodes[e]}return a}})},{requires:["./base","./utils","node"]});
KISSY.add("editor/core/domIterator",function(e,g){function i(a){1>arguments.length||(this.range=a,this.forceBrBreak=f,this.enlargeBr=h,this.enforceRealBlocks=f,this._||(this._={}))}var h=!0,f=!1,c=e.UA,a=g.Walker,d=g.Range,b=g.RANGE,n=g.ElementPath,k=e.Node,o=e.DOM,s=/^[\r\n\t ]*$/;e.augment(i,{getNextParagraph:function(g){var i,m,l,t,j;if(!this._.lastNode){m=this.range.clone();m.shrink(b.SHRINK_ELEMENT,h);m.enlarge(this.forceBrBreak||!this.enlargeBr?b.ENLARGE_LIST_ITEM_CONTENTS:b.ENLARGE_BLOCK_CONTENTS);
var u=new a(m),p=a.bookmark(h,h);u.evaluator=p;this._.nextNode=u.next();u=new a(m);u.evaluator=p;u=u.previous();this._.lastNode=u._4e_nextSourceNode(h);this._.lastNode&&this._.lastNode[0].nodeType==o.NodeType.TEXT_NODE&&!e.trim(this._.lastNode[0].nodeValue)&&this._.lastNode.parent()._4e_isBlockBoundary()&&(p=new d(m.document),p.moveToPosition(this._.lastNode,b.POSITION_AFTER_END),p.checkEndOfBlock()&&(p=new n(p.endContainer),this._.lastNode=(p.block||p.blockLimit)._4e_nextSourceNode(h)));this._.lastNode||
(this._.lastNode=this._.docEndMarker=new k(m.document.createTextNode("")),o.insertAfter(this._.lastNode[0],u[0]));m=null}p=this._.nextNode;u=this._.lastNode;for(this._.nextNode=null;p;){var y=f,v=p[0].nodeType!=o.NodeType.ELEMENT_NODE,w=f;if(v)p[0].nodeType==o.NodeType.TEXT_NODE&&s.test(p[0].nodeValue)&&(v=f);else{var x=p.nodeName();if(p._4e_isBlockBoundary(this.forceBrBreak&&{br:1})){if("br"==x)v=h;else if(!m&&!p[0].childNodes.length&&"hr"!=x){i=p;l=p.equals(u);break}m&&(m.setEndAt(p,b.POSITION_BEFORE_START),
"br"!=x&&(this._.nextNode=p));y=h}else{if(p[0].firstChild){m||(m=new d(this.range.document),m.setStartAt(p,b.POSITION_BEFORE_START));p=new k(p[0].firstChild);continue}v=h}}v&&!m&&(m=new d(this.range.document),m.setStartAt(p,b.POSITION_BEFORE_START));l=(!y||v)&&p.equals(u);if(m&&!y)for(;!p[0].nextSibling&&!l;){x=p.parent();if(x._4e_isBlockBoundary(this.forceBrBreak&&{br:1})){y=h;l||x.equals(u);break}p=x;v=h;l=p.equals(u);w=h}v&&m.setEndAt(p,b.POSITION_AFTER_END);p=p._4e_nextSourceNode(w,null,u);if((l=
!p)||y&&m)break}if(!i){if(!m)return this._.docEndMarker&&this._.docEndMarker._4e_remove(),this._.nextNode=null;i=new n(m.startContainer);p=i.blockLimit;y={div:1,th:1,td:1};i=i.block;if((!i||!i[0])&&!this.enforceRealBlocks&&y[p.nodeName()]&&m.checkStartOfBlock()&&m.checkEndOfBlock())i=p;else if(!i||this.enforceRealBlocks&&"li"==i.nodeName())i=new k(this.range.document.createElement(g||"p")),i[0].appendChild(m.extractContents()),i._4e_trim(),m.insertNode(i),t=j=h;else if("li"!=i.nodeName()){if(!m.checkStartOfBlock()||
!m.checkEndOfBlock())i=i.clone(f),i[0].appendChild(m.extractContents()),i._4e_trim(),j=m.splitBlock(),t=!j.wasStartOfBlock,j=!j.wasEndOfBlock,m.insertNode(i)}else l||(this._.nextNode=i.equals(u)?null:m.getBoundaryNodes().endNode._4e_nextSourceNode(h,null,u))}t&&(m=new k(i[0].previousSibling),m[0]&&m[0].nodeType==o.NodeType.ELEMENT_NODE&&("br"==m.nodeName()?m._4e_remove():m[0].lastChild&&"br"==o.nodeName(m[0].lastChild)&&o._4e_remove(m[0].lastChild)));j&&(m=a.bookmark(f,h),t=new k(i[0].lastChild),
t[0]&&t[0].nodeType==o.NodeType.ELEMENT_NODE&&"br"==t.nodeName()&&(c.ie||t.prev(m,1)||t.next(m,1))&&t.remove());this._.nextNode||(this._.nextNode=l||i.equals(u)?null:i._4e_nextSourceNode(h,null,u));return i}});d.prototype.createIterator=function(){return new i(this)};return i},{requires:["./base","./range","./elementPath","./walker","node"]});
KISSY.add("editor",function(e,g,i,h,f,c,a,d,b,n){function k(a,b){var d=a.body;A(function(){a.designMode="on";setTimeout(function(){a.designMode="off";d.focus();arguments.callee.retry||(arguments.callee.retry=m)},50)},function(){a.designMode="off";v.attr(d,"contentEditable",j);v.attr(d,"contentEditable",m);!b&&k(a,1)})}function o(a){a.get("iframe");var b=a.get("textarea")[0],d=a.get("window")[0],c=a.get("document")[0];p.webkit&&(z.on(c,"click",function(a){var b=new x(a.target);e.inArray(b.nodeName(),
["input","select"])&&a.preventDefault()}),z.on(c,"mouseup",function(a){var b=new x(a.target);e.inArray(b.nodeName(),["input","textarea"])&&a.preventDefault()}));if(p.gecko||y||p.opera){var f;f=(new x('<span tabindex="-1" style="position:absolute; left:-10000" role="presentation"></span>')).insertAfter(b);f.on("focus",function(){a.focus()});a.activateGecko=function(){p.gecko&&a.__iframeFocus&&f[0].focus()};a.on("destroy",function(){f.detach();f.remove()})}z.on(d,"focus",function(){p.gecko?k(c,j):p.opera&&
c.body.focus();a.notifySelectionChange()});if(p.gecko)z.on(c,"mousedown",function(){a.__iframeFocus||k(c,j)});if(y&&(z.on(c,"keydown",function(b){if(b.keyCode in{8:1,46:1}){var d=a.getSelection(),c=d.getSelectedElement();if(c){a.execCommand("save");var j=d.getRanges()[0].createBookmark();c.remove();d.selectBookmarks([j]);a.execCommand("save");b.preventDefault()}}}),"CSS1Compat"==c.compatMode)){var l={33:1,34:1};z.on(c,"keydown",function(b){b.keyCode in l&&setTimeout(function(){a.getSelection().scrollIntoView()},
0)})}if(p.webkit)z.on(c,"mousedown",function(b){b=new x(b.target);e.inArray(b.nodeName(),["img","hr","input","textarea","select"])&&a.getSelection().selectElement(b)});if(p.gecko)z.on(c,"dragstart",function(a){var b=new x(a.target);b.nodeName()==="img"&&/ke_/.test(b[0].className)&&a.preventDefault()});h.add(a)}function s(a,b,d,c){var j="",f,p=i.debugUrl("theme/editor-iframe.css");for(f=0;f<d.length;f++)j+=e.substitute('<link href="{href}" rel="stylesheet" />',{href:d[f]});return e.substitute(D,{doctype:8===
u.documentMode?'<meta http-equiv="X-UA-Compatible" content="IE=7" />':"",title:"${title}",links:j,href:p,style:b,data:c||"&nbsp;",script:a?'<script id="ke_active_script">'+(v.isCustomDomain()?'document.domain="'+u.domain+'";':"")+'parent.KISSY.Editor._initIFrame("'+a+'");<\/script>':""})}function r(a,b){function d(){p=f.document;a.setInternal("document",new x(p));a.setInternal("window",new x(f));c.detach();p.open("text/html","replace");p.write(j);p.close()}var c=a.get("iframe"),j=s(a._UUID,a.get("customStyle"),
a.get("customLink"),b),e=c[0],f=e.contentWindow,p;c.__loaded=1;try{p=f.document}catch(l){if(e.src=e.src,7>y){setTimeout(d,10);return}}d()}function q(a,b){var d=v.getEmptyIframeSrc()||"";d&&(d=' src="'+d+'" ');var d=new x(e.substitute(C,{iframeSrc:d})),c=a.get("textarea");c.hasAttr("tabindex")&&d.attr("tabIndex",p.webkit?-1:c.attr("tabIndex"));c.parent().prepend(d);a.set("iframe",d);a.__docReady=0;if(p.gecko&&!d.__loaded)d.on("load",function(){r(a,b)},a);else r(a,b)}var m=!0,l=l,t=e.all,j=!1,u=document,
p=e.UA,y=p.ie,v=e.DOM,w=v.NodeType,x=e.Node,z=e.Event,A=i.tryThese,D="<!doctype html><html><head>{doctype}<title>{title}</title><link href='{href}' rel='stylesheet' /><style>{style}</style>{links}</head><body class='ks-editor' >{data}{script}</body></html>",C='<iframe style="width:100%;height:100%;border:none;"  frameborder="0"  title="kissy-editor"  allowTransparency="true"  {iframeSrc} ></iframe>',B='<div class="{prefixCls}editor-tools"></div><div class="{prefixCls}editor-textarea-wrap" '+(p.mobile?
'style="overflow:scroll;-webkit-overflow-scrolling:touch;"':"")+"></div><div class='{prefixCls}editor-status'></div>";e.mix(g,{SOURCE_MODE:0,WYSIWYG_MODE:1});var F=g.WYSIWYG_MODE;e.augment(g,{createDom:function(){var a,b=this.get("prefixCls"),d=this.get("textarea"),c;d?(this.set("textarea",d=t(d)),d[0].parentNode&&d[0].parentNode.removeChild(d[0])):this.set("textarea",d=t("<textarea class='"+b+"-editor-textarea'></textarea>"));c=this.get("el");c.html(e.substitute(B,{prefixCls:b}));a=c.one(e.substitute(".{prefixCls}editor-textarea-wrap",
{prefixCls:b}));this._UUID=e.guid();this.set({toolBarEl:c.one(e.substitute(".{prefixCls}editor-tools",{prefixCls:b})),statusBarEl:c.one(e.substitute(".{prefixCls}editor-status",{prefixCls:b}))},{silent:1});d.css("width","100%");d.css("display","none");a.append(d);h.register(this)},renderUI:function(){a.init(this);d.init(this);b.init(this);n.init(this)},bindUI:function(){function a(){b.detach("docReady",a);if(b.get("focused"))b.focus();else{var d=b.getSelection();d&&d.removeAllRanges()}}var b=this,
d,c=b.get("prefixCls"),j=b.get("textarea");if(b.get("attachForm")&&(d=j[0].form))z.on(d,"submit",b.sync,b),b.on("destroy",function(){z.detach(d,"submit",b.sync,b)});b.on("docReady",a);b.on("blur",function(){b.get("el").removeClass(c+"editor-focused")});b.on("focus",function(){b.get("el").addClass(c+"editor-focused")})},_onSetHeight:function(a){var b=this.get("textarea"),d=this.get("toolBarEl"),c=this.get("statusBarEl"),a=parseInt(a,10),a=a-((d&&d.outerHeight()||0)+(c&&c.outerHeight()||0));b.parent().css("height",
a);b.css("height",a)},_onSetMode:function(a){var b=this,d,c=b.get("rendered"),j=b.get("iframe"),e=b.get("textarea");a==F?(c&&b.execCommand("save"),b.on("docReady",d=function(){c&&b.execCommand("save");b.detach("docReady",d)}),b._setData(e.val()),e.hide(),b.fire("wysiwygMode")):(j&&(e.val(b._getData(1,F)),j.hide()),e.show(),b.fire("sourceMode"))},_onSetFocused:function(a){a&&this.__docReady&&this.focus()},destructor:function(){var a=this.get("document")[0],b=this.get("window");this.sync();h.remove(this);
z.remove([a,a.documentElement,a.body,b[0]]);e.each(this.__controls,function(a){a.destroy&&a.destroy()});this.__commands={};this.__controls={}},getControl:function(a){return this.__controls[a]},getControls:function(){return this.__controls},addControl:function(a,b){this.__controls[a]=b},showDialog:function(a,b){var a=a+"/dialog",d=this.__controls[a];d.show(b);this.fire("dialogShow",{dialog:d.dialog,pluginDialog:d,dialogName:a})},addCommand:function(a,b){this.__commands[a]=b},hasCommand:function(a){return this.__commands[a]},
execCommand:function(a){var b=this.__commands[a],d=e.makeArray(arguments);d.shift();d.unshift(this);return b?b.exec.apply(b,d):l},queryCommandValue:function(a){return this.execCommand(i.getQueryCmd(a))},_getData:function(a,b){var d=this.htmlDataProcessor,c;b==l&&(b=this.get("mode"));c=b==F?this.get("document")[0].body.innerHTML:d.toDataFormat(this.get("textarea").val());c=a?d.toHtml(c):d.toServer(c);c=e.trim(c);/^(?:<(p)>)?(?:(?:&nbsp;)|\s)*(?:<\/\1>)?$/.test(c)&&(c="");return c},_setData:function(a){var b,
d=a;if(this.get("mode")!=F)this.get("textarea").val(a);else{if(b=this.htmlDataProcessor)d=b.toDataFormat(a);if(this.get("iframe")){a=this.get("iframe");b=this.get("window")[0];var c=this.get("document")[0];z.remove([c,c.documentElement,c.body,b]);a.remove()}q(this,d)}},sync:function(){this.get("textarea").val(this.get("data"))},getDocHtml:function(){return s(0,this.get("customStyle"),this.get("customLink"),this.get("formatData"))},getSelection:function(){return g.Selection.getSelection(this.get("document")[0])},
focus:function(){var a=this.get("window");if(a){var b=this.get("document")[0],a=a[0];p.ie||a&&a.parent&&a.parent.focus();a&&a.focus();try{b.body.focus()}catch(d){}this.notifySelectionChange()}},blur:function(){this.get("window")[0].blur();this.get("document")[0].body.blur()},addCustomStyle:function(a,b){var d=this.get("window"),c=this.get("customStyle")||"";this.set("customStyle",c+("\n"+a));d&&v.addStyleSheet(d,a,b)},removeCustomStyle:function(a){v.remove(v.get("#"+a,this.get("window")[0]))},addCustomLink:function(a){var b=
this.get("customLink")||[],d=this.get("document")[0];b.push(a);this.set("customLink",b);b=d.createElement("link");b.rel="stylesheet";d.getElementsByTagName("head")[0].appendChild(b);b.href=a},removeCustomLink:function(a){for(var b=this.get("document")[0],b=v.query("link",b),d=0;d<b.length;d++)v.attr(b[d],"href")==a&&v.remove(b[d]);b=this.get("customLink")||[];a=e.indexOf(a,b);-1!=a&&b.splice(a,1)},docReady:function(a){this.on("docReady",a);this.__docReady&&a.call(this)},checkSelectionChange:function(){var a=
this;a.__checkSelectionChangeId&&clearTimeout(a.__checkSelectionChangeId);a.__checkSelectionChangeId=setTimeout(function(){var b=a.getSelection();if(b&&!b.isInvalid){var d=b.getStartElement(),c=new g.ElementPath(d);if(!a.__previousPath||!a.__previousPath.compare(c))a.__previousPath=c,a.fire("selectionChange",{selection:b,path:c,element:d})}},100)},notifySelectionChange:function(){this.__previousPath=null;this.checkSelectionChange()},insertElement:function(a){if(this.get("mode")!==F)return l;this.focus();
var b,d=a.nodeName(),c=g.XHTML_DTD,j=c.$block[d],e=g.RANGE,f=(d=this.getSelection())&&d.getRanges(),p,k,n;if(!f||0==f.length)return l;this.execCommand("save");for(k=f.length-1;0<=k;k--)p=f[k],b=!k&&a||a.clone(m),p.insertNodeByDtd(b),n||(n=b);if(!n)return l;p.moveToPosition(n,e.POSITION_AFTER_END);j&&(a=g.Walker.whitespaces(!0),(a=(n=n.next(a,1))&&n[0].nodeType==w.ELEMENT_NODE&&n.nodeName())&&c.$block[a]&&c[a]["#text"]&&p.moveToElementEditablePosition(n));d.selectRanges([p]);this.focus();b&&1==b[0].nodeType&&
b.scrollIntoView(l,{alignWithTop:!1,allowHorizontalScroll:!0,onlyScrollIfNeeded:!0});E.call(this);return b},insertHtml:function(a,b){var d=this,c,e=d.get("document")[0];if(d.get("mode")===F){if(c=d.htmlDataProcessor)a=c.toDataFormat(a,b);d.focus();d.execCommand("save");if(y){c=e.selection;"Control"==c.type&&c.clear();try{c.createRange().pasteHTML(a)}catch(f){}}else try{e.execCommand("inserthtml",j,a)}catch(p){setTimeout(function(){if(0==d.getSelection().getRanges().length){var b=new g.Range(e),c=
v.first(e.body,function(a){return 1==a.nodeType&&"br"!=v.nodeName(a)});c||(c=new x(e.createElement("p")),c._4e_appendBogus(l),e.body.appendChild(c[0]));b.setStartAt(c,g.RANGE.POSITION_AFTER_START);b.select()}e.execCommand("inserthtml",j,a)},50)}setTimeout(function(){d.getSelection().scrollIntoView()},50);E.call(d)}},insertHTML:function(a,b){return this.insertHtml(a,b)}});g._initIFrame=function(a){var b=h.getInstance(a),d=b.get("document")[0],a=d.getElementById("ke_active_script");v.remove(a);o(b);
var c=d.body;y?(c.hideFocus=m,c.disabled=m,c.contentEditable=m,c.removeAttribute("disabled")):setTimeout(function(){p.gecko||p.opera?c.contentEditable=m:p.webkit?c.parentNode.contentEditable=m:d.designMode="on"},0);if(p.gecko||p.opera){var e=d.documentElement;z.on(e,"mousedown",function(a){if(a.target==e){p.gecko&&k(d,j);b.activateGecko()}})}setTimeout(function(){y&&setTimeout(function(){if(d){c.runtimeStyle.marginBottom="0px";c.runtimeStyle.marginBottom=""}},1E3)},0);setTimeout(function(){b.__docReady=
1;b.fire("docReady");var a=b.get("disableObjectResizing"),e=b.get("disableInlineTableEditing");if(a||e)try{d.execCommand("enableObjectResizing",j,!a);d.execCommand("enableInlineTableEditing",j,!e)}catch(f){z.on(c,y?"resizestart":"resize",function(b){var d=new x(b.target);(a||d.nodeName()==="table"&&e)&&b.preventDefault()})}},10)};var E=e.buffer(function(){this.execCommand("save")},50);return g},{requires:"editor/core/base,editor/core/utils,editor/core/focusManager,editor/core/styles,editor/core/zIndexManager,editor/core/clipboard,editor/core/enterKey,editor/core/htmlDataProcessor,editor/core/selectionFix".split(",")});
KISSY.add("editor/core/elementPath",function(e,g){function i(b){for(var e=c,k=c,o=[];b;){if(b[0].nodeType==h.NodeType.ELEMENT_NODE){this.lastElement||(this.lastElement=b);var i=b.nodeName();if(!k&&(!e&&a[i]&&(e=b),d[i])){var g;if(g=!e)if(g="div"==i){a:{g=b[0].childNodes;for(var q=0,m=g.length;q<m;q++){var l=g[q];if(l.nodeType==h.NodeType.ELEMENT_NODE&&f.$block[l.nodeName.toLowerCase()]){g=!0;break a}}g=!1}g=!g}g?e=b:k=b}o.push(b);if("body"==i)break}b=b.parent()}this.block=e;this.blockLimit=k;this.elements=
o}var h=e.DOM,f=g.XHTML_DTD,c=null,a={address:1,blockquote:1,dl:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,p:1,pre:1,li:1,dt:1,dd:1},d={body:1,div:1,table:1,tbody:1,tr:1,td:1,th:1,caption:1,form:1};i.prototype={constructor:i,compare:function(a){var d=this.elements,a=a&&a.elements;if(!a||d.length!=a.length)return!1;for(var c=0;c<d.length;c++)if(!h.equals(d[c],a[c]))return!1;return!0},contains:function(a){for(var d=this.elements,e=0;e<d.length;e++)if(d[e].nodeName()in a)return d[e];return c},toString:function(){var a=
this.elements,d,c=[];for(d=0;d<a.length;d++)c.push(a[d].nodeName());return c.toString()}};return g.ElementPath=i},{requires:["./base","./dom","node"]});
KISSY.add("editor/core/enterKey",function(e,g,i,h){function f(c){var f;f=c.getSelection().getRanges();for(var k=f.length-1;0<k;k--)f[k].deleteContents();f=f[0];k=f.document;if(f.checkStartOfBlock()&&f.checkEndOfBlock()){var g=(new h(f.startContainer)).block;if(g&&("li"==g.nodeName()||"li"==g.parent().nodeName()))return c.hasCommand("outdent")?(c.execCommand("save"),c.execCommand("outdent"),c.execCommand("save"),!0):!1}var m=f.splitBlock("p");if(!m)return!0;var c=m.previousBlock,g=m.nextBlock,l=m.wasStartOfBlock,
t=m.wasEndOfBlock,j;if(g)j=g.parent(),"li"==j.nodeName()&&(g._4e_breakParent(j),g._4e_move(g.next(),!0));else if(c&&(j=c.parent())&&"li"==j.nodeName())c._4e_breakParent(j),f.moveToElementEditablePosition(c.next()),c._4e_move(c.prev());if(!l&&!t){if("li"==g.nodeName()&&(j=g.first(i.invisible(!0)))&&e.inArray(j.nodeName(),["ul","ol"]))(a.ie?new n(k.createTextNode("\u00a0")):new n(k.createElement("br"))).insertBefore(j);g&&f.moveToElementEditablePosition(g)}else{var u;if(c){if("li"==c.nodeName()||!d.test(c.nodeName()))u=
c.clone()}else g&&(u=g.clone());u||(u=new n("<p>",null,k));if(j=m.elementPath)for(var m=0,p=j.elements.length;m<p;m++){var y=j.elements[m];if(y.equals(j.block)||y.equals(j.blockLimit))break;b.$removeEmpty[y.nodeName()]&&(y=y.clone(),u._4e_moveChildren(y),u.append(y))}a.ie||u._4e_appendBogus();f.insertNode(u);if(a.ie&&l&&(!t||!c[0].childNodes.length))f.moveToElementEditablePosition(t?c:u),f.select();f.moveToElementEditablePosition(l&&!t?g:u)}a.ie||(g?(u=new n(k.createElement("span")),u.html("&nbsp;"),
f.insertNode(u),u.scrollIntoView(void 0,{alignWithTop:!1,allowHorizontalScroll:!0,onlyScrollIfNeeded:!0}),f.deleteContents()):u.scrollIntoView(void 0,{alignWithTop:!1,allowHorizontalScroll:!0,onlyScrollIfNeeded:!0}));f.select();return!0}function c(a){var b=a.get("document")[0];k.on(b,"keydown",function(b){if(13===b.keyCode&&!b.shiftKey&&!b.ctrlKey&&!b.metaKey){a.execCommand("save");var d=a.execCommand("enterBlock");a.execCommand("save");!1!==d&&b.preventDefault()}})}var a=e.UA,d=/^h[1-6]$/,b=g.XHTML_DTD,
n=e.Node,k=e.Event;return{init:function(a){a.addCommand("enterBlock",{exec:f});a.docReady(function(){c(a)})}}},{requires:["./base","./walker","./elementPath","node"]});
KISSY.add("editor/core/focusManager",function(e){function g(){var c=this;c.__iframeFocus=b;d=c;a&&clearTimeout(a);a=setTimeout(function(){c.fire("focus")},100)}function i(){var b=this;b.__iframeFocus=n;d=k;a&&clearTimeout(a);a=setTimeout(function(){b.fire("blur")},100)}var h=e.Editor,f=e.Event,c={},a,d,e={refreshAll:function(){for(var a in c){var b=c[a].get("document")[0];b.designMode="off";b.designMode="on"}},currentInstance:function(){return d},getInstance:function(a){return c[a]},add:function(a){var b=
a.get("window")[0];f.on(b,"focus",g,a);f.on(b,"blur",i,a)},register:function(a){c[a._UUID]=a},remove:function(a){delete c[a._UUID];var b=a.get("window")[0];f.remove(b,"focus",g,a);f.remove(b,"blur",i,a)}},b=!0,n=!1,k=null;e.refreshAll=e.refreshAll;h.focusManager=e;h.getInstances=function(){return c};return e},{requires:["./base","./dom"]});
KISSY.add("editor/core/htmlDataProcessor",function(e,g,i){return{init:function(h){function f(a){var a=a.childNodes,b,d,c,j=a.length;if(j){c=1;for(b=0;b<j;b++)if(d=a[b],d.nodeType!=e.DOM.NodeType.TEXT_NODE||d.nodeValue){c=0;break}return c?!1:void 0}return!1}function c(a){return a.replace(s,function(a,b,d){return"<"+b+d.replace(r,function(a,b){return-1==d.indexOf("_ke_saved_"+b)?" _ke_saved_"+a+" "+a:a})+">"})}function a(a){return a.replace(m,function(a){return"<ke:encoded>"+encodeURIComponent(a)+"</ke:encoded>"})}
function d(a){return a.replace(l,function(a,b){return e.urlDecode(b)})}var b=e.Node,n=e.UA,k=new i.Filter,o=new i.Filter;(function(){function a(b){b=i.serialize(b);return new i.Comment(q+encodeURIComponent(b).replace(/--/g,"%2D%2D"))}var b={tagNames:[[/^\?xml.*$/i,""],[/^.*namespace.*$/i,""]],attributeNames:[[/^on/,"ke_on"],[/^lang$/,""]],tags:{script:a,noscript:a,span:f}},d={tagNames:[[/^ke:/,""],[/^\?xml:namespace$/,""]],tags:{$:function(a){if(a.attributes.length)for(var b=["name","href","src"],
d,c=0;c<b.length;c++)d="_ke_saved_"+b[c],a.getAttribute(d)&&a.removeAttribute(b[c]);return a},embed:function(a){var b=a.parentNode;if(b&&"object"==b.nodeName){var d=b.getAttribute("width"),b=b.getAttribute("height");d&&a.setAttribute("width",d);b&&a.setAttribute("width",b)}},a:function(a){if(!a.childNodes.length&&!a.attributes.length)return!1},span:f,strong:f,em:f,del:f,u:f},attributes:{style:function(a){if(!e.trim(a))return!1}},attributeNames:[[/^_ke_saved_/,""],[/^ke_on/,"on"],[/^_ke.*/,""],[/^ke:.*$/,
""],[/^_ks.*/,""]],comment:function(a){if(a.substr(0,q.length)==q)return a=e.trim(e.urlDecode(a.substr(q.length))),i.parse(a).childNodes[0]}};n.ie&&(d.attributes.style=function(a){return a.replace(/(^|;)([^:]+)/g,function(a){return a.toLowerCase()})});k.addRules(d);o.addRules(b)})();(function(){function a(b){for(var b=b.childNodes,d=b.length,c=b[d-1];c&&3==c.nodeType&&!e.trim(c.nodeValue);)c=b[--d];return c}function b(d){var c=a(d);c&&(1==c.nodeType&&"br"==c.nodeName?d.removeChild(c):3==c.nodeType&&
f.test(c.nodeValue)&&d.removeChild(c))}function d(b){var c=a(b);return!c||"form"==b.nodeName&&"input"==c.nodeName}function c(a){b(a);d(a)&&(n.ie||a.appendChild(new i.Tag("br")))}function j(a){b(a);d(a)&&a.appendChild(new i.Text("\u00a0"))}var f=/^[\t\r\n ]*(?:&nbsp;|\xa0)[\t\r\n ]*$/,l=g.XHTML_DTD,m=e.merge(l.$block,l.$listItem,l.$tableContent),C;for(C in m)"br"in l[C]||delete m[C];delete m.pre;var l={tags:{}},h={tags:{}};for(C in m)l.tags[C]=c,h.tags[C]=j;o.addRules(l);k.addRules(h)})();k.addRules({text:function(a){return a.replace(/\xa0/g,
"&nbsp;")}});var s=/<(a|area|img|input)\b([^>]*)>/gi,r=/\b(href|src|name)\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|(?:[^ "'>]+))/gi,q="{ke_protected}",m=/(?:<textarea[^>]*>[\s\S]*<\/textarea>)|(?:<style[^>]*>[\s\S]*<\/style>)|(?:<script[^>]*>[\s\S]*<\/script>)|(?:<(:?link|meta|base)[^>]*>)/gi,l=/<ke:encoded>([^<]*)<\/ke:encoded>/gi,t=/(<\/?)((?:object|embed|param|html|body|head|title|noscript)[^>]*>)/gi,j=/(<\/?)ke:((?:object|embed|param|html|body|head|title|noscript)[^>]*>)/gi,u=/<ke:(param|embed)([^>]*?)\/?>(?!\s*<\/ke:\1)/gi;
h.htmlDataProcessor={dataFilter:o,htmlFilter:k,toHtml:function(a){n.webkit&&(a=a.replace(/\u200b/g,""));var b=new i.BeautifyWriter;(new i.Parser(a)).parse().writeHtml(b,k);return a=b.getHtml()},toDataFormat:function(e,f){var f=f||o,e=a(e),e=c(e),e=e.replace(t,"$1ke:$2"),e=e.replace(u,"<ke:$1$2></ke:$1>"),l=new b("<div>");l.html("a"+e);e=l.html().substr(1);e=e.replace(j,"$1$2");e=d(e);l=new i.BasicWriter;(new i.Parser(e)).parse().writeHtml(l,f);return e=l.getHtml()},toServer:function(a){var b=new i.MinifyWriter;
(new i.Parser(a)).parse().writeHtml(b,k);return b.getHtml()}}}}},{requires:["./base","htmlparser"]});
KISSY.config("modules",{"editor/plugin/heading/cmd":{requires:["editor"]},"editor/plugin/page-break/index":{requires:["editor","editor/plugin/fake-objects/"]},"editor/plugin/italic/cmd":{requires:["editor","editor/plugin/font/cmd"]},"editor/plugin/font-size/cmd":{requires:["editor","editor/plugin/font/cmd"]},"editor/plugin/image/dialog":{requires:["ajax","editor","editor/plugin/overlay/","tabs","editor/plugin/menubutton/"]},"editor/plugin/underline/index":{requires:["editor","editor/plugin/font/ui",
"editor/plugin/underline/cmd"]},"editor/plugin/maximize/cmd":{requires:["editor"]},"editor/plugin/contextmenu/index":{requires:["editor","menu","editor/plugin/focus-fix/"]},"editor/plugin/heading/index":{requires:["editor","editor/plugin/heading/cmd"]},"editor/plugin/drag-upload/index":{requires:["editor"]},"editor/plugin/color/cmd":{requires:["editor"]},"editor/plugin/code/index":{requires:["editor","editor/plugin/dialog-loader/"]},"editor/plugin/flash/dialog":{requires:["editor","editor/plugin/flash-common/utils",
"editor/plugin/overlay/","editor/plugin/menubutton/"]},"editor/plugin/strike-through/cmd":{requires:["editor","editor/plugin/font/cmd"]},"editor/plugin/unordered-list/index":{requires:["editor","editor/plugin/list-utils/btn","editor/plugin/unordered-list/cmd"]},"editor/plugin/outdent/cmd":{requires:["editor","editor/plugin/dent-utils/cmd"]},"editor/plugin/italic/index":{requires:["editor","editor/plugin/font/ui","editor/plugin/italic/cmd"]},"editor/plugin/remove-format/cmd":{requires:["editor"]},
"editor/plugin/font-size/index":{requires:["editor","editor/plugin/font/ui","editor/plugin/font-size/cmd"]},"editor/plugin/indent/cmd":{requires:["editor","editor/plugin/dent-utils/cmd"]},"editor/plugin/table/index":{requires:["editor","editor/plugin/dialog-loader/","editor/plugin/contextmenu/"]},"editor/plugin/word-filter/dynamic/index":{requires:["htmlparser"]},"editor/plugin/justify-left/cmd":{requires:["editor/plugin/justify-utils/cmd"]},"editor/plugin/resize/index":{requires:["editor","dd/base"]},
"editor/plugin/video/dialog":{requires:["editor","editor/plugin/flash/dialog","editor/plugin/menubutton/"]},"editor/plugin/focus-fix/index":{requires:["editor"]},"editor/plugin/xiami-music/index":{requires:["editor","editor/plugin/flash-common/baseClass","editor/plugin/flash-common/utils","editor/plugin/fake-objects/"]},"editor/plugin/maximize/index":{requires:["editor","editor/plugin/maximize/cmd"]},"editor/plugin/color/color-picker/dialog":{requires:["editor","editor/plugin/overlay/"]},"editor/plugin/smiley/index":{requires:["editor",
"editor/plugin/overlay/"]},"editor/plugin/separator/index":{requires:["editor"]},"editor/plugin/video/index":{requires:["editor","editor/plugin/flash-common/utils","editor/plugin/flash-common/baseClass","editor/plugin/fake-objects/"]},"editor/plugin/multiple-upload/index":{requires:["editor","editor/plugin/dialog-loader/"]},"editor/plugin/undo/btn":{requires:["editor","editor/plugin/button/"]},"editor/plugin/menubutton/index":{requires:["editor","menubutton"]},"editor/plugin/flash/index":{requires:["editor",
"editor/plugin/flash-common/baseClass","editor/plugin/flash-common/utils","editor/plugin/fake-objects/"]},"editor/plugin/overlay/index":{requires:["editor","overlay","editor/plugin/focus-fix/","dd/plugin/constrain","component/plugin/drag"]},"editor/plugin/link/utils":{requires:["editor"]},"editor/plugin/xiami-music/dialog":{requires:["editor","editor/plugin/flash/dialog","editor/plugin/menubutton/"]},"editor/plugin/list-utils/cmd":{requires:["editor","editor/plugin/list-utils/"]},"editor/plugin/button/index":{requires:["editor",
"button"]},"editor/plugin/checkbox-source-area/index":{requires:["editor"]},"editor/plugin/strike-through/index":{requires:["editor","editor/plugin/font/ui","editor/plugin/strike-through/cmd"]},"editor/plugin/fore-color/index":{requires:["editor","editor/plugin/color/btn","editor/plugin/fore-color/cmd"]},"editor/plugin/flash-bridge/index":{requires:["swf","editor"]},"editor/plugin/fore-color/cmd":{requires:["editor/plugin/color/cmd"]},"editor/plugin/table/dialog":{requires:["editor","editor/plugin/overlay/",
"editor/plugin/menubutton/"]},"editor/plugin/justify-utils/cmd":{requires:["editor"]},"editor/plugin/undo/index":{requires:["editor","editor/plugin/undo/btn","editor/plugin/undo/cmd"]},"editor/plugin/justify-right/cmd":{requires:["editor/plugin/justify-utils/cmd"]},"editor/plugin/image/index":{requires:["editor","editor/plugin/button/","editor/plugin/bubble/","editor/plugin/contextmenu/","editor/plugin/dialog-loader/"]},"editor/plugin/dent-utils/cmd":{requires:["editor","editor/plugin/list-utils/"]},
"editor/plugin/ordered-list/cmd":{requires:["editor","editor/plugin/list-utils/cmd"]},"editor/plugin/list-utils/index":{requires:["editor"]},"editor/plugin/dialog-loader/index":{requires:["overlay","editor"]},"editor/plugin/flash-common/utils":{requires:["swf"]},"editor/plugin/font-family/index":{requires:["editor","editor/plugin/font/ui","editor/plugin/font-family/cmd"]},"editor/plugin/undo/cmd":{requires:["editor"]},"editor/plugin/indent/index":{requires:["editor","editor/plugin/indent/cmd"]},"editor/plugin/font/cmd":{requires:["editor"]},
"editor/plugin/ordered-list/index":{requires:["editor","editor/plugin/list-utils/btn","editor/plugin/ordered-list/cmd"]},"editor/plugin/color/btn":{requires:["editor","editor/plugin/button/","editor/plugin/overlay/","editor/plugin/dialog-loader/"]},"editor/plugin/bold/cmd":{requires:["editor","editor/plugin/font/cmd"]},"editor/plugin/local-storage/index":{requires:["editor","overlay","editor/plugin/flash-bridge/"]},"editor/plugin/bubble/index":{requires:["overlay","editor"]},"editor/plugin/underline/cmd":{requires:["editor",
"editor/plugin/font/cmd"]},"editor/plugin/bold/index":{requires:["editor","editor/plugin/font/ui","editor/plugin/bold/cmd"]},"editor/plugin/back-color/index":{requires:["editor","editor/plugin/color/btn","editor/plugin/back-color/cmd"]},"editor/plugin/draft/index":{requires:["editor","editor/plugin/local-storage/","overlay","editor/plugin/menubutton/"]},"editor/plugin/link/index":{requires:["editor","editor/plugin/bubble/","editor/plugin/link/utils","editor/plugin/dialog-loader/","editor/plugin/button/"]},
"editor/plugin/remove-format/index":{requires:["editor","editor/plugin/remove-format/cmd","editor/plugin/button/"]},"editor/plugin/font/ui":{requires:["editor","editor/plugin/button/","editor/plugin/menubutton/"]},"editor/plugin/element-path/index":{requires:["editor"]},"editor/plugin/source-area/index":{requires:["editor","editor/plugin/button/"]},"editor/plugin/justify-right/index":{requires:["editor","editor/plugin/justify-right/cmd"]},"editor/plugin/list-utils/btn":{requires:["editor","editor/plugin/button/",
"editor/plugin/menubutton/"]},"editor/plugin/justify-left/index":{requires:["editor","editor/plugin/justify-left/cmd"]},"editor/plugin/outdent/index":{requires:["editor","editor/plugin/outdent/cmd"]},"editor/plugin/fake-objects/index":{requires:["editor"]},"editor/plugin/font-family/cmd":{requires:["editor","editor/plugin/font/cmd"]},"editor/plugin/back-color/cmd":{requires:["editor/plugin/color/cmd"]},"editor/plugin/link/dialog":{requires:["editor","editor/plugin/overlay/","editor/plugin/link/utils"]},
"editor/plugin/multiple-upload/dialog":{requires:"editor,component/plugin/drag,editor/plugin/progressbar/,editor/plugin/overlay/,editor/plugin/flash-bridge/,editor/plugin/local-storage/,swf".split(",")},"editor/plugin/code/dialog":{requires:["editor","editor/plugin/overlay/","menubutton"]},"editor/plugin/justify-center/cmd":{requires:["editor/plugin/justify-utils/cmd"]},"editor/plugin/flash-common/baseClass":{requires:["editor","editor/plugin/contextmenu/","editor/plugin/bubble/","editor/plugin/dialog-loader/",
"editor/plugin/flash-common/utils"]},"editor/plugin/justify-center/index":{requires:["editor","editor/plugin/justify-center/cmd"]},"editor/plugin/unordered-list/cmd":{requires:["editor","editor/plugin/list-utils/cmd"]}});
KISSY.add("editor/core/range",function(e,g,i,h,f){function c(a){var b=a.nodeType!=l.NodeType.TEXT_NODE&&l.nodeName(a)in j.$removeEmpty,d=a.nodeType==l.NodeType.TEXT_NODE&&!e.trim(a.nodeValue),a=!!a.parentNode.getAttribute("_ke_bookmark");return b||d||a}function a(a){return!w(a)&&!x(a)}function d(a){var b=s;return function(d){if(x(d))return o;if(d.nodeType==l.NodeType.TEXT_NODE){if(e.trim(d.nodeValue).length)return s}else if(d.nodeType==l.NodeType.ELEMENT_NODE&&(d=l.nodeName(d),!D[d]))if(!a&&!t.ie&&
"br"==d&&!b)b=o;else return s;return o}}function b(a,b){var d=a.startContainer,c=a.endContainer,e=a.startOffset,j=a.endOffset,f,k=s,p=s,m=void 0,n=a.document,g;0<b&&(m=n.createDocumentFragment());if(a.collapsed)return m;a.optimizeBookmark();c[0].nodeType==l.NodeType.TEXT_NODE?(p=o,c=c._4e_splitText(j)):0<c[0].childNodes.length&&(j>=c[0].childNodes.length?(c=new u(c[0].appendChild(n.createTextNode(""))),g=o):c=new u(c[0].childNodes[j]));d[0].nodeType==l.NodeType.TEXT_NODE?(k=o,d._4e_splitText(e)):
e?e>=d[0].childNodes.length?(d=new u(d[0].appendChild(n.createTextNode(""))),f=o):d=new u(d[0].childNodes[e].previousSibling):(f=new u(n.createTextNode("")),d.prepend(f),d=f,f=o);var h=d._4e_parents(),i=c._4e_parents();h.each(function(a,b){h[b]=a});i.each(function(a,b){i[b]=a});for(var v,q,n=0;n<h.length&&!(v=h[n],q=i[n],!v.equals(q));n++);for(var e=m,w,t,x=n;x<h.length;x++){w=h[x];j=0<b&&!w.equals(d)?e.appendChild(w.clone()[0]):null;w=w[0].nextSibling;t=i[x];for(var r=c[0],z=t&&t[0];w&&!(z==w||r==
w);){t=w.nextSibling;if(2==b)e.appendChild(w.cloneNode(o));else{if(y[w.nodeName.toLowerCase()]){var A=w.cloneNode(o);w.innerHTML="";w=A}else l._4e_remove(w);1==b&&e.appendChild(w)}w=t}j&&(e=j)}for(e=m;n<i.length;n++){w=i[n];j=0<b&&!w.equals(c)?e.appendChild(w.clone()[0]):null;if(!h[n]||!w._4e_sameLevel(h[n]))for(w=w[0].previousSibling;w;)t=w.previousSibling,2==b?e.insertBefore(w.cloneNode(o),e.firstChild):(l._4e_remove(w),1==b&&e.insertBefore(w,e.firstChild)),w=t;j&&(e=j)}if(2==b){if(k&&(v=d[0],v.nodeType==
l.NodeType.TEXT_NODE&&v.nextSibling&&v.nextSibling.nodeType==l.NodeType.TEXT_NODE&&(v.data+=v.nextSibling.data,v.parentNode.removeChild(v.nextSibling))),p)p=c[0],p.nodeType==l.NodeType.TEXT_NODE&&p.previousSibling&&p.previousSibling.nodeType==l.NodeType.TEXT_NODE&&(p.previousSibling.data+=p.data,p.parentNode.removeChild(p))}else{if(v&&q&&(!d._4e_sameLevel(v)||!c._4e_sameLevel(q)))p=v._4e_index(),f&&v._4e_sameLevel(d)&&p--,a.setStart(v.parent(),p+1);a.collapse(o)}f&&d.remove();g&&c.remove();return m}
function n(a){a.collapsed=a.startContainer&&a.endContainer&&a.startContainer[0]==a.endContainer[0]&&a.startOffset==a.endOffset}function k(a){this.endOffset=this.endContainer=this.startOffset=this.startContainer=r;this.collapsed=o;this.document=a}g.RANGE={POSITION_AFTER_START:1,POSITION_BEFORE_END:2,POSITION_BEFORE_START:3,POSITION_AFTER_END:4,ENLARGE_ELEMENT:1,ENLARGE_BLOCK_CONTENTS:2,ENLARGE_LIST_ITEM_CONTENTS:3,START:1,END:2,SHRINK_ELEMENT:1,SHRINK_TEXT:2};var o=!0,s=!1,r=null,q=g.RANGE,m=g.POSITION,
l=e.DOM,t=e.UA,j=g.XHTML_DTD,u=e.Node,p=u.all,y={td:1},v={area:1,base:1,br:1,col:1,hr:1,img:1,input:1,link:1,meta:1,param:1},w=new h.whitespaces,x=new h.bookmark,z=h.whitespaces(o),A=h.bookmark(!1,!0),D={abbr:1,acronym:1,b:1,bdo:1,big:1,cite:1,code:1,del:1,dfn:1,em:1,font:1,i:1,ins:1,label:1,kbd:1,q:1,samp:1,small:1,span:1,strike:1,strong:1,sub:1,sup:1,tt:1,u:1,"var":1};e.augment(k,{toString:function(){var a=[],b=this.startContainer[0],d=this.endContainer[0];a.push((b.id||b.nodeName)+":"+this.startOffset);
a.push((d.id||d.nodeName)+":"+this.endOffset);return a.join("<br/>")},optimize:function(){var a=this.startContainer,b=this.startOffset;a[0].nodeType!=l.NodeType.ELEMENT_NODE&&(b?b>=a[0].nodeValue.length&&this.setStartAfter(a):this.setStartBefore(a));a=this.endContainer;b=this.endOffset;a[0].nodeType!=l.NodeType.ELEMENT_NODE&&(b?b>=a[0].nodeValue.length&&this.setEndAfter(a):this.setEndBefore(a))},setStartAfter:function(a){this.setStart(a.parent(),a._4e_index()+1)},setStartBefore:function(a){this.setStart(a.parent(),
a._4e_index())},setEndAfter:function(a){this.setEnd(a.parent(),a._4e_index()+1)},setEndBefore:function(a){this.setEnd(a.parent(),a._4e_index())},optimizeBookmark:function(){var a=this.startContainer,b=this.endContainer;a&&"span"==a.nodeName()&&a.attr("_ke_bookmark")&&this.setStartBefore(a);b&&"span"==b.nodeName()&&b.attr("_ke_bookmark")&&this.setEndAfter(b)},setStart:function(a,b){a[0].nodeType==l.NodeType.ELEMENT_NODE&&v[a.nodeName()]&&(a=a.parent(),b=a._4e_index());this.startContainer=a;this.startOffset=
b;this.endContainer||(this.endContainer=a,this.endOffset=b);n(this)},setEnd:function(a,b){a[0].nodeType==l.NodeType.ELEMENT_NODE&&v[a.nodeName()]&&(a=a.parent(),b=a._4e_index()+1);this.endContainer=a;this.endOffset=b;this.startContainer||(this.startContainer=a,this.startOffset=b);n(this)},setStartAt:function(a,b){switch(b){case q.POSITION_AFTER_START:this.setStart(a,0);break;case q.POSITION_BEFORE_END:a[0].nodeType==l.NodeType.TEXT_NODE?this.setStart(a,a[0].nodeValue.length):this.setStart(a,a[0].childNodes.length);
break;case q.POSITION_BEFORE_START:this.setStartBefore(a);break;case q.POSITION_AFTER_END:this.setStartAfter(a)}n(this)},setEndAt:function(a,b){switch(b){case q.POSITION_AFTER_START:this.setEnd(a,0);break;case q.POSITION_BEFORE_END:a[0].nodeType==l.NodeType.TEXT_NODE?this.setEnd(a,a[0].nodeValue.length):this.setEnd(a,a[0].childNodes.length);break;case q.POSITION_BEFORE_START:this.setEndBefore(a);break;case q.POSITION_AFTER_END:this.setEndAfter(a)}n(this)},cloneContents:function(){return b(this,2)},
deleteContents:function(){return b(this,0)},extractContents:function(){return b(this,1)},collapse:function(a){a?(this.endContainer=this.startContainer,this.endOffset=this.startOffset):(this.startContainer=this.endContainer,this.startOffset=this.endOffset);this.collapsed=o},clone:function(){var a=new k(this.document);a.startContainer=this.startContainer;a.startOffset=this.startOffset;a.endContainer=this.endContainer;a.endOffset=this.endOffset;a.collapsed=this.collapsed;return a},getEnclosedNode:function(){var a=
this.clone();a.optimize();if(a.startContainer[0].nodeType!=l.NodeType.ELEMENT_NODE||a.endContainer[0].nodeType!=l.NodeType.ELEMENT_NODE)return r;var b=new h(a);b.evaluator=function(a){return z(a)&&A(a)};a=b.next();b.reset();b=b.previous();return a&&a.equals(b)?a:r},shrink:function(a,b){if(!this.collapsed){var a=a||q.SHRINK_TEXT,d=this.clone(),c=this.startContainer,e=this.endContainer,j=this.startOffset,f=this.endOffset,k=o,p,m,n=o;c&&c[0].nodeType==l.NodeType.TEXT_NODE&&(j?j>=c[0].nodeValue.length?
d.setStartAfter(c):(d.setStartBefore(c),k=s):d.setStartBefore(c));e&&e[0].nodeType==l.NodeType.TEXT_NODE&&(f?f>=e[0].nodeValue.length?d.setEndAfter(e):(d.setEndAfter(e),n=s):d.setEndBefore(e));if(k||n)m=new h(d),m.evaluator=function(b){return b.nodeType==(a==q.SHRINK_ELEMENT?l.NodeType.ELEMENT_NODE:l.NodeType.TEXT_NODE)},m.guard=function(b,d){if(a==q.SHRINK_ELEMENT&&b.nodeType==l.NodeType.TEXT_NODE||d&&b==p)return s;!d&&b.nodeType==l.NodeType.ELEMENT_NODE&&(p=b);return o};k&&(d=m[a==q.SHRINK_ELEMENT?
"lastForward":"next"]())&&this.setStartAt(d,b?q.POSITION_AFTER_START:q.POSITION_BEFORE_START);n&&(m.reset(),(m=m[a==q.SHRINK_ELEMENT?"lastBackward":"previous"]())&&this.setEndAt(m,b?q.POSITION_BEFORE_END:q.POSITION_AFTER_END));return k||n}},createBookmark2:function(a){var b=this.startContainer,d=this.endContainer,c=this.startOffset,e=this.endOffset,j,f;if(!b||!d)return{start:0,end:0};if(a){if(b[0].nodeType==l.NodeType.ELEMENT_NODE&&(j=new u(b[0].childNodes[c]))&&j[0]&&j[0].nodeType==l.NodeType.TEXT_NODE&&
0<c&&j[0].previousSibling.nodeType==l.NodeType.TEXT_NODE)b=j,c=0;for(;b[0].nodeType==l.NodeType.TEXT_NODE&&(f=b.prev(void 0,1))&&f[0].nodeType==l.NodeType.TEXT_NODE;)b=f,c+=f[0].nodeValue.length;if(!this.collapsed){if(d[0].nodeType==l.NodeType.ELEMENT_NODE&&(j=new u(d[0].childNodes[e]))&&j[0]&&j[0].nodeType==l.NodeType.TEXT_NODE&&0<e&&j[0].previousSibling.nodeType==l.NodeType.TEXT_NODE)d=j,e=0;for(;d[0].nodeType==l.NodeType.TEXT_NODE&&(f=d.prev(void 0,1))&&f[0].nodeType==l.NodeType.TEXT_NODE;)d=f,
e+=f[0].nodeValue.length}}return{start:b._4e_address(a),end:this.collapsed?r:d._4e_address(a),startOffset:c,endOffset:e,normalized:a,is2:o}},createBookmark:function(a){var b,d,c,j,f=this.collapsed;b=new u("<span>",r,this.document);b.attr("_ke_bookmark",1);b.css("display","none");b.html("&nbsp;");a&&(c=e.guid("ke_bm_"),b.attr("id",c+"S"));f||(d=b.clone(),d.html("&nbsp;"),a&&d.attr("id",c+"E"),j=this.clone(),j.collapse(),j.insertNode(d));j=this.clone();j.collapse(o);j.insertNode(b);d?(this.setStartAfter(b),
this.setEndBefore(d)):this.moveToPosition(b,q.POSITION_AFTER_END);return{startNode:a?c+"S":b,endNode:a?c+"E":d,serializable:a,collapsed:f}},moveToPosition:function(a,b){this.setStartAt(a,b);this.collapse(o)},trim:function(a,b){var d=this.startContainer,c=this.startOffset,e=this.collapsed;if((!a||e)&&d[0]&&d[0].nodeType==l.NodeType.TEXT_NODE){if(c)if(c>=d[0].nodeValue.length)c=d._4e_index()+1,d=d.parent();else{var j=d._4e_splitText(c),c=d._4e_index()+1,d=d.parent();l.equals(this.startContainer,this.endContainer)?
this.setEnd(j,this.endOffset-this.startOffset):l.equals(d,this.endContainer)&&(this.endOffset+=1)}else c=d._4e_index(),d=d.parent();this.setStart(d,c);if(e){this.collapse(o);return}}d=this.endContainer;c=this.endOffset;!b&&!e&&d[0]&&d[0].nodeType==l.NodeType.TEXT_NODE&&(c?(c>=d[0].nodeValue.length||d._4e_splitText(c),c=d._4e_index()+1):c=d._4e_index(),d=d.parent(),this.setEnd(d,c))},insertNode:function(a){this.optimizeBookmark();this.trim(s,o);var b=this.startContainer;b[0].insertBefore(a[0],b[0].childNodes[this.startOffset]||
null);b[0]==this.endContainer[0]&&this.endOffset++;this.setStartBefore(a)},moveToBookmark:function(a){var b=p(this.document);if(a.is2){var d=b._4e_getByAddress(a.start,a.normalized),c=a.startOffset,b=a.end&&b._4e_getByAddress(a.end,a.normalized),a=a.endOffset;this.setStart(d,c);b?this.setEnd(b,a):this.collapse(o)}else d=(c=a.serializable)?e.one("#"+a.startNode,b):a.startNode,a=c?e.one("#"+a.endNode,b):a.endNode,this.setStartBefore(d),d._4e_remove(),a&&a[0]?(this.setEndBefore(a),a._4e_remove()):this.collapse(o)},
getCommonAncestor:function(a,b){var d=this.startContainer,c=this.endContainer,d=d[0]==c[0]?a&&d[0].nodeType==l.NodeType.ELEMENT_NODE&&this.startOffset==this.endOffset-1?new u(d[0].childNodes[this.startOffset]):d:d._4e_commonAncestor(c);return b&&d[0].nodeType==l.NodeType.TEXT_NODE?d.parent():d},enlarge:function(){function a(b,d,c,e){var j=b[d?"startContainer":"endContainer"],f,k=d?0:1,m=0,n=d?"previousSibling":"nextSibling";f=b[d?"startOffset":"endOffset"];if(j[0].nodeType==l.NodeType.TEXT_NODE){if(d){if(f)return}else if(f<
j[0].nodeValue.length)return;f=j[0][n];j=j[0].parentNode}else f=j[0].childNodes[f+(d?-1:1)]||null,j=j[0];for(;j;){for(;f;)if(w(f)||x(f))f=f[n];else break;if(f){if(!m)b[d?"setStartAfter":"setEndBefore"](p(f));break}j=p(j);if("body"==j.nodeName())break;if(m||j.equals(e))c[k]=j,m=1;else b[d?"setStartBefore":"setEndAfter"](j);f=j[0][n];j=j[0].parentNode}}return function(b){switch(b){case q.ENLARGE_ELEMENT:if(this.collapsed)break;var b=this.getCommonAncestor(),d=[];a(this,1,d,b);a(this,0,d,b);d[0]&&d[1]&&
(b=d[0].contains(d[1])?d[1]:d[0],this.setStartBefore(b),this.setEndAfter(b));break;case q.ENLARGE_BLOCK_CONTENTS:case q.ENLARGE_LIST_ITEM_CONTENTS:var c=new k(this.document),d=new u(this.document.body);c.setStartAt(d,q.POSITION_AFTER_START);c.setEnd(this.startContainer,this.startOffset);var c=new h(c),e,j,f=h.blockBoundary(b==q.ENLARGE_LIST_ITEM_CONTENTS?{br:1}:r),m=function(a){var b=f(a);b||(e=p(a));return b},n=function(a){var b=m(a);!b&&"br"==l.nodeName(a)&&(j=p(a));return b};c.guard=m;c=c.lastBackward();
e=e||d;this.setStartAt(e,"br"!=e.nodeName()&&(!c&&this.checkStartOfBlock()||c&&e.contains(c))?q.POSITION_AFTER_START:q.POSITION_AFTER_END);c=this.clone();c.collapse();c.setEndAt(d,q.POSITION_BEFORE_END);c=new h(c);c.guard=b==q.ENLARGE_LIST_ITEM_CONTENTS?n:m;e=r;c=c.lastForward();e=e||d;this.setEndAt(e,!c&&this.checkEndOfBlock()||c&&e.contains(c)?q.POSITION_BEFORE_END:q.POSITION_BEFORE_START);j&&this.setEndAfter(j)}}}(),checkStartOfBlock:function(){var a=this.startContainer,b=this.startOffset;if(b&&
a[0].nodeType==l.NodeType.TEXT_NODE&&e.trim(a[0].nodeValue.substring(0,b)).length)return s;this.trim();a=new f(this.startContainer);b=this.clone();b.collapse(o);b.setStartAt(a.block||a.blockLimit,q.POSITION_AFTER_START);a=new h(b);a.evaluator=d(o);return a.checkBackward()},checkEndOfBlock:function(){var a=this.endContainer,b=this.endOffset;if(a[0].nodeType==l.NodeType.TEXT_NODE&&e.trim(a[0].nodeValue.substring(b)).length)return s;this.trim();a=new f(this.endContainer);b=this.clone();b.collapse(s);
b.setEndAt(a.block||a.blockLimit,q.POSITION_BEFORE_END);a=new h(b);a.evaluator=d(s);return a.checkForward()},checkBoundaryOfElement:function(a,b){var d=this.clone();d[b==q.START?"setStartAt":"setEndAt"](a,b==q.START?q.POSITION_AFTER_START:q.POSITION_BEFORE_END);d=new h(d);d.evaluator=c;return d[b==q.START?"checkBackward":"checkForward"]()},getBoundaryNodes:function(){var a=this.startContainer,b=this.endContainer,d=this.startOffset,c=this.endOffset,e;if(a[0].nodeType==l.NodeType.ELEMENT_NODE)if(e=
a[0].childNodes.length,e>d)a=p(a[0].childNodes[d]);else if(0==e)a=a._4e_previousSourceNode();else{for(a=a[0];a.lastChild;)a=a.lastChild;a=p(a);a=a._4e_nextSourceNode()||a}if(b[0].nodeType==l.NodeType.ELEMENT_NODE)if(e=b[0].childNodes.length,e>c)b=p(b[0].childNodes[c])._4e_previousSourceNode(o);else if(0==e)b=b._4e_previousSourceNode();else{for(b=b[0];b.lastChild;)b=b.lastChild;b=p(b)}a._4e_position(b)&m.POSITION_FOLLOWING&&(a=b);return{startNode:a,endNode:b}},fixBlock:function(a,b){var d=this.createBookmark(),
c=p(this.document.createElement(b));this.collapse(a);this.enlarge(q.ENLARGE_BLOCK_CONTENTS);c[0].appendChild(this.extractContents());c._4e_trim();t.ie||c._4e_appendBogus();this.insertNode(c);this.moveToBookmark(d);return c},splitBlock:function(a){var b=new f(this.startContainer),d=new f(this.endContainer),c=b.block,j=d.block,l=r;if(!b.blockLimit.equals(d.blockLimit))return r;"br"!=a&&(c||(c=this.fixBlock(o,a),j=(new f(this.endContainer)).block),j||(j=this.fixBlock(s,a)));a=c&&this.checkStartOfBlock();
b=j&&this.checkEndOfBlock();this.deleteContents();c&&c[0]==j[0]&&(b?(l=new f(this.startContainer),this.moveToPosition(j,q.POSITION_AFTER_END),j=r):a?(l=new f(this.startContainer),this.moveToPosition(c,q.POSITION_BEFORE_START),c=r):(j=this.splitElement(c),!t.ie&&!e.inArray(c.nodeName(),["ul","ol"])&&c._4e_appendBogus()));return{previousBlock:c,nextBlock:j,wasStartOfBlock:a,wasEndOfBlock:b,elementPath:l}},splitElement:function(a){if(!this.collapsed)return r;this.setEndAt(a,q.POSITION_BEFORE_END);var b=
this.extractContents(),d=a.clone(s);d[0].appendChild(b);d.insertAfter(a);this.moveToPosition(a,q.POSITION_AFTER_END);return d},moveToElementEditablePosition:function(b,d){for(var c=0;b;){if(b[0].nodeType==l.NodeType.TEXT_NODE){this.moveToPosition(b,d?q.POSITION_AFTER_END:q.POSITION_BEFORE_START);c=1;break}b[0].nodeType==l.NodeType.ELEMENT_NODE&&b._4e_isEditable()&&(this.moveToPosition(b,d?q.POSITION_BEFORE_END:q.POSITION_AFTER_START),c=1);var e=b,j=c,f=void 0;e[0].nodeType==l.NodeType.ELEMENT_NODE&&
e._4e_isEditable()&&(f=e[d?"last":"first"](a,1));!j&&!f&&(f=e[d?"prev":"next"](a,1));b=f}return!!c},selectNodeContents:function(a){var b=a[0];this.setStart(a,0);this.setEnd(a,b.nodeType==l.NodeType.TEXT_NODE?b.nodeValue.length:b.childNodes.length)},insertNodeByDtd:function(a){var b,d,c,e=a.nodeName();b=j.$block[e];this.deleteContents();if(b){for(b=this.getCommonAncestor(s,o);(d=j[b.nodeName()])&&(!d||!d[e]);){var f=b.parent();this.checkStartOfBlock()&&this.checkEndOfBlock()?(this.setStartBefore(b),
this.collapse(o),b.remove()):c=b;b=f}c&&this.splitElement(c)}this.insertNode(a)}});i.injectDom({_4e_breakParent:function(a,b){var b=p(b),a=p(a),d,c=new g.Range(a[0].ownerDocument);c.setStartAfter(a);c.setEndAfter(b);d=c.extractContents();c.insertNode(a.remove());a.after(d)}});return g.Range=k},{requires:"./base,./utils,./walker,./elementPath,./dom,node".split(",")});
KISSY.add("editor/core/selection",function(e,g){function i(a){this.document=a;this._={cache:{}};if(o)try{var b=this.getNative().createRange();if(!b||b.item&&b.item(0).ownerDocument!=a||b.parentElement&&b.parentElement().ownerDocument!=a)this.isInvalid=f}catch(d){this.isInvalid=f}}function h(a){a=new i(a);return!a||a.isInvalid?c:a}g.SELECTION={SELECTION_NONE:1,SELECTION_TEXT:2,SELECTION_ELEMENT:3};var f=!0,c=null,a=e.UA,d=e.DOM,b=e.Node,n=g.SELECTION,k=g.RANGE,o=a.ie,s=g.Walker,r=g.Range,q={img:1,
hr:1,li:1,table:1,tr:1,td:1,th:1,embed:1,object:1,ol:1,ul:1,a:1,input:1,form:1,select:1,textarea:1,button:1,fieldset:1,thead:1,tfoot:1};e.augment(i,{getNative:!o?function(){var a=this._.cache;return a.nativeSel||(a.nativeSel=d.getWindow(this.document).getSelection())}:function(){var a=this._.cache;return a.nativeSel||(a.nativeSel=this.document.selection)},getType:!o?function(){var a=this._.cache;if(a.type)return a.type;var b=n.SELECTION_TEXT,c=this.getNative();if(c){if(1==c.rangeCount){var c=c.getRangeAt(0),
e=c.startContainer;e==c.endContainer&&e.nodeType==d.NodeType.ELEMENT_NODE&&1==Number(c.endOffset-c.startOffset)&&q[e.childNodes[c.startOffset].nodeName.toLowerCase()]&&(b=n.SELECTION_ELEMENT)}}else b=n.SELECTION_NONE;return a.type=b}:function(){var a=this._.cache;if(a.type)return a.type;var b=n.SELECTION_NONE;try{var d=this.getNative(),c=d.type;"Text"==c&&(b=n.SELECTION_TEXT);"Control"==c&&(b=n.SELECTION_ELEMENT);d.createRange().parentElement&&(b=n.SELECTION_TEXT)}catch(e){}return a.type=b},getRanges:o?
function(){var a=function(a,b){a=a.duplicate();a.collapse(b);for(var e=a.parentElement(),j=e.childNodes,f,l=0;l<j.length;l++){var k=j[l];if(k.nodeType==d.NodeType.ELEMENT_NODE){f=a.duplicate();f.moveToElementText(k);var k=f.compareEndPoints("StartToStart",a),m=f.compareEndPoints("EndToStart",a);f.collapse();if(0<k)break;else{if(!k||1==m&&-1==k)return{container:e,offset:l};if(!m)return{container:e,offset:l+1}}f=c}}f||(f=a.duplicate(),f.moveToElementText(e),f.collapse(!1));f.setEndPoint("StartToStart",
a);f=(""+f.text).replace(/\r\n|\r/g,"\n").length;try{for(;0<f;)f-=j[--l].nodeValue.length}catch(n){f=0}return 0===f?{container:e,offset:l}:{container:j[l],offset:-f}};return function(d){var c=this._.cache;if(c.ranges&&!d)return c.ranges;var e=this.getNative(),d=e&&e.createRange(),l=this.getType();if(!e)return[];if(l==n.SELECTION_TEXT)return e=new r(this.document),l=a(d,f),e.setStart(new b(l.container),l.offset),l=a(d),e.setEnd(new b(l.container),l.offset),c.ranges=[e];if(l==n.SELECTION_ELEMENT){c=
c.ranges=[];for(l=0;l<d.length;l++){for(var k=d.item(l),m=k.parentNode,g=0,e=new r(this.document);g<m.childNodes.length&&m.childNodes[g]!=k;g++);e.setStart(new b(m),g);e.setEnd(new b(m),g+1);c.push(e)}return c}return c.ranges=[]}}():function(a){var d=this._.cache;if(d.ranges&&!a)return d.ranges;var a=[],c=this.getNative();if(!c)return[];for(var e=0;e<c.rangeCount;e++){var f=c.getRangeAt(e),l=new r(this.document);l.setStart(new b(f.startContainer),f.startOffset);l.setEnd(new b(f.endContainer),f.endOffset);
a.push(l)}return d.ranges=a},getStartElement:function(){var a=this._.cache;if(void 0!==a.startElement)return a.startElement;var c,e=this.getNative();switch(this.getType()){case n.SELECTION_ELEMENT:return this.getSelectedElement();case n.SELECTION_TEXT:var l=this.getRanges()[0];if(l&&!l.collapsed){for(l.optimize();f;)if(c=l.startContainer,l.startOffset==(c[0].nodeType===d.NodeType.ELEMENT_NODE?c[0].childNodes.length:c[0].nodeValue.length)&&!c._4e_isBlockBoundary())l.setStartAfter(c);else break;c=l.startContainer;
if(c[0].nodeType!=d.NodeType.ELEMENT_NODE)return c.parent();c=new b(c[0].childNodes[l.startOffset]);if(!c[0]||c[0].nodeType!=d.NodeType.ELEMENT_NODE)return l.startContainer;for(l=c[0].firstChild;l&&l.nodeType==d.NodeType.ELEMENT_NODE;)c=new b(l),l=l.firstChild;return c}if(o)l=e.createRange(),l.collapse(f),c=new b(l.parentElement());else{if((c=e.anchorNode)&&c.nodeType!=d.NodeType.ELEMENT_NODE)c=c.parentNode;c&&(c=new b(c))}}return a.startElement=c},getSelectedElement:function(){var a,c=this._.cache;
if(void 0!==c.selectedElement)return c.selectedElement;o&&(a=this.getNative().createRange(),a=a.item&&a.item(0));var e;if(a)e=new b(a);else{a=this.getRanges()[0];for(var f,l=2;l&&(!(e=a.getEnclosedNode())||!(e[0].nodeType==d.NodeType.ELEMENT_NODE&&q[e.nodeName()]&&(f=e)));l--)a.shrink(k.SHRINK_ELEMENT);e=f}return c.selectedElement=e},reset:function(){this._.cache={}},selectElement:function(a){var b,d=this.document;if(o)try{b=d.body.createControlRange(),b.addElement(a[0]),b.select()}catch(c){b=d.body.createTextRange(),
b.moveToElementText(a[0]),b.select()}finally{}else b=d.createRange(),b.selectNode(a[0]),a=this.getNative(),a.removeAllRanges(),a.addRange(b);this.reset()},selectRanges:function(b){if(o){if(1<b.length){var c=b[b.length-1];b[0].setEnd(c.endContainer,c.endOffset);b.length=1}b[0]&&b[0].select()}else{c=this.getNative();if(!c)return;c.removeAllRanges();for(var e=0;e<b.length;e++){var f=b[e],l=this.document.createRange(),k=f.startContainer;if(f.collapsed&&(a.gecko&&1.09>a.gecko||a.opera||a.webkit)&&k[0].nodeType==
d.NodeType.ELEMENT_NODE&&!k[0].childNodes.length)k[0].appendChild(this.document.createTextNode(a.webkit?"\u200b":"")),f.startOffset++,f.endOffset++;l.setStart(k[0],f.startOffset);l.setEnd(f.endContainer[0],f.endOffset);c.addRange(l)}}this.reset()},createBookmarks2:function(a){for(var b=[],d=this.getRanges(),c=0;c<d.length;c++)b.push(d[c].createBookmark2(a));return b},createBookmarks:function(a,b){for(var c=[],l=this.document,k,b=b||this.getRanges(),m=b.length,n=0;n<m;n++){c.push(k=b[n].createBookmark(a,
f));var g=(a=k.serializable)?e.one("#"+k.startNode,l):k.startNode;k=a?e.one("#"+k.endNode,l):k.endNode;for(var h=n+1;h<m;h++){var i=b[h],o=i.startContainer,q=i.endContainer;d.equals(o,g.parent())&&i.startOffset++;d.equals(o,k.parent())&&i.startOffset++;d.equals(q,g.parent())&&i.endOffset++;d.equals(q,k.parent())&&i.endOffset++}}return c},selectBookmarks:function(a){for(var b=[],d=0;d<a.length;d++){var c=new r(this.document);c.moveToBookmark(a[d]);b.push(c)}this.selectRanges(b);return this},getCommonAncestor:function(){var a=
this.getRanges();return a[0].startContainer._4e_commonAncestor(a[a.length-1].endContainer)},scrollIntoView:function(){var a=this.getStartElement();a&&a.scrollIntoView(void 0,{alignWithTop:!1,allowHorizontalScroll:!0,onlyScrollIfNeeded:!0})},removeAllRanges:function(){var a=this.getNative();o?a&&a.clear():a&&a.removeAllRanges()}});var m={table:1,tbody:1,tr:1},l=s.whitespaces(f),t=/\ufeff|\u00a0/;r.prototype.select=r.prototype.select=!o?function(){var b=this.startContainer;this.collapsed&&b[0].nodeType==
d.NodeType.ELEMENT_NODE&&!b[0].childNodes.length&&(b[0].appendChild(this.document.createTextNode(a.webkit?"\u200b":"")),this.startOffset++,this.endOffset++);var c=this.document.createRange();c.setStart(b[0],this.startOffset);try{c.setEnd(this.endContainer[0],this.endOffset)}catch(e){if(0<=e.toString().indexOf("NS_ERROR_ILLEGAL_VALUE"))this.collapse(f),c.setEnd(this.endContainer[0],this.endOffset);else throw e;}b=h(this.document).getNative();b.removeAllRanges();b.addRange(c)}:function(a){var c=this.collapsed,
e,n;if(this.startContainer[0]===this.endContainer[0]&&1==this.endOffset-this.startOffset){var g=this.startContainer[0].childNodes[this.startOffset];if(g.nodeType==d.NodeType.ELEMENT_NODE){(new i(this.document)).selectElement(new b(g));return}}(this.startContainer[0].nodeType==d.NodeType.ELEMENT_NODE&&this.startContainer.nodeName()in m||this.endContainer[0].nodeType==d.NodeType.ELEMENT_NODE&&this.endContainer.nodeName()in m)&&this.shrink(k.SHRINK_ELEMENT,f);var h=this.createBookmark(),g=h.startNode,
o;c||(o=h.endNode);h=this.document.body.createTextRange();h.moveToElementText(g[0]);h.moveStart("character",1);if(o)a=this.document.body.createTextRange(),a.moveToElementText(o[0]),h.setEndPoint("EndToEnd",a),h.moveEnd("character",-1);else{for(e=g[0].nextSibling;e&&!l(e);)e=e.nextSibling;e=!(e&&e.nodeValue&&e.nodeValue.match(t))&&(a||!g[0].previousSibling||g[0].previousSibling&&"br"==d.nodeName(g[0].previousSibling));n=new b(this.document.createElement("span"));n.html("&#65279;");n.insertBefore(g);
e&&d.insertBefore(this.document.createTextNode("\ufeff"),g[0]||g)}this.setStartBefore(g);g._4e_remove();if(c){if(e?(h.moveStart("character",-1),h.select(),this.document.selection.clear()):h.select(),n)this.moveToPosition(n,k.POSITION_BEFORE_START),n._4e_remove()}else this.setEndBefore(o),o._4e_remove(),h.select()};i.getSelection=h;return g.Selection=i},{requires:["./base","./walker","./range","./dom","node"]});
KISSY.add("editor/core/selectionFix",function(e,g){function i(a){function c(a,d){var e=g.body.createTextRange();try{e.moveToPoint(a,d)}catch(f){e=b}return e}function d(){var a=g.selection.createRange();h&&!a.item&&0===a.compareEndPoints("StartToEnd",a)&&h.select();k.remove(g,"mouseup",d);k.remove(g,"mousemove",e);h=f=0}function e(a){if(a.button){if(a=c(a.pageX,a.pageY))0<a.compareEndPoints("StartToStart",h)?a.setEndPoint("StartToStart",h):a.setEndPoint("EndToEnd",h),a.select()}else d()}var f,n=a.get("window")[0],
g=a.get("document")[0],h;k.on(g,"mousedown contextmenu",function(a){var b=g.documentElement;if(a.target===b&&(f&&d(),!(b.scrollHeight>b.clientHeight)&&(f=1,h=c(a.pageX,a.pageY))))k.on(g,"mouseup",d),k.on(g,"mousemove",e),n.focus(),h.select()})}function h(c){function e(b){if(h){var d=c.getSelection(),j=d&&d.getType(),k=d&&f.selection;if(b&&k&&j==r.SELECTION_NONE&&!f.queryCommandEnabled("InsertImage"))setTimeout(function(){e(a)},50);else{var g;if(!k||!k.type||!("Control"!=k.type&&(g=k.createRange())&&
(g=g.parentElement())&&(g=g.nodeName)&&g.toLowerCase()in{input:1,textarea:1}))n=k&&d.getRanges()[0],c.checkSelectionChange()}}}var f=c.get("document")[0],k=new s(f.body),j=new s(f.documentElement);if(8>g.Utils.ieEngine)j.on("click",function(a){"html"===(new s(a.target)).nodeName()&&c.getSelection().getNative().createRange().select()});var n,h,i=a;j.on("mousedown",function(){i=d});j.on("mouseup",function(){i=a});k.on("focusin",function(a){if("body"==(new s(a.target)).nodeName()&&n){try{i&&n.select()}catch(d){}n=
b}});k.on("focus",function(){h=a;e()});k.on("beforedeactivate",function(b){b.relatedTarget||(h=d,i=a)});k.on("mousedown",function(){h=d});k.on("mouseup",function(){h=a;setTimeout(function(){e(a)},0)});k.on("keydown",function(){h=d});k.on("keyup",function(){h=a;setTimeout(function(){e()},0)})}function f(a){var b=a.get("document")[0];k.on(b,"mouseup keyup selectionchange",function(){a.checkSelectionChange()})}function c(b){function c(a){var b=g.XHTML_DTD;return a._4e_isBlockBoundary()&&b.$empty[a.nodeName()]}
function e(a){return k(a)&&h(a)}var f=/\s*<(p|div|address|h\d|center)[^>]*>\s*(?:<br[^>]*>|&nbsp;|\u00A0|&#160;|(<\!--[\s\S]*?--\>))?\s*(:?<\/\1>)?(?=\s*$|<\/body>)/gi,k=g.Walker.whitespaces(a),h=g.Walker.bookmark(d,a),i=function(a){return k(a)&&8!=a.nodeType};b.on("selectionChange",function(k){var j=k.path,h=new s(b.get("document")[0].body),k=(k=k.selection)&&k.getRanges()[0],u=j.blockLimit;if(n.gecko){var r=j.block||j.blockLimit,A=r&&r.last(e);r&&r._4e_isBlockBoundary()&&(!A||!(1==A[0].nodeType&&
A._4e_isBlockBoundary()))&&"pre"!=r.nodeName()&&!r._4e_getBogus()&&r._4e_appendBogus()}if(k&&k.collapsed&&!j.block){if("body"==u.nodeName()){if((j=k.fixBlock(a,"p"))&&j[0]!=h[0].lastChild&&j.outerHtml().match(f))if((u=j.next(i,1))&&u[0].nodeType==o.NodeType.ELEMENT_NODE&&!c[u])k.moveToElementEditablePosition(u),j._4e_remove();else if((u=j.prev(i,1))&&u[0].nodeType==o.NodeType.ELEMENT_NODE&&!c[u])k.moveToElementEditablePosition(u,u.outerHtml().match(f)?d:a),j._4e_remove();k.select();b.notifySelectionChange()}j=
b.get("document")[0];k=new g.Range(j);k.moveToElementEditablePosition(h,a);"body"!==(new g.ElementPath(k.startContainer)).blockLimit.nodeName()&&(h=(new s(j.createElement("p"))).appendTo(h),n.ie||h._4e_appendBogus())}})}var a=!0,d=!1,b=null,n=e.UA,k=e.Event,o=e.DOM,s=e.Node,r=g.SELECTION;return{init:function(a){a.docReady(function(){n.ie?(i(a),h(a)):f(a)});c(a)}}},{requires:["./base","./selection","node"]});
KISSY.add("editor/core/styles",function(e,g){function i(a){return!z.attr(a,"_ke_bookmark")}function h(a,b){for(var d in a)"string"==typeof a[d]?a[d]=a[d].replace(M,function(a,d){return b[d]}):h(a[d],b)}function f(a,b){b&&(a=e.clone(a),h(a,b));var d=this.element=this.element=(a.element||"*").toLowerCase();this.type=this.type="#text"==d||L[d]?A.STYLE_BLOCK:J[d]?A.STYLE_OBJECT:A.STYLE_INLINE;this._={definition:a}}function c(a,b){var d=b?this.removeFromRange:this.applyToRange;a.body.focus();for(var c=
new C(a),e=c.getRanges(),f=0;f<e.length;f++)d.call(this,e[f]);c.selectRanges(e)}function a(a,b,d){var c=a.element;"*"==c&&(c="span");b=new E(b.createElement(c));d&&d._4e_copyAttributes(b);d=a._.definition;a=d.attributes;d=f.getStyleText(d);if(a)for(var e in a)b.attr(e,a[e]);d&&(b[0].style.cssText=d);return b}function d(d){var c=d.createBookmark(y),e=d.createIterator();e.enforceRealBlocks=y;e.enlargeBr=y;for(var f,l=d.document;f=e.getNextParagraph();){var j=a(this,l,f),m=j,j="pre"==m.nodeName,g="pre"==
f.nodeName,h=!j&&g;j&&!g?(g=f,h=g.html(),h=b(h,/(?:^[ \t\n\r]+)|(?:[ \t\n\r]+$)/g,""),h=h.replace(/[ \t\r\n]*(<br[^>]*>)[ \t\r\n]*/gi,"$1"),h=h.replace(/([ \t\n\r]+|&nbsp;)/g," "),h=h.replace(/<br\b[^>]*>/gi,"\n"),H.ie?(g=g[0].ownerDocument.createElement("div"),g.appendChild(m[0]),m.outerHtml("<pre>"+h+"</pre>"),m=new E(g.firstChild),m._4e_remove()):m.html(h)):h?m=k(n(f),m):f._4e_moveChildren(m);f[0].parentNode.replaceChild(m[0],f[0]);if(j&&(f=m,j=void 0,(j=f._4e_previousSourceNode(y,z.NodeType.ELEMENT_NODE))&&
"pre"==j.nodeName()))m=b(j.html(),/\n$/,"")+"\n\n"+b(f.html(),/^\n/,""),H.ie?f.outerHtml("<pre>"+m+"</pre>"):f.html(m),j._4e_remove()}d.moveToBookmark(c)}function b(a,b,d){var c="",e="",a=a.replace(/(^<span[^>]+_ke_bookmark.*?\/span>)|(<span[^>]+_ke_bookmark.*?\/span>$)/gi,function(a,b,d){b&&(c=b);d&&(e=d);return""});return c+a.replace(b,d)+e}function n(a){var d=[];b(a.outerHtml(),/(\S\s*)\n(?:\s|(<span[^>]+_ck_bookmark.*?\/span>))*\n(?!$)/gi,function(a,b,d){return b+"</pre>"+d+"<pre>"}).replace(/<pre\b.*?>([\s\S]*?)<\/pre>/gi,
function(a,b){d.push(b)});return d}function k(a,d){for(var c=d[0].ownerDocument.createDocumentFragment(),e=0;e<a.length;e++){var f=a[e],f=f.replace(/(\r\n|\r)/g,"\n"),f=b(f,/^[ \t]*\n/,""),f=b(f,/\n$/,""),f=b(f,/^[ \t]+|[ \t]+$/g,function(a,b){return 1==a.length?"&nbsp;":b?" "+Array(a.length).join("&nbsp;"):Array(a.length).join("&nbsp;")+" "}),f=f.replace(/\n/g,"<br>"),f=f.replace(/[ \t]{2,}/g,function(a){return Array(a.length).join("&nbsp;")+" "}),j=d.clone();j.html(f);c.appendChild(j[0])}return c}
function o(b){var d=b.document;if(b.collapsed)d=a(this,d,void 0),b.insertNode(d),b.moveToPosition(d,D.POSITION_BEFORE_END);else{var c=this.element,e=this._.definition,f,k=G[c];k||(f=y,k=G.span);var l=b.createBookmark();b.enlarge(D.ENLARGE_ELEMENT);b.trim();for(var m=b.createBookmark(),n=m.startNode,m=m.endNode,g=n,h;g&&g[0];){var p=v;if(z.equals(g,m))g=w,p=y;else{var o=g[0].nodeType,q=o==z.NodeType.ELEMENT_NODE?g.nodeName():w;if(q&&g.attr("_ke_bookmark")){g=g._4e_nextSourceNode(y);continue}if(!q||
k[q]&&(g._4e_position(m)|B.POSITION_PRECEDING|B.POSITION_IDENTICAL|B.POSITION_IS_CONTAINED)==B.POSITION_PRECEDING+B.POSITION_IDENTICAL+B.POSITION_IS_CONTAINED&&(!e.childRule||e.childRule(g))){var t=g.parent();if(t&&"a"==c&&t.nodeName()==c)o=a(this,d,void 0),t._4e_moveChildren(o),t[0].parentNode.replaceChild(o[0],t[0]),o._4e_mergeSiblings();else if(t&&t[0]&&((G[t.nodeName()]||G.span)[c]||f)&&(!e.parentRule||e.parentRule(t))){if(!h&&(!q||!G.$removeEmpty[q]||(g._4e_position(m)|B.POSITION_PRECEDING|B.POSITION_IDENTICAL|
B.POSITION_IS_CONTAINED)==B.POSITION_PRECEDING+B.POSITION_IDENTICAL+B.POSITION_IS_CONTAINED))h=new F(d),h.setStartBefore(g);if(o==z.NodeType.TEXT_NODE||o==z.NodeType.ELEMENT_NODE&&!g[0].childNodes.length){t=g;for(o=null;(p=!t.next(i,1))&&(o=t.parent())&&k[o.nodeName()]&&(o._4e_position(n)|B.POSITION_FOLLOWING|B.POSITION_IDENTICAL|B.POSITION_IS_CONTAINED)==B.POSITION_FOLLOWING+B.POSITION_IDENTICAL+B.POSITION_IS_CONTAINED&&(!e.childRule||e.childRule(o));)t=o;h.setEndAfter(t)}}else p=y}else p=y;g=g._4e_nextSourceNode()}if(p&&
h&&!h.collapsed){for(var p=a(this,d,void 0),t=h.getCommonAncestor(),o={},q={},s,u=null,r;p&&t&&p[0]&&t[0];){if(t.nodeName()==c){for(s in e.attributes)if(!q[s]&&(r=t.attr(u)))p.attr(s)==r?p.removeAttr(s):q[s]=1;for(u in e.styles)if(!o[u]&&(r=t.style(u)))p.style(u)==r?p.style(u,""):o[u]=1;if(!p._4e_hasAttributes()){p=w;break}}t=t.parent()}p?(p[0].appendChild(h.extractContents()),j(this,p),h.insertNode(p),p._4e_mergeSiblings(),H.ie||p[0].normalize()):(p=new E(d.createElement("span")),p[0].appendChild(h.extractContents()),
h.insertNode(p),j(this,p),p._4e_remove(!0));h=w}}n._4e_remove();m._4e_remove();b.moveToBookmark(l);b.shrink(D.SHRINK_TEXT)}}function s(a){a.enlarge(D.ENLARGE_ELEMENT);var b=a.createBookmark(),d=b.startNode;if(a.collapsed){for(var c=new I(d.parent()),e,f=0,j;f<c.elements.length&&(j=c.elements[f])&&!(j==c.block||j==c.blockLimit);f++)if(this.checkElementRemovable(j)){var k=a.checkBoundaryOfElement(j,D.END),g=!k&&a.checkBoundaryOfElement(j,D.START);g||k?(e=j,e.match=g?"start":"end"):(j._4e_mergeSiblings(),
j.nodeName()!=this.element?(k=m(this),u(j,k[j.nodeName()]||k["*"])):l(this,j))}if(e){j=d;for(f=0;;f++){k=c.elements[f];if(k.equals(e))break;else if(k.match)continue;else k=k.clone();k[0].appendChild(j[0]);j=k}j["start"==e.match?"insertBefore":"insertAfter"](e);c=e.html();!c||"\u200b"==c?e.remove():H.webkit&&x(a.document.createTextNode("\u200b")).insertBefore(j)}}else{var h=b.endNode,n=this;e=function(){for(var a=new I(d.parent()),b=new I(h.parent()),c=w,e=w,f=0;f<a.elements.length;f++){var j=a.elements[f];
if(j==a.block||j==a.blockLimit)break;n.checkElementRemovable(j)&&(c=j)}for(f=0;f<b.elements.length;f++){j=b.elements[f];if(j==b.block||j==b.blockLimit)break;n.checkElementRemovable(j)&&(e=j)}e&&h._4e_breakParent(e);c&&d._4e_breakParent(c)};e();for(c=new E(d[0].nextSibling);c[0]!==h[0];){f=c._4e_nextSourceNode();if(c[0]&&c[0].nodeType==z.NodeType.ELEMENT_NODE&&this.checkElementRemovable(c)&&(c.nodeName()==this.element?l(this,c):(j=m(this),u(c,j[c.nodeName()]||j["*"])),f[0].nodeType==z.NodeType.ELEMENT_NODE&&
f.contains(d)))e(),f=new E(d[0].nextSibling);c=f}}a.moveToBookmark(b)}function r(a){var b={};(""+a).replace(/&quot;/g,'"').replace(/\s*([^ :;]+)\s*:\s*([^;]+)\s*(?=;|$)/g,function(a,d,c){b[d]=c});return b}function q(a,b){var d="";b!==v?(d=document.createElement("span"),d.style.cssText=a,d=d.style.cssText||""):d=a;return d.replace(/\s*([;:])\s*/,"$1").replace(/([^\s;])$/,"$1;").replace(/,\s+/g,",").toLowerCase()}function m(a){if(a._.overrides)return a._.overrides;var b=a._.overrides={},d=a._.definition.overrides;
if(d){e.isArray(d)||(d=[d]);for(var c=0;c<d.length;c++){var f=d[c],j,k,l;"string"==typeof f?j=f.toLowerCase():(j=f.element?f.element.toLowerCase():a.element,k=f.attributes,l=f.styles);f=b[j]||(b[j]={});if(k){j=f.attributes=f.attributes||[];for(var g in k)j.push([g.toLowerCase(),k[g]])}if(l){var f=f.styles=f.styles||[],h;for(h in l)f.push([h.toLowerCase(),l[h]])}}}return b}function l(a,b){var d=a._.definition,c=m(a),f=e.merge(d.attributes,(c[b.nodeName()]||c["*"]||{}).attributes),d=e.merge(d.styles,
(c[b.nodeName()]||c["*"]||{}).styles),c=e.isEmptyObject(f)&&e.isEmptyObject(d),j;for(j in f)("class"==j||a._.definition.fullMatch)&&b.attr(j)!=t(j,f[j])||(c=c||!!b.hasAttr(j),b.removeAttr(j));for(var k in d)a._.definition.fullMatch&&b.style(k)!=t(k,d[k],y)||(c=c||!!b.style(k),b.style(k,""));p(b)}function t(a,b,d){var c=new E("<span>");c[d?"style":"attr"](a,b);return c[d?"style":"attr"](a)}function j(a,b){for(var d=m(a),c=b.all(a.element),e=c.length;0<=--e;)l(a,new E(c[e]));for(var f in d)if(f!=a.element){c=
b.all(f);for(e=c.length-1;0<=e;e--){var j=new E(c[e]);u(j,d[f])}}}function u(a,b){var d,c=b&&b.attributes;if(c)for(d=0;d<c.length;d++){var e=c[d][0],f;if(f=a.attr(e)){var j=c[d][1];(j===w||j.test&&j.test(f)||"string"==typeof j&&f==j)&&a[0].removeAttribute(e)}}if(c=b&&b.styles)for(d=0;d<c.length;d++)if(e=c[d][0],j=a.css(e)){var k=c[d][1];(k===w||k.test&&k.test(f)||"string"==typeof k&&j==k)&&a.css(e,"")}p(a)}function p(a){if(!a._4e_hasAttributes()){var b=a[0].firstChild,d=a[0].lastChild;a._4e_remove(y);
b&&(b.nodeType==z.NodeType.ELEMENT_NODE&&z._4e_mergeSiblings(b),d&&b!=d&&d.nodeType==z.NodeType.ELEMENT_NODE&&z._4e_mergeSiblings(d))}}var y=!0,v=!1,w=null,x=e.all,z=e.DOM,A={STYLE_BLOCK:1,STYLE_INLINE:2,STYLE_OBJECT:3},D=g.RANGE,C=g.Selection,B=g.POSITION,F=g.Range,E=e.Node,H=e.UA,I=g.ElementPath,L={address:1,div:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,p:1,pre:1},G=g.XHTML_DTD,J={embed:1,hr:1,img:1,li:1,object:1,ol:1,table:1,td:1,tr:1,th:1,ul:1,dl:1,dt:1,dd:1,form:1},K=/\s*(?:;\s*|$)/g,M=/#\((.+?)\)/g;g.STYLE=
A;f.prototype={constructor:f,apply:function(a){c.call(this,a,v)},remove:function(a){c.call(this,a,y)},applyToRange:function(a){return(this.applyToRange=this.type==A.STYLE_INLINE?o:this.type==A.STYLE_BLOCK?d:w).call(this,a)},removeFromRange:function(a){return(this.removeFromRange=this.type==A.STYLE_INLINE?s:w).call(this,a)},checkElementRemovable:function(a,b){if(!a)return v;var d=this._.definition,c;if(a.nodeName()==this.element){if(!b&&!a._4e_hasAttributes())return y;var e=d._AC;if(e)d=e;else{var e=
{},j=0,k=d.attributes;if(k)for(var l in k)j++,e[l]=k[l];if(k=f.getStyleText(d))e.style||j++,e.style=k;e._length=j;d=d._AC=e}if(d._length){for(var g in d)if("_length"!=g){j=a.attr(g)||"";if("style"==g)a:{e=d[g];j=q(j,v);"string"==typeof e&&(e=r(e));"string"==typeof j&&(j=r(j));k=void 0;for(k in e)if(!(k in j&&(j[k]==e[k]||"inherit"==e[k]||"inherit"==j[k]))){e=v;break a}e=y}else e=d[g]==j;if(e){if(!b)return y}else if(b)return v}if(b)return y}else return y}g=m(this);if(g=g[a.nodeName()]||g["*"]){if(!(d=
g.attributes)&&!(c=g.styles))return y;if(d)for(e=0;e<d.length;e++)if(g=d[e][0],g=a.attr(g))if(j=d[e][1],j===w||"string"==typeof j&&g==j||j.test&&j.test(g))return y;if(c)for(e=0;e<c.length;e++)if(g=a.css(c[e][0]))if(d=c[e][1],d===w||"string"==typeof d&&g==d||d.test&&d.test(g))return y}return v},checkActive:function(a){switch(this.type){case A.STYLE_BLOCK:return this.checkElementRemovable(a.block||a.blockLimit,y);case A.STYLE_OBJECT:case A.STYLE_INLINE:for(var b=a.elements,d=0,c;d<b.length;d++)if(c=
b[d],!(this.type==A.STYLE_INLINE&&(z.equals(c,a.block)||z.equals(c,a.blockLimit))))if((this.type!=A.STYLE_OBJECT||c.nodeName()in J)&&this.checkElementRemovable(c,y))return y}return v}};f.getStyleText=function(a){var b=a._ST;if(b)return b;var b=a.styles,d=a.attributes&&a.attributes.style||"",c="";d.length&&(d=d.replace(K,";"));for(var e in b){var f=b[e],j=(e+":"+f).replace(K,";");"inherit"==f?c+=j:d+=j}d.length&&(d=q(d));return a._ST=d+c};return g.Style=f},{requires:"./base,./range,./selection,./domIterator,./elementPath,node".split(",")});
KISSY.add("editor/core/utils",function(e,g){var i=e.Node,h=e.DOM,f=e.UA,c={debugUrl:function(a){var d=e.Config;d.debug||(a=a.replace(/\.(js|css)/i,"-min.$1"));-1==a.indexOf("?t")&&(a=-1!=a.indexOf("?")?a+"&":a+"?",a+="t="+encodeURIComponent(d.tag));return d.base+"editor/"+a},lazyRun:function(a,d,b){var c=a[d],e=a[b];a[d]=function(){c.apply(this,arguments);a[d]=a[b];return e.apply(this,arguments)}},getXY:function(a,d){var b=a.left,c=a.top,e=d.get("window")[0],b=b-h.scrollLeft(e),c=c-h.scrollTop(e),
e=d.get("iframe").offset(),b=b+e.left,c=c+e.top;return{left:b,top:c}},tryThese:function(a){for(var d,b=0,c=arguments.length;b<c;b++){var e=arguments[b];try{d=e();break}catch(f){}}return d},arrayCompare:function(a,d){if(!a&&!d)return!0;if(!a||!d||a.length!=d.length)return!1;for(var b=0;b<a.length;b++)if(a[b]!==d[b])return!1;return!0},clearAllMarkers:function(a){for(var d in a)a[d]._4e_clearMarkers(a,!0,void 0)},ltrim:function(a){return a.replace(/^\s+/,"")},rtrim:function(a){return a.replace(/\s+$/,
"")},isNumber:function(a){return/^\d+(.\d+)?$/.test(e.trim(a))},verifyInputs:function(a){for(var d=0;d<a.length;d++){var b=new i(a[d]),f=e.trim(c.valInput(b)),k=b.attr("data-verify"),b=b.attr("data-warning");if(k&&!RegExp(k).test(f))return alert(b),!1}return!0},sourceDisable:function(a,d){a.on("sourceMode",d.disable,d);a.on("wysiwygMode",d.enable,d)},resetInput:function(a){var d=a.attr("placeholder");d&&f.ie?(a.addClass("ks-editor-input-tip"),a.val(d)):f.ie||a.val("")},valInput:function(a,d){if(void 0===
d)return a.hasClass("ks-editor-input-tip")?"":a.val();a.removeClass("ks-editor-input-tip");a.val(d)},placeholder:function(a,d){a.attr("placeholder",d);f.ie&&(a.on("blur",function(){e.trim(a.val())||(a.addClass("ks-editor-input-tip"),a.val(d))}),a.on("focus",function(){a.removeClass("ks-editor-input-tip");e.trim(a.val())==d&&a.val("")}))},htmlEncode:function(a){return!a?a:(""+a).replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/"/g,"&quot;")},normParams:function(a){var a=e.clone(a),
d;for(d in a){var b=a[d];"function"===typeof b&&(a[d]=b())}return a},map:function(a,d){for(var b=0;b<a.length;b++)a[b]=d(a[b]);return a},ieEngine:document.documentMode||f.ie,preventFocus:function(a){f.ie?a.unselectable():a.attr("onmousedown","return false;")},injectDom:function(a){e.mix(h,a);for(var d in a)(function(b){i.prototype[b]=function(){var d=[].slice.call(arguments,0);d.unshift(this[0]);return(d=a[b].apply(null,d))&&(d.nodeType||e.isWindow(d))?new i(d):e.isArray(d)&&(d.__IS_NODELIST||d[0]&&
d[0].nodeType)?new i(d):d}})(d)},addRes:function(){var a=this.__res=this.__res||[];a.push.apply(a,e.makeArray(arguments))},destroyRes:function(){for(var a=this.__res||[],d=0;d<a.length;d++){var b=a[d];"function"===typeof b?b():b.destroy?b.destroy():b.remove&&b.remove()}this.__res=[]},getQueryCmd:function(a){return"query"+("-"+a).replace(/-(\w)/g,function(a,b){return b.toUpperCase()})+"Value"}};return g.Utils=c},{requires:["./base","node"]});
KISSY.add("editor/core/walker",function(e,g){function i(b,e){if(this._.end)return d;var f,k=this.range,g,h=this.guard,m=this.type,i=b?"_4e_previousSourceNode":"_4e_nextSourceNode";if(!this._.start&&(this._.start=1,k.trim(),k.collapsed))return this.end(),d;if(!b&&!this._.guardLTR){var q=k.endContainer[0],s=q.childNodes[k.endOffset];this._.guardLTR=function(a,b){return b&&(q==a||"body"==n.nodeName(a))?!1:a!=s}}if(b&&!this._.guardRTL){var r=k.startContainer[0],D=0<k.startOffset&&r.childNodes[k.startOffset-
1]||null;this._.guardRTL=function(a,b){return b&&(r==a||"body"==n.nodeName(a))?!1:a!=D}}var C=b?this._.guardRTL:this._.guardLTR;g=h?function(b,d){return C(b,d)===a?a:h(b,d)}:C;this.current?f=this.current[i](a,m,g):b?(f=k.endContainer,0<k.endOffset?(f=new o(f[0].childNodes[k.endOffset-1]),g(f[0])===a&&(f=d)):f=g(f,c)===a?d:f._4e_previousSourceNode(c,m,g,void 0)):(f=k.startContainer,f=new o(f[0].childNodes[k.startOffset]),f.length?g(f[0])===a&&(f=d):f=g(k.startContainer,c)===a?d:k.startContainer._4e_nextSourceNode(c,
m,g,void 0));for(;f&&!this._.end;){this.current=f;if(!this.evaluator||this.evaluator(f[0])!==a){if(!e)return f}else if(e&&this.evaluator)return a;f=f[i](a,m,g)}this.end();return this.current=d}function h(a){for(var b,c=d;b=i.call(this,a);)c=b;return c}function f(a){this.range=a;this.guard=this.evaluator=d;this._={}}var c=!0,a=!1,d=null,b=e.UA,n=e.DOM,k=g.XHTML_DTD,o=e.Node;e.augment(f,{end:function(){this._.end=1},next:function(){return i.call(this)},previous:function(){return i.call(this,c)},checkForward:function(){return i.call(this,
a,c)!==a},checkBackward:function(){return i.call(this,c,c)!==a},lastForward:function(){return h.call(this)},lastBackward:function(){return h.call(this,c)},reset:function(){delete this.current;this._={}},_iterator:i});e.mix(f,{blockBoundary:function(a){return function(b){return!(b.nodeType==n.NodeType.ELEMENT_NODE&&n._4e_isBlockBoundary(b,a))}},bookmark:function(a,b){function d(a){return"span"==n.nodeName(a)&&n.attr(a,"_ke_bookmark")}return function(c){var e,f;e=c.nodeType==n.NodeType.TEXT_NODE&&(f=
c.parentNode)&&d(f);e=a?e:e||d(c);return!!(b^e)}},whitespaces:function(a){return function(b){b=b.nodeType==n.NodeType.TEXT_NODE&&!e.trim(b.nodeValue);return!!(a^b)}},invisible:function(a){var b=f.whitespaces();return function(d){d=b(d)||d.nodeType==n.NodeType.ELEMENT_NODE&&!d.offsetHeight;return!!(a^d)}}});var s=/^[\t\r\n ]*(?:&nbsp;|\xa0)$/,r=f.whitespaces(),q=f.bookmark(),m=function(a){var b=n.nodeName(a);return q(a)||r(a)||1==a.nodeType&&b in k.$inline&&!(b in k.$empty)};g.Utils.injectDom({_4e_getBogus:function(a){a=
new o(a);do a=a._4e_previousSourceNode();while(a&&m(a[0]));return a&&(!b.ie?"br"==a.nodeName():3==a[0].nodeType&&s.test(a.text()))?a[0]:!1}});return g.Walker=f},{requires:["./base","./utils","./dom","node"]});KISSY.add("editor/core/zIndexManager",function(e,g){var i=g.zIndexManager={BUBBLE_VIEW:1100,POPUP_MENU:1200,STORE_FLASH_SHOW:99999,MAXIMIZE:900,OVERLAY:9999,LOADING:11E3,LOADING_CANCEL:12E3,SELECT:1200};g.baseZIndex=function(e){return(g.Config.baseZIndex||1E4)+e};return i},{requires:["./base"]});
KISSY.add("editor/plugin/back-color/cmd",function(e,g){var i={element:"span",styles:{"background-color":"#(color)"},overrides:[{element:"*",styles:{"background-color":null}}],childRule:function(){return!1}};return{init:function(e){e.hasCommand("backColor")||e.addCommand("backColor",{exec:function(e,c){e.execCommand("save");g.applyColor(e,c,i);e.execCommand("save")}})}}},{requires:["../color/cmd"]});
KISSY.add("editor/plugin/back-color/index",function(e,g,i,h){function f(c){this.config=c||{}}e.augment(f,{pluginRenderUI:function(c){h.init(c);i.init(c,{defaultColor:"rgb(255, 217, 102)",cmdType:"backColor",tooltip:"\u80cc\u666f\u989c\u8272"})}});return f},{requires:["editor","../color/btn","./cmd"]});
KISSY.add("editor/plugin/bold/cmd",function(e,g,i){var h=new g.Style({element:"strong",overrides:[{element:"b"},{element:"span",attributes:{style:"font-weight: bold;"}}]});return{init:function(e){i.addButtonCmd(e,"bold",h)}}},{requires:["editor","../font/cmd"]});
KISSY.add("editor/plugin/bold/index",function(e,g,i,h){function f(){}e.augment(f,{pluginRenderUI:function(c){h.init(c);c.addButton("bold",{cmdType:"bold",tooltip:"\u7c97\u4f53 "},i.Button);c.docReady(function(){c.get("document").on("keydown",function(a){a.ctrlKey&&a.keyCode==e.Node.KeyCodes.B&&(c.execCommand("bold"),a.preventDefault())})})}});return f},{requires:["editor","../font/ui","./cmd"]});
KISSY.add("editor/plugin/bubble/index",function(e,g,i){function h(a){var d=null,b=a.get("editor").getControls();e.each(b,function(b){var c;if(c=b.get)if(c=-1!=(b.get("elCls")||"").indexOf("bubble"))if(c=b!==a)if(c=b.get("visible")){c=a.get("y");var e=c+a.get("el").outerHeight(),f=b.get("y"),g=f+b.get("el").outerHeight();c=c<=g&&e>=g||c<=f&&e>=f}c&&(d?d.get("y")<b.get("y")&&(d=b):d=b)});return d}var f={}.a,c={zIndex:i.baseZIndex(i.zIndexManager.BUBBLE_VIEW),elCls:"{prefixCls}editor-bubble",prefixCls:"{prefixCls}editor-",
effect:{effect:"fade",duration:0.3}};i.prototype.addBubble=function(a,d,b){function n(){m.hide();var a=r.get("window");a&&(a.detach("scroll",o),l.stop())}function k(){var a;var b=m;if(a=b.get("editorSelectedEl")){var d=b.get("editor"),c=d.get("window"),k=d.get("iframe").offset(),b=k.top,k=k.left,g=k+c.width(),c=b+c.height(),l=a.offset(),l=i.Utils.getXY(l,d),d=l.top,l=l.left,n=l+a.width(),o=d+a.height(),q,s;e.UA.ie&&"img"==a[0].nodeName.toLowerCase()&&o>c?a=f:(o>c&&d<c?s=c-30:o>b&&o<c&&(s=o),n>k&&
l<k?q=k:l>k&&l<g&&(q=l),a=q!==f&&s!==f?[q,s]:f)}else a=f;if(a){m.set("xy",a);if(q=h(m))a[1]=q.get("y")+q.get("el").outerHeight(),m.set("xy",a);m.get("visible")||m.show()}}function o(){m.get("editorSelectedEl")&&(m.get("el"),m.hide(),l())}function s(){r.get("window").on("scroll",o);k()}var r=this,q=r.get("prefixCls"),m,b=b||{};b.editor=r;e.mix(b,c);b.elCls=e.substitute(b.elCls,{prefixCls:q});b.prefixCls=e.substitute(b.prefixCls,{prefixCls:q});m=new g(b);r.addControl(a+"/bubble",m);r.on("selectionChange",
function(a){var a=a.path,b=a.elements;if(a&&b&&(a=a.lastElement))(a=d(a))?(m.set("editorSelectedEl",a),m.hide(),e.later(s,10)):n()});r.on("sourceMode",n);var l=e.buffer(k,350)}},{requires:["overlay","editor"]});
KISSY.add("editor/plugin/button/index",function(e,g,i){g.prototype.addButton=function(h,f,c){void 0===c&&(c=i);var a=this.get("prefixCls")+"editor-toolbar-";f.elCls&&(f.elCls=a+f.elCls);f.elCls=a+"button "+(f.elCls||"");var d=(new c(e.mix({render:this.get("toolBarEl"),content:'<span class="'+a+"item "+a+h+'"></span>',prefixCls:this.get("prefixCls")+"editor-",editor:this},f))).render();d.get("el").unselectable();if(!f.content){var b=d.get("el").one("span");d.on("afterContentClsChange",function(d){b[0].className=
a+"item "+a+d.newVal})}d.get("mode")==g.WYSIWYG_MODE&&(this.on("wysiwygMode",function(){d.set("disabled",false)}),this.on("sourceMode",function(){d.set("disabled",true)}));this.addControl(h+"/button",d);return d};return i},{requires:["editor","button"]});
KISSY.add("editor/plugin/checkbox-source-area/index",function(e,g){function i(a){this.editor=a;this._init()}function h(){}var f=e.Node,c=g.SOURCE_MODE,a=g.WYSIWYG_MODE;e.augment(i,{_init:function(){var a=this.editor,b=a.get("statusBarEl");this.holder=(new f("<span style='zoom:1;display:inline-block;height:22px;line-height:22px;'><input style='margin:0 5px;vertical-align:middle;' type='checkbox' /><span style='vertical-align:middle;'>\u7f16\u8f91\u6e90\u4ee3\u7801</span></span>")).appendTo(b);(this.el=this.holder.one("input")).on("click",
this._check,this);a.on("wysiwygMode",this._wysiwygmode,this);a.on("sourceMode",this._sourcemode,this)},_sourcemode:function(){this.el.attr("checked",!0)},_wysiwygmode:function(){this.el.attr("checked",!1)},_check:function(){var d=this.editor;this.el.attr("checked")?d.set("mode",c):d.set("mode",a)},destroy:function(){this.holder.remove()}});e.augment(h,{pluginRenderUI:function(a){var b=new i(a);a.on("destroy",function(){b.destroy()})}});return h},{requires:["editor"]});
KISSY.add("editor/plugin/code/index",function(e,g,i){function h(){}e.augment(h,{pluginRenderUI:function(e){e.addButton("code",{tooltip:"\u63d2\u5165\u4ee3\u7801",listeners:{click:function(){i.useDialog(e,"code")}},mode:g.WYSIWYG_MODE})}});return h},{requires:["editor","../dialog-loader/"]});
KISSY.add("editor/plugin/color/btn",function(e,g,i,h,f){function c(a,b,d){setTimeout(function(){a.execCommand(b,d)},0)}var a=e.Node,d=["000,444,666,999,CCC,EEE,F3F3F3,FFF".split(","),"F00,F90,FF0,0F0,0FF,00F,90F,F0F".split(","),"F4CCCC,FCE5CD,FFF2CC,D9EAD3,D0E0E3,CFE2F3,D9D2E9,EAD1DC,EA9999,F9CB9C,FFE599,B6D7A8,A2C4C9,9FC5E8,B4A7D6,D5A6BD,E06666,F6B26B,FFD966,93C47D,76A5AF,6FA8DC,8E7CC3,C27BAD,CC0000,E69138,F1C232,6AA84F,45818E,3D85C6,674EA7,A64D79,990000,B45F06,BF9000,38761D,134F5C,0B5394,351C75,741B47,660000,783F04,7F6000,274E13,0C343D,073763,20124D,4C1130".split(",")],b;
(function(){b="<div class='{prefixCls}editor-color-panel'><a class='{prefixCls}editor-color-remove' href=\"javascript:void('\u6e05\u9664');\">\u6e05\u9664</a>";for(var a=0;3>a;a++){b+="<div class='{prefixCls}editor-color-palette'><table>";for(var c=d[a],e=c.length/8,f=0;f<e;f++){b+="<tr>";for(var g=0;8>g;g++){var m="#"+c[8*f+g];b+="<td>";b+="<a href='javascript:void(0);' class='{prefixCls}editor-color-a' style='background-color:"+m+"'></a>";b+="</td>"}b+="</tr>"}b+="</table></div>"}b+="<div><a class='{prefixCls}editor-button {prefixCls}editor-color-others ks-inline-block'>\u5176\u4ed6\u989c\u8272</a></div></div>"})();
var n=i.extend({initializer:function(){var a=this;a.on("blur",function(){setTimeout(function(){a.colorWin&&a.colorWin.hide()},150)});a.on("click",function(){a.get("checked")?a._prepare():a.colorWin&&a.colorWin.hide()})},_prepare:function(){var a=this,d=a.get("editor"),c=d.get("prefixCls"),n;a.colorWin=(new h({elAttrs:{tabindex:0},elCls:c+"editor-popup",content:e.substitute(b,{prefixCls:c}),width:172,zIndex:g.baseZIndex(g.zIndexManager.POPUP_MENU)})).render();var i=a.colorWin;n=i.get("contentEl");
n.on("click",a._selectColor,a);i.on("hide",function(){a.set("checked",!1)});n.one("."+c+"editor-color-others").on("click",function(b){b.halt();i.hide();f.useDialog(d,"color/color-picker",void 0,a)});a._prepare=a._show;a._show()},_show:function(){var a=this.get("el"),b=this.colorWin;b.set("align",{node:a,points:["bl","tl"],offset:[0,2],overflow:{adjustX:1,adjustY:1}});b.show()},_selectColor:function(b){b.halt();var d=this.get("editor").get("prefixCls"),b=new a(b.target);b.hasClass(d+"editor-color-a")&&
this.fire("selectColor",{color:b.style("background-color")})},destructor:function(){this.colorWin&&this.colorWin.destroy()}},{ATTRS:{checkable:{value:!0},mode:{value:g.WYSIWYG_MODE}}});n.init=function(a,b){var d=a.get("prefixCls")+"editor-toolbar-",f=b.cmdType,h=b.tooltip,m=a.addButton(f,{elCls:f+"Btn",content:e.substitute('<div class="{icon}"></div><div style="background-color:{defaultColor}" class="{indicator}"></div>',{defaultColor:b.defaultColor,icon:d+"item "+d+f,indicator:d+"color-indicator"}),
mode:g.WYSIWYG_MODE,tooltip:"\u8bbe\u7f6e"+h}),h=a.addButton(f+"Arrow",{tooltip:"\u9009\u62e9\u5e76\u8bbe\u7f6e"+h,elCls:f+"ArrowBtn"},n),l=m.get("el").one("."+d+"color-indicator");h.on("selectColor",function(b){l.css("background-color",b.color);c(a,f,b.color)});m.on("click",function(){c(a,f,l.style("background-color"))})};return n},{requires:["editor","../button/","../overlay/","../dialog-loader/"]});
KISSY.add("editor/plugin/color/cmd",function(e,g){return{applyColor:function(e,h,f){var c=e.get("document")[0];e.execCommand("save");h?(new g.Style(f,{color:h})).apply(c):(new g.Style(f,{color:"inherit"})).remove(c);e.execCommand("save")}}},{requires:["editor"]});
KISSY.add("editor/plugin/contextmenu/index",function(e,g,i,h){g.prototype.addContextMenu=function(f,c,a){var d=this,a=a||{};a.prefixCls=d.get("prefixCls")+"editor-";a.editor=d;a.focusable=1;a.zIndex=g.baseZIndex(g.zIndexManager.POPUP_MENU);var b=new i.PopupMenu(a);h.init(b);b.on("afterRenderUI",function(){b.get("el").on("keydown",function(a){a.keyCode==e.Event.KeyCodes.ESC&&b.hide()})});d.docReady(function(){var a=d.get("document");a.on("mousedown",function(a){1==a.which&&b.hide()});a.delegate("contextmenu",
c,function(a){var c=e.all(a.target);a.halt();var f=a.pageX,h=a.pageY;f&&(a=g.Utils.getXY({left:f,top:h},d),f=a.left,h=a.top,setTimeout(function(){b.set("editorSelectedEl",c,{silent:1});b.set("xy",[f,h]);b.show();d.fire("contextmenu",{contextmenu:b});window.focus();document.body.focus();b.get("el")[0].focus()},30))})});d.addControl(f+"/contextmenu",b);return b}},{requires:["editor","menu","../focus-fix/"]});
KISSY.add("editor/plugin/dent-utils/cmd",function(e,g,i){function h(a){return a.nodeType==b.NodeType.ELEMENT_NODE&&"li"==b.nodeName(a)}function f(d,c,e){for(var f=d.startContainer,h=d.endContainer;f&&!f.parent().equals(c);)f=f.parent();for(;h&&!h.parent().equals(c);)h=h.parent();if(f&&h){for(var q=f,f=[],v=!1;!v;)q.equals(h)&&(v=!0),f.push(q),q=q.next();if(!(1>f.length)){var s=c._4e_parents(!0,void 0);s.each(function(a,b){s[b]=a});for(h=0;h<s.length;h++)if(a[s[h].nodeName()]){c=s[h];break}for(var q=
"indent"==e?1:-1,h=f[0],v=f[f.length-1],f={},r=i.listToArray(c,f),z=r[v.data("listarray_index")].indent,h=h.data("listarray_index");h<=v.data("listarray_index");h++){r[h].indent+=q;var A=r[h].parent;r[h].parent=new n(A[0].ownerDocument.createElement(A.nodeName()))}for(h=v.data("listarray_index")+1;h<r.length&&r[h].indent>z;h++)r[h].indent+=q;v=i.arrayToList(r,f,null,"p");q=[];if("outdent"==e){var D;if((D=c.parent())&&"li"==D.nodeName())for(var e=v.listNode.childNodes,C,h=e.length-1;0<=h;h--)(C=new n(e[h]))&&
"li"==C.nodeName()&&q.push(C)}v&&(b.insertBefore(v.listNode[0]||v.listNode,c[0]||c),c.remove());if(q&&q.length)for(h=0;h<q.length;h++){for(C=c=q[h];(C=C.next())&&C.nodeName()in a;)k.ie&&!c.first(function(a){return o(a)&&m(a)},1)&&c[0].appendChild(d.document.createTextNode("\u00a0")),c[0].appendChild(C[0]);b.insertAfter(c[0],D[0])}g.Utils.clearAllMarkers(f)}}}function c(a,b){var d=parseInt(a.style(s),10);isNaN(d)&&(d=0);d+=("indent"==b?1:-1)*r;if(0>d)return!1;d=Math.max(d,0);d=Math.ceil(d/r)*r;a.css(s,
d?d+q:"");""===a[0].style.cssText&&a.removeAttr("style");return!0}var a={ol:1,ul:1},d=g.Walker,b=e.DOM,n=e.Node,k=e.UA,o=d.whitespaces(!0),s="margin-left",r=40,q="px",m=d.bookmark(!1,!0);return{checkOutdentActive:function(b){var d=b.blockLimit;return b.contains(a)?!0:(b=b.block||d)&&b.style(s)},addCommand:function(e,k){e.hasCommand(k)||e.addCommand(k,{exec:function(e){e.execCommand("save");var g=e.getSelection(),l=g&&g.getRanges()[0];if(l){for(var m=l.startContainer,n=l.endContainer,i=l.getCommonAncestor();i&&
!(i[0].nodeType==b.NodeType.ELEMENT_NODE&&a[i.nodeName()]);)i=i.parent();i&&m[0].nodeType==b.NodeType.ELEMENT_NODE&&m.nodeName()in a&&(m=new d(l),m.evaluator=h,l.startContainer=m.next());i&&n[0].nodeType==b.NodeType.ELEMENT_NODE&&n.nodeName()in a&&(m=new d(l),m.evaluator=h,l.endContainer=m.previous());n=g.createBookmarks(!0);if(i){for(m=i.first();m&&"li"!=m.nodeName();)m=m.next();var o=l.startContainer;(!(m[0]==o[0]||m.contains(o))||!c(i,k))&&f(l,i,k)}else{l=l.createIterator();l.enforceRealBlocks=
!0;for(l.enlargeBr=!0;i=l.getNextParagraph();)c(i,k)}g.selectBookmarks(n)}e.execCommand("save");e.notifySelectionChange()}})}}},{requires:["editor","../list-utils/"]});
KISSY.add("editor/plugin/dialog-loader/index",function(e,g,i){var h,f={loading:function(c){h||(h=new g({x:0,width:6==e.UA.ie?e.DOM.docWidth():"100%",y:0,zIndex:i.baseZIndex(i.zIndexManager.LOADING),prefixCls:c+"editor-",elCls:c+"editor-global-loading"}));h.set("height",e.DOM.docHeight());h.show();h.loading()},unloading:function(){h.hide()}};return{useDialog:function(c,a,d,b){c.focus();var g=c.get("prefixCls");c.getControl(a+"/dialog")?setTimeout(function(){c.showDialog(a,b)},0):(f.loading(g),e.use("editor/plugin/"+
a+"/dialog",function(e,g){f.unloading();c.addControl(a+"/dialog",new g(c,d));c.showDialog(a,b)}))}}},{requires:["overlay","editor"]});
KISSY.add("editor/plugin/draft/index",function(e,g,i,h,f){function c(a,b,d){for(a+="";a.length<b;)a=d+a;return a}function a(a){e.isNumber(a)&&(a=new Date(a));return a instanceof Date?[a.getFullYear(),"-",c(a.getMonth()+1,2,"0"),"-",c(a.getDate(),2,"0")," ",c(a.getHours(),2,"0"),":",c(a.getMinutes(),2,"0"),":",c(a.getSeconds(),2,"0")].join(""):a}function d(a,b){this.editor=a;this.config=b;this._init()}function b(a,b){var c=new d(a,b);a.on("destroy",function(){c.destroy()})}function n(a){this.config=
a||{}}var k=e.Node,o=e.Event,s=e.JSON,r=g.Utils.addRes,q=g.Utils.destroyRes;e.augment(d,{_getSaveKey:function(){var a=this.config;return a.draft&&a.draft.saveKey||"ks-editor-draft-save20110503"},_getDrafts:function(){if(!this.drafts){var a=i.getItem(this._getSaveKey()),b=[];a&&(b=i==window.localStorage?s.parse(e.urlDecode(a)):a);this.drafts=b}return this.drafts},_init:function(){var a=this,b=a.editor,d=b.get("prefixCls"),c=b.get("statusBarEl"),h=this.config;h.draft=h.draft||{};a.draftInterval=h.draft.interval=
h.draft.interval||5;a.draftLimit=h.draft.limit=h.draft.limit||5;c=(new k("<div class='"+d+"editor-draft'><span class='"+d+"editor-draft-title'>\u5185\u5bb9\u6b63\u6587\u6bcf"+h.draft.interval+"\u5206\u949f\u81ea\u52a8\u4fdd\u5b58\u4e00\u6b21\u3002</span></div>")).appendTo(c);a.timeTip=(new k("<span class='"+d+"editor-draft-time'/>")).appendTo(c);var n=(new k(e.substitute("<a href='#' onclick='return false;' class='{prefixCls}editor-button {prefixCls}editor-draft-save-btn ks-inline-block' style='vertical-align:middle;padding:1px 9px;'><span class='{prefixCls}editor-draft-save'></span><span>\u7acb\u5373\u4fdd\u5b58</span></a>",
{prefixCls:d}))).unselectable(void 0).appendTo(c),i=(new f({render:c,collapseOnClick:!0,width:"100px",prefixCls:d+"editor-",menu:{width:"225px",align:{points:["tr","br"]}},matchElWidth:!1,content:"\u6062\u590d\u7f16\u8f91\u5386\u53f2"})).render();a.versions=i;i.on("beforeCollapsedChange",function(b){b.newValue||(i.detach("beforeCollapsedChange",arguments.callee),a.sync())});n.on("click",function(b){a.save(!1);b.halt()});r.call(a,n);b.get("textarea")[0].form&&function(){function d(){a.save(!0)}var c=b.get("textarea")[0].form;o.on(c,
"submit",d);r.call(a,function(){o.remove(c,"submit",d)})}();var q=setInterval(function(){a.save(!0)},6E4*a.draftInterval);r.call(a,function(){clearInterval(q)});i.on("click",a.recover,a);r.call(a,i);a.holder=c;if(h.draft.helpHtml){var s=(new k('<a tabindex="0" hidefocus="hidefocus" class="'+d+'editor-draft-help" title="\u70b9\u51fb\u67e5\u770b\u5e2e\u52a9" href="javascript:void(\'\u70b9\u51fb\u67e5\u770b\u5e2e\u52a9 \')">\u70b9\u51fb\u67e5\u770b\u5e2e\u52a9</a>')).unselectable(void 0).appendTo(c);s.on("click",function(){s[0].focus();a.helpPopup&&a.helpPopup.get("visible")?a.helpPopup.hide():
a._prepareHelp()});s.on("blur",function(){a.helpPopup&&a.helpPopup.hide()});a.helpBtn=s;r.call(a,s);g.Utils.lazyRun(a,"_prepareHelp","_realHelp")}r.call(a,c)},_prepareHelp:function(){var a=this.editor.get("prefixCls"),b=new k(this.config.draft.helpHtml||""),d=new k("<div style='height:0;position:absolute;font-size:0;width:0;border:8px #000 solid;border-color:#000 transparent transparent transparent;border-style:solid dashed dashed dashed;border-top-color:#CED5E0;'><div style='height:0;position:absolute;font-size:0;width:0;border:8px #000 solid;border-color:#000 transparent transparent transparent;border-style:solid dashed dashed dashed;left:-8px;top:-10px;border-top-color:white;'></div></div>");
b.append(d);b.css({border:"1px solid #ACB4BE","text-align":"left"});this.helpPopup=(new h({content:b,prefixCls:a+"editor-",width:b.width()+"px",zIndex:g.baseZIndex(g.zIndexManager.OVERLAY),mask:!1})).render();this.helpPopup.get("el").css("border","none");this.helpPopup.arrow=d},_realHelp:function(){var a=this.helpPopup,b=this.helpBtn,d=a.arrow;a.show();b=b.offset();a.get("el").offset({left:b.left-a.get("el").width()+17,top:b.top-a.get("el").height()-7});d.offset({left:b.left-2,top:b.top-8})},disable:function(){this.holder.css("visibility",
"hidden")},enable:function(){this.holder.css("visibility","")},sync:function(){var b;b=this.draftLimit;var d=this.timeTip,c=this.versions,e=this._getDrafts(),f;e.length>b&&e.splice(0,e.length-b);c.removeItems(!0);for(b=0;b<e.length;b++)f=e[b],f=(f.auto?"\u81ea\u52a8":"\u624b\u52a8")+"\u4fdd\u5b58\u4e8e : "+a(f.date),c.addItem({xclass:"menuitem",content:f,value:b});d.html(f);i.setItem(this._getSaveKey(),i==window.localStorage?encodeURIComponent(s.stringify(e)):e)},save:function(a){var b=this._getDrafts(),d=this.editor.get("formatData");
d&&(b[b.length-1]&&d==b[b.length-1].content&&(b.length-=1),this.drafts=b.concat({content:d,date:(new Date).getTime(),auto:a}),this.sync())},recover:function(b){var d=this.editor,c=this._getDrafts(),e=b.target.get("value");confirm("\u786e\u8ba4\u6062\u590d "+a(c[e].date)+" \u7684\u7f16\u8f91\u5386\u53f2\uff1f")&&(d.execCommand("save"),d.set("data",c[e].content),d.execCommand("save"));b.halt()},destroy:function(){q.call(this)}});e.augment(n,{pluginRenderUI:function(a){var d=this.config;i.ready?i.ready(function(){b(a,d)}):b(a,d)}});return n},{requires:["editor",
"../local-storage/","overlay","../menubutton/"]});
KISSY.add("editor/plugin/drag-upload/index",function(e,g){function i(a){this.config=a||{}}var h=e.Node,f=e.Event,c=g.Utils,a=e.DOM;e.augment(i,{pluginRenderUI:function(d){function b(b){b=b.originalEvent.target;"img"==a.nodeName(b)&&b.src.match(/^file:\/\//)&&(l[b.src]=b)}function n(a,b){var d=new window.FileReader;d.onload=function(c){var e=a.name,c=c.target.result,f=new XMLHttpRequest;f.open("POST",q,!0);f.onreadystatechange=function(){if(4==f.readyState){if(200==f.status||304==f.status){if(""!=
f.responseText){var a=window.JSON.parse(f.responseText);b[0].src=a.imgUrl}}else alert("\u670d\u52a1\u5668\u7aef\u51fa\u9519\uff01"),b.remove();f.onreadystatechange=null}};e="\r\n------kissy-editor-yiminghe\r\n"+('Content-Disposition: form-data; name="'+i+'"; filename="'+encodeURIComponent(e)+'"\r\n');e+="Content-Type: "+(a.type||"application/octet-stream")+"\r\n\r\n";e+=c+"\r\n";r=g.Utils.normParams(r);for(var k in r)e+="------kissy-editor-yiminghe\r\n",e+='Content-Disposition: form-data; name="'+k+'"\r\n\r\n',e+=r[k]+"\r\n";e+="------kissy-editor-yiminghe--";
f.setRequestHeader("Content-Type","multipart/form-data, boundary=----kissy-editor-yiminghe");f.sendAsBinary("Content-Type: multipart/form-data; boundary=----kissy-editor-yiminghe\r\nContent-Length: "+e.length+"\r\n"+e+"\r\n");d.onload=null};d.readAsBinaryString(a)}var k=this.config,i=k.fileInput||"Filedata",s=k.sizeLimit||Number.MAX_VALUE,r=k.serverParams||{},q=k.serverUrl||"",m=RegExp((k.suffix||"png,jpg,jpeg,gif").split(/,/).join("|")+"$","i"),l={},t=!1;d.docReady(function(){var k=d.get("document")[0];
f.on(k,"dragenter",function(){t||(f.on(k,"DOMNodeInserted",b),t=!0)});f.on(k,"drop",function(d){f.remove(k,"DOMNodeInserted",b);t=!1;d.halt();var d=d.originalEvent,g,i;e.isEmptyObject(l)?(i=k.elementFromPoint(d.clientX,d.clientY),g=i.lastChild):(e.each(l,function(b){"img"==a.nodeName(b)&&(g=b.nextSibling,i=b.parentNode,a.remove(b))}),l={});d=d.dataTransfer;d.dropEffect="copy";if(d=d.files)for(var o=0;o<d.length;o++){var q=d[o],r=q.size;if(q.name.match(m)&&!(r/1E3>s)){var r=new h("<img src='"+c.debugUrl("theme/tao-loading.gif")+
"'/>"),z=r[0];i.insertBefore(z,g);var A=a.nodeName(z.parentNode);("head"==A||"html"==A)&&a.insertBefore(z,k.body.firstChild);n(q,r)}}})});window.XMLHttpRequest&&!XMLHttpRequest.prototype.sendAsBinary&&(XMLHttpRequest.prototype.sendAsBinary=function(a,b){for(var d=new (window.BlobBuilder||window.WebKitBlobBuilder),c=a.length,e=new window.Uint8Array(c),f=0;f<c;f++)e[f]=a.charCodeAt(f);d.append(e.buffer);this.send(d.getBlob(b))})}});return i},{requires:["editor"]});
KISSY.add("editor/plugin/element-path/index",function(e,g){function i(c){this.cfg=c;this._cache=[];this._init()}function h(){}var f=e.Node;e.augment(i,{_init:function(){var c=this.cfg.editor;this.holder=new f("<span>");this.holder.appendTo(c.get("statusBarEl"),void 0);c.on("selectionChange",this._selectionChange,this);g.Utils.sourceDisable(c,this)},disable:function(){this.holder.css("visibility","hidden")},enable:function(){this.holder.css("visibility","")},_selectionChange:function(c){var a=this.cfg.editor,
d=a.get("prefixCls"),b=this.holder,c=c.path.elements,e,k;e=this._cache;for(k=0;k<e.length;k++)e[k].remove();this._cache=[];for(k=0;k<c.length;k++){e=c[k];var g=e.attr("_ke_real_element_type")||e.nodeName(),h=new f("<a href='javascript(\""+g+"\")' class='"+d+"editor-element-path'>"+g+"</a>");this._cache.push(h);(function(b){h.on("click",function(d){d.halt();a.focus();setTimeout(function(){a.getSelection().selectElement(b)},50)})})(e);b.prepend(h)}},destroy:function(){this.holder.remove()}});e.augment(h,
{pluginRenderUI:function(c){var a=new i({editor:c});c.on("destroy",function(){a.destroy()})}});return h},{requires:["editor"]});
KISSY.add("editor/plugin/fake-objects/index",function(e,g){var i=e.Node,h=e.DOM,f=g.Utils.debugUrl("theme/spacer.gif"),c=e.require("htmlparser");e.augment(g,{createFakeElement:function(a,b,c,k,g,h){var r=a.attr("style")||"";a.attr("width")&&(r="width:"+a.attr("width")+"px;"+r);a.attr("height")&&(r="height:"+a.attr("height")+"px;"+r);var q=e.trim(a.attr("class")),a={"class":b+" "+q,src:f,_ke_realelement:encodeURIComponent(g||a._4e_outerHtml(void 0)),_ke_real_node_type:a[0].nodeType,style:r};h&&(delete h.width,
delete h.height,e.mix(a,h,!1));c&&(a._ke_real_element_type=c);k&&(a._ke_resizable=k);return new i("<img/>",a,this.get("document")[0])},restoreRealElement:function(a){if(a.attr("_ke_real_node_type")!=h.NodeType.ELEMENT_NODE)return null;var a=e.urlDecode(a.attr("_ke_realelement")),b=new i("<div>",null,this.get("document")[0]);b.html(a);return b.first().remove()}});var a={tags:{$:function(a){var b=a.getAttribute("_ke_realelement"),f;b&&(f=(new c.Parser(e.urlDecode(b))).parse());if(b=f&&f.childNodes[0]){if(f=
a.getAttribute("style")){var k=/(?:^|\s)width\s*:\s*(\d+)/i.exec(f),a=k&&k[1];f=(k=/(?:^|\s)height\s*:\s*(\d+)/i.exec(f))&&k[1];a&&b.setAttribute("width",a);f&&b.setAttribute("height",f)}return b}}}};return{init:function(d){var b=d.htmlDataProcessor,g=b&&b.htmlFilter;b.createFakeParserElement||(g&&g.addRules(a),e.mix(b,{restoreRealElement:function(a){if(a.attr("_ke_real_node_type")!=h.NodeType.ELEMENT_NODE)return null;var a=e.urlDecode(a.attr("_ke_realelement")),b=new i("<div>",null,d.get("document")[0]);
b.html(a);return b.first().remove()},createFakeParserElement:function(a,b,d,g,h){var i=c.serialize(a),l=a.getAttribute("style")||"";a.getAttribute("width")&&(l="width:"+a.getAttribute("width")+"px;"+l);a.getAttribute("height")&&(l="height:"+a.getAttribute("height")+"px;"+l);var n=e.trim(a.getAttribute("class")),a={"class":b+" "+n,src:f,_ke_realelement:encodeURIComponent(i),_ke_real_node_type:a.nodeType+"",style:l,align:a.getAttribute("align")||""};h&&(delete h.width,delete h.height,e.mix(a,h,!1));
d&&(a._ke_real_element_type=d);g&&(a._ke_resizable="_ke_resizable");return new c.Tag("img",a)}}))}}},{requires:["editor"]});
KISSY.add("editor/plugin/flash-bridge/index",function(e,g,i){function h(c){this._init(c)}var f={};e.augment(h,e.EventTarget,{_init:function(c){var a=e.guid("flashbridge-");c.id=a;c.attrs=c.attrs||{};c.params=c.params||{};var d=c.attrs,b=c.params,h=b.flashVars=b.flashVars||{};e.mix(d,{width:1,height:1},!1);e.mix(b,{allowScriptAccess:"always",allowNetworking:"all",scale:"noScale"},!1);e.mix(h,{shareData:!1,useCompression:!1},!1);d={YUISwfId:a,YUIBridgeCallback:"KISSY.Editor.FlashBridge.EventHandler"};
c.ajbridge&&(d={swfID:a,jsEntry:"KISSY.Editor.FlashBridge.EventHandler"});e.mix(h,d);f[a]=this;this.id=a;this.swf=new g(c);this._expose(c.methods)},_expose:function(c){for(var a=this,d=0;d<c.length;d++)(function(b){a[b]=function(){return a._callSWF(b,e.makeArray(arguments))}})(c[d])},_callSWF:function(c,a){return this.swf.callSWF(c,a)},_eventHandler:function(c){var a=c.type;"log"!==a&&a&&this.fire(a,c)},ready:function(c){if(this._ready)c.call(this);else this.on("contentReady",c)},destroy:function(){this.swf.destroy();
delete f[this.id]}});h.EventHandler=function(c,a){var d=f[c];d&&setTimeout(function(){d._eventHandler.call(d,a)},100)};return i.FlashBridge=h},{requires:["swf","editor"]});
KISSY.add("editor/plugin/flash-common/baseClass",function(e,g,i,h,f,c){function a(){a.superclass.constructor.apply(this,arguments);this._init()}var d=e.Node;a.ATTRS={cls:{},type:{},label:{value:"\u5728\u65b0\u7a97\u53e3\u67e5\u770b"},bubbleId:{},contextMenuId:{},contextMenuHandlers:{}};e.extend(a,e.Base,{_init:function(){var a=this,d=a.get("cls"),c=a.get("editor"),f=c.get("prefixCls"),h=[],i=a.get("bubbleId"),q=a.get("contextMenuId"),m=a.get("contextMenuHandlers");e.each(m,function(a,b){h.push({content:b})});c.addContextMenu(q,
"."+d,{width:"120px",children:h,listeners:{click:function(a){a=a.target.get("content");m[a]&&m[a].call(this)}}});c.addBubble(i,function(a){return a.hasClass(d,void 0)&&a},{listeners:{afterRenderUI:function(){var d=this,h=d.get("contentEl");h.html(e.substitute(' <a class="{prefixCls}editor-bubble-url" target="_blank" href="#">{label}</a>   |    <span class="{prefixCls}editor-bubble-link {prefixCls}editor-bubble-change">\u7f16\u8f91</span>   |    <span class="{prefixCls}editor-bubble-link {prefixCls}editor-bubble-remove">\u5220\u9664</span>',
{label:a.get("label"),prefixCls:f}));var j=h.one("."+f+"editor-bubble-url"),i=h.one("."+f+"editor-bubble-change"),n=h.one("."+f+"editor-bubble-remove");g.Utils.preventFocus(h);i.on("click",function(c){a.show(d.get("editorSelectedEl"));c.halt()});n.on("click",function(a){if(e.UA.webkit){var b=c.getSelection().getRanges();if(b=b&&b[0])b.collapse(!0),b.select()}d.get("editorSelectedEl").remove();d.hide();c.notifySelectionChange();a.halt()});d.on("show",function(){var c=d.get("editorSelectedEl");c&&a._updateTip(j,
c)})}}});c.docReady(function(){c.get("document").on("dblclick",a._dbClick,a)})},_getFlashUrl:function(a){return c.getUrl(a)},_updateTip:function(a,d){var c=this.get("editor").restoreRealElement(d);c&&(c=this._getFlashUrl(c),a.attr("href",c))},_dbClick:function(a){var c=new d(a.target);"img"===c.nodeName()&&c.hasClass(this.get("cls"),void 0)&&(this.show(c),a.halt())},show:function(a){var d=this.get("editor");f.useDialog(d,this.get("type"),this.get("pluginConfig"),a)}});return a},{requires:["editor",
"../contextmenu/","../bubble/","../dialog-loader/","./utils"]});
KISSY.add("editor/plugin/flash-common/utils",function(e,g){var i=e.DOM,h={insertFlash:function(e,c,a,d,b){c=h.createSWF({src:c,attrs:a,document:e.get("document")[0]});a=e.createFakeElement(c.el,d||"ke_flash",b||"flash",!0,c.html,a);e.insertElement(a);return a},isFlashEmbed:function(e){return"application/x-shockwave-flash"==i.attr(e,"type")||/\.swf(?:$|\?)/i.test(i.attr(e,"src")||"")},getUrl:function(e){return g.getSrc(e)},createSWF:function(f){var c=i.create('<div style="position:absolute;left:-9999px;top:-9999px;"></div>',
void 0,f.document);f.htmlMode="full";i.append(c,f.document.body);f.render=c;f=new g(f);i.remove(c);return{el:e.all(f.get("el")),html:f.get("html")}}};return h},{requires:["swf"]});
KISSY.add("editor/plugin/flash/index",function(e,g,i,h,f){function c(a){this.config=a||{}}e.augment(c,{pluginRenderUI:function(a){f.init(a);var d=a.htmlDataProcessor;d.dataFilter.addRules({tags:{object:function(a){var b;if(!a.getAttribute("classid")){var c=a.childNodes;for(b=0;b<c.length;b++)if("embed"==c[b].nodeName)if(h.isFlashEmbed(c[b][b]))break;else return d.createFakeParserElement(a,"ke_flash","flash",!0);return null}return d.createFakeParserElement(a,"ke_flash","flash",!0)},embed:function(a){return h.isFlashEmbed(a)?
d.createFakeParserElement(a,"ke_flash","flash",!0):null}}},5);var b=new i({editor:a,cls:"ke_flash",type:"flash",pluginConfig:this.config,bubbleId:"flash",contextMenuId:"flash",contextMenuHandlers:{"Flash\u5c5e\u6027":function(){var a=this.get("editorSelectedEl");a&&b.show(a)}}});this.flashControl=b;a.addButton("flash",{tooltip:"\u63d2\u5165Flash",listeners:{click:function(){b.show()}},mode:g.WYSIWYG_MODE})}});return c},{requires:["editor","../flash-common/baseClass","../flash-common/utils","../fake-objects/"]});
KISSY.add("editor/plugin/focus-fix/index",function(e,g){function i(){var a=this._focusEditor=c.currentInstance();if(f.ie&&a){window.focus();document.body.focus();var d=a.get("document")[0].selection,b;try{b=d.createRange()}catch(e){b=0}b&&b.item&&b.item(0).ownerDocument==a.get("document")[0]&&(a=document.body.createTextRange(),a.moveToElementText(this.get("el").first()[0]),a.collapse(!0),a.select())}}function h(){var a=this._focusEditor;a&&a.focus()}var f=e.UA,c=g.focusManager;return{init:function(a){a.on("beforeVisibleChange",
function(d){d.newVal&&i.call(a)});a.on("hide",function(){h.call(a)})}}},{requires:["editor"]});KISSY.add("editor/plugin/font-family/cmd",function(e,g,i){var h={element:"span",styles:{"font-family":"#(value)"},overrides:[{element:"font",attributes:{face:null}}]};return{init:function(e){i.addSelectCmd(e,"fontFamily",h)}}},{requires:["editor","../font/cmd"]});
KISSY.add("editor/plugin/font-family/index",function(e,g,i,h){function f(c){this.config=c||{}}e.augment(f,{pluginRenderUI:function(c){h.init(c);var a=this.config,d={};e.mix(d,{children:[{content:"\u5b8b\u4f53",value:"SimSun"},{content:"\u9ed1\u4f53",value:"SimHei"},{content:"\u96b6\u4e66",value:"LiSu"},{content:"\u6977\u4f53",value:"KaiTi_GB2312"},{content:"\u5fae\u8f6f\u96c5\u9ed1",value:"'Microsoft YaHei'"},{content:"Georgia",value:"Georgia"},{content:"Times New Roman",value:"'Times New Roman'"},{content:"Impact",value:"Impact"},{content:"Courier New",value:"'Courier New'"},
{content:"Arial",value:"Arial"},{content:"Verdana",value:"Verdana"},{content:"Tahoma",value:"Tahoma"}],width:"130px"});e.each(d.children,function(a){var d=a.elAttrs||{},c=a.value;d.style=d.style||"";d.style+=";font-family:"+c;a.elAttrs=d});a.menu=e.mix(d,a.menu);c.addSelect("fontFamily",e.mix({cmdType:"fontFamily",defaultCaption:"\u5b57\u4f53",width:130,mode:g.WYSIWYG_MODE},a),i.Select)}});return f},{requires:["editor","../font/ui","./cmd"]});
KISSY.add("editor/plugin/font-size/cmd",function(e,g,i){var h={element:"span",styles:{"font-size":"#(value)"},overrides:[{element:"font",attributes:{size:null}}]};return{init:function(e){i.addSelectCmd(e,"fontSize",h)}}},{requires:["editor","../font/cmd"]});
KISSY.add("editor/plugin/font-size/index",function(e,g,i,h){function f(c){this.config=c||{}}e.augment(f,{pluginRenderUI:function(c){h.init(c);var a=this.config;a.menu=e.mix({children:function(a){var b=[];e.each(a,function(a){b.push({content:a,value:a})});return b}("8px,10px,12px,14px,18px,24px,36px,48px,60px,72px,84px,96px".split(","))},a.menu);c.addSelect("fontSize",e.mix({cmdType:"fontSize",defaultCaption:"\u5927\u5c0f",width:"70px",mode:g.WYSIWYG_MODE},a),i.Select)}});return f},{requires:["editor","../font/ui",
"./cmd"]});
KISSY.add("editor/plugin/font/cmd",function(e,g){function i(e,c){var a=e.nodeName();if(c.element!=a)return!1;var d=c.styles,b,h;for(h in d)if(b=e.style(h))return b;d=c.overrides;for(h=0;h<d.length;h++)if(b=d[h],b.element==a){var g=b.attributes,i;for(i in g)if(b=e.attr(i))return b}return!1}var h=g.Utils.getQueryCmd;return{addButtonCmd:function(e,c,a){var d=h(c);e.hasCommand(c)||(e.addCommand(c,{exec:function(b){var d=b.get("document")[0];b.execCommand("save");b.queryCommandValue(c)?a.remove(d):a.apply(d);
b.execCommand("save");b.notifySelectionChange()}}),e.addCommand(d,{exec:function(b){if((b=b.getSelection())&&!b.isInvalid)return b=b.getStartElement(),b=new g.ElementPath(b),a.checkActive(b)}}))},addSelectCmd:function(e,c,a){var d=h(c);e.hasCommand(c)||(e.addCommand(c,{exec:function(b,d){b.focus();var e=b.queryCommandValue(c)||"",f=new g.Style(a,{value:d}),h=b.get("document")[0];b.execCommand("save");d.toLowerCase()==e.toLowerCase()?f.remove(h):f.apply(h);b.execCommand("save")}}),e.addCommand(d,{exec:function(b){if((b=
b.getSelection())&&!b.isInvalid){var b=b.getStartElement(),b=new g.ElementPath(b),d=b.elements,c,e,f;for(e=0;e<d.length;e++)if(c=d[e],!(b.block&&c[0]==b.block[0]||b.blockLimit&&c[0]==b.blockLimit[0]))if(f=i(c,a),!1!==f)break;return f}}}))}}},{requires:["editor"]});
KISSY.add("editor/plugin/font/ui",function(e,g,i,h){e=h.Select.extend({initializer:function(){var e=this,c=e.get("editor");e.on("click",function(a){var a=a.target.get("value"),d=e.get("cmdType");c.execCommand(d,a)});c.on("selectionChange",function(){if(c.get("mode")!=g.SOURCE_MODE){var a=e.get("cmdType"),d=e.get("menu");if(d=d.get&&d.get("children")){a=c.queryCommandValue(a);if(!1!==a)for(var a=(a+"").toLowerCase(),b=0;b<d.length;b++){var h=d[b].get("value");if(a==h.toLowerCase()){e.set("value",h);
return}}e.set("value",null)}}})}});return{Button:i.extend({initializer:function(){var e=this,c=e.get("editor"),a=e.get("cmdType");e.on("click",function(){e.get("checked")?c.execCommand(a):c.execCommand(a,!1);c.focus()});c.on("selectionChange",function(){if(c.get("mode")!=g.SOURCE_MODE){var a=e.get("cmdType");c.queryCommandValue(a)?e.set("checked",!0):e.set("checked",!1)}})}},{ATTRS:{checkable:{value:!0},mode:{value:g.WYSIWYG_MODE}}}),Select:e}},{requires:["editor","../button/","../menubutton/"]});
KISSY.add("editor/plugin/fore-color/cmd",function(e,g){var i={element:"span",styles:{color:"#(color)"},overrides:[{element:"font",attributes:{color:null}}],childRule:function(e){return!("a"==e.nodeName()||e.all("a").length)}};return{init:function(e){e.hasCommand("foreColor")||e.addCommand("foreColor",{exec:function(e,c){e.execCommand("save");g.applyColor(e,c,i);e.execCommand("save")}})}}},{requires:["../color/cmd"]});
KISSY.add("editor/plugin/fore-color/index",function(e,g,i,h){function f(c){this.config=c||{}}e.augment(f,{pluginRenderUI:function(c){h.init(c);i.init(c,{cmdType:"foreColor",defaultColor:"rgb(204, 0, 0)",tooltip:"\u6587\u672c\u989c\u8272"})}});return f},{requires:["editor","../color/btn","./cmd"]});
KISSY.add("editor/plugin/heading/cmd",function(e,g){return{init:function(e){if(!e.hasCommand("heading")){e.addCommand("heading",{exec:function(e,c){e.execCommand("save");if("p"!=c)var a=e.queryCommandValue("heading");c==a&&(c="p");(new g.Style({element:c})).apply(e.get("document")[0]);e.execCommand("save")}});var h=g.Utils.getQueryCmd("heading");e.addCommand(h,{exec:function(e){if((e=e.getSelection())&&!e.isInvalid)if(e=e.getStartElement(),e=new g.ElementPath(e),e=(e=e.block||e.blockLimit)&&e.nodeName()||
"",e.match(/^h\d$/)||"p"==e)return e}})}}}},{requires:["editor"]});
KISSY.add("editor/plugin/heading/index",function(e,g,i){function h(){}e.augment(h,{pluginRenderUI:function(e){i.init(e);var c=[],a={"\u666e\u901a\u6587\u672c":"p","\u6807\u98981":"h1","\u6807\u98982":"h2","\u6807\u98983":"h3","\u6807\u98984":"h4","\u6807\u98985":"h5","\u6807\u98986":"h6"},d={p:"1em",h1:"2em",h2:"1.5em",h3:"1.17em",h4:"1em",h5:"0.83em",h6:"0.67em"},b;for(b in a)c.push({content:b,value:a[b],elAttrs:{style:"font-size:"+d[a[b]]}});e.addSelect("heading",{defaultCaption:"\u6807\u9898",width:"120px",menu:{children:c},mode:g.WYSIWYG_MODE,listeners:{click:function(a){a=a.target.get("value");
e.execCommand("heading",a)},afterSyncUI:function(){var a=this;e.on("selectionChange",function(){if(e.get("mode")!=g.SOURCE_MODE){var b=e.queryCommandValue("heading"),c;for(c in d)if(c==b){a.set("value",c);return}a.set("value",null)}})}}})}});return h},{requires:["editor","./cmd"]});
KISSY.add("editor/plugin/image/index",function(e,g,i,h,f,c){function a(a){this.config=a||{}}var d=e.UA,b=KISSY.NodeList,n=e.all,k=e.Event,o=function(a){a=n(a);if("img"===a.nodeName()&&!/(^|\s+)ke_/.test(a[0].className))return a};e.augment(a,{pluginRenderUI:function(a){function f(b){c.useDialog(a,"image",h.config,b)}var h=this,i=a.get("prefixCls");a.addButton("image",{tooltip:"\u63d2\u5165\u56fe\u7247",listeners:{click:function(){f(null)}},mode:g.WYSIWYG_MODE});var l=[{content:"\u56fe\u7247\u5c5e\u6027",fn:function(){var a=o(this.get("editorSelectedEl"));
a&&(this.hide(),f(n(a)))}},{content:"\u63d2\u5165\u65b0\u884c",fn:function(){this.hide();var c=a.get("document")[0],e=new b(c.createElement("p"));d.ie||e._4e_appendBogus(void 0);c=new g.Range(c);c.setStartAfter(this.get("editorSelectedEl"));c.select();a.insertElement(e);c.moveToElementEditablePosition(e,1);c.select()}}],t=[];e.each(l,function(a){t.push({content:a.content})});a.addContextMenu("image",o,{width:120,children:t,listeners:{click:function(a){var b=this,d=a.target.get("content");e.each(l,function(a){a.content==
d&&a.fn.call(b)})}}});a.docReady(function(){k.on(a.get("document")[0],"dblclick",function(a){a.halt();a=n(a.target);o(a)&&f(a)})});a.addBubble("image",o,{listeners:{afterRenderUI:function(){var b=this,c=b.get("contentEl");c.html(e.substitute('<a class="{prefixCls}editor-bubble-url" target="_blank" href="#">\u5728\u65b0\u7a97\u53e3\u67e5\u770b</a>  |  <a class="{prefixCls}editor-bubble-link {prefixCls}editor-bubble-change" href="#">\u7f16\u8f91</a>  |  <a class="{prefixCls}editor-bubble-link {prefixCls}editor-bubble-remove" href="#">\u5220\u9664</a>',
{prefixCls:i}));var h=c.one("."+i+"editor-bubble-url"),k=c.one("."+i+"editor-bubble-change"),l=c.one("."+i+"editor-bubble-remove");g.Utils.preventFocus(c);k.on("click",function(a){f(b.get("editorSelectedEl"));a.halt()});l.on("click",function(c){if(d.webkit){var e=a.getSelection().getRanges();e&&e[0]&&(e[0].collapse(),e[0].select())}b.get("editorSelectedEl").remove();b.hide();a.notifySelectionChange();c.halt()});b.on("show",function(){var a=b.get("editorSelectedEl");a&&(a=a.attr("_ke_saved_src")||
a.attr("src"),h.attr("href",a))})}}})}});return a},{requires:["editor","../button/","../bubble/","../contextmenu/","../dialog-loader/"]});KISSY.add("editor/plugin/indent/cmd",function(e,g,i){var h=i.addCommand;return{init:function(e){h(e,"indent")}}},{requires:["editor","../dent-utils/cmd"]});
KISSY.add("editor/plugin/indent/index",function(e,g,i){function h(){}e.augment(h,{pluginRenderUI:function(e){i.init(e);e.addButton("indent",{tooltip:"\u589e\u52a0\u7f29\u8fdb\u91cf ",listeners:{click:function(){e.execCommand("indent");e.focus()}},mode:g.WYSIWYG_MODE})}});return h},{requires:["editor","./cmd"]});
KISSY.add("editor/plugin/italic/cmd",function(e,g,i){var h=new g.Style({element:"em",overrides:[{element:"i"},{element:"span",attributes:{style:"font-style: italic;"}}]});return{init:function(e){i.addButtonCmd(e,"italic",h)}}},{requires:["editor","../font/cmd"]});
KISSY.add("editor/plugin/italic/index",function(e,g,i,h){function f(){}e.augment(f,{pluginRenderUI:function(c){h.init(c);c.addButton("italic",{cmdType:"italic",tooltip:"\u659c\u4f53 "},i.Button);c.docReady(function(){c.get("document").on("keydown",function(a){a.ctrlKey&&a.keyCode==e.Node.KeyCodes.I&&(c.execCommand("italic"),a.preventDefault())})})}});return f},{requires:["editor","../font/ui","./cmd"]});
KISSY.add("editor/plugin/justify-center/cmd",function(e,g){return{init:function(e){g.addCommand(e,"justifyCenter","center")}}},{requires:["../justify-utils/cmd"]});
KISSY.add("editor/plugin/justify-center/index",function(e,g,i){function h(){var c=this.get("editor");c.execCommand("justifyCenter");c.focus()}function f(){}e.augment(f,{pluginRenderUI:function(c){i.init(c);c.addButton("justifyCenter",{tooltip:"\u5c45\u4e2d\u5bf9\u9f50",checkable:!0,listeners:{click:h,afterSyncUI:function(){var a=this;c.on("selectionChange",function(){c.get("mode")!=g.SOURCE_MODE&&(c.queryCommandValue("justifyCenter")?a.set("checked",!0):a.set("checked",!1))})}},mode:g.WYSIWYG_MODE});c.docReady(function(){c.get("document").on("keydown",
function(a){a.ctrlKey&&a.keyCode==e.Node.KeyCodes.E&&(c.execCommand("justifyCenter"),a.preventDefault())})})}});return f},{requires:["editor","./cmd"]});KISSY.add("editor/plugin/justify-left/cmd",function(e,g){return{init:function(e){g.addCommand(e,"justifyLeft","left")}}},{requires:["../justify-utils/cmd"]});
KISSY.add("editor/plugin/justify-left/index",function(e,g,i){function h(){var c=this.get("editor");c.execCommand("justifyLeft");c.focus()}function f(){}e.augment(f,{pluginRenderUI:function(c){i.init(c);c.addButton("justifyLeft",{tooltip:"\u5de6\u5bf9\u9f50",checkable:!0,listeners:{click:h,afterSyncUI:function(){var a=this;c.on("selectionChange",function(){c.get("mode")!=g.SOURCE_MODE&&(c.queryCommandValue("justifyLeft")?a.set("checked",!0):a.set("checked",!1))})}},mode:g.WYSIWYG_MODE});c.docReady(function(){c.get("document").on("keydown",
function(a){a.ctrlKey&&a.keyCode==e.Node.KeyCodes.L&&(c.execCommand("justifyLeft"),a.preventDefault())})})}});return f},{requires:["editor","./cmd"]});KISSY.add("editor/plugin/justify-right/cmd",function(e,g){return{init:function(e){g.addCommand(e,"justifyRight","right")}}},{requires:["../justify-utils/cmd"]});
KISSY.add("editor/plugin/justify-right/index",function(e,g,i){function h(){var c=this.get("editor");c.execCommand("justifyRight");c.focus()}function f(){}e.augment(f,{pluginRenderUI:function(c){i.init(c);c.addButton("justifyRight",{tooltip:"\u53f3\u5bf9\u9f50",checkable:!0,listeners:{click:h,afterSyncUI:function(){var a=this;c.on("selectionChange",function(){c.get("mode")!=g.SOURCE_MODE&&(c.queryCommandValue("justifyRight")?a.set("checked",!0):a.set("checked",!1))})}},mode:g.WYSIWYG_MODE});c.docReady(function(){c.get("document").on("keydown",
function(a){a.ctrlKey&&a.keyCode==e.Node.KeyCodes.R&&(c.execCommand("justifyRight"),a.preventDefault())})})}});return f},{requires:["editor","./cmd"]});
KISSY.add("editor/plugin/justify-utils/cmd",function(e,g){var i=/(-moz-|-webkit-|start|auto)/gi;return{addCommand:function(e,f,c){e.hasCommand(f)||(e.addCommand(f,{exec:function(a){a.focus();a.execCommand("save");for(var d=a.getSelection(),b=d.createBookmarks(),e=d.getRanges(),f,h,g=e.length-1;0<=g;g--){f=e[g].createIterator();for(f.enlargeBr=!0;h=f.getNextParagraph();)h.removeAttr("align"),(h.css("text-align").replace(i,"")||"left")==c?h.css("text-align",""):h.css("text-align",c)}d.selectBookmarks(b);
a.execCommand("save");a.notifySelectionChange()}}),e.addCommand(g.Utils.getQueryCmd(f),{exec:function(a){if((a=a.getSelection())&&!a.isInvalid)return a=a.getStartElement(),a=new g.ElementPath(a),a=a.block||a.blockLimit,!a||"body"===a.nodeName()?!1:(a.css("text-align").replace(i,"")||"left")==c}}))}}},{requires:["editor"]});
KISSY.add("editor/plugin/link/index",function(e,g,i,h,f){function c(a){a=d(a);return a.closest("a",void 0)}function a(a){this.config=a||{}}var d=e.all;e.augment(a,{pluginRenderUI:function(a){var d=a.get("prefixCls");a.addButton("link",{tooltip:"\u63d2\u5165\u94fe\u63a5",listeners:{click:function(){f.useDialog(a,"link",k.config,void 0)}},mode:g.WYSIWYG_MODE});var k=this;a.addBubble("link",c,{listeners:{afterRenderUI:function(){var c=this,i=c.get("contentEl");i.html(e.substitute('<a href=""  target="_blank" class="{prefixCls}editor-bubble-url">\u5728\u65b0\u7a97\u53e3\u67e5\u770b</a>  \u2013   <span class="{prefixCls}editor-bubble-link {prefixCls}editor-bubble-change">\u7f16\u8f91</span>   |    <span class="{prefixCls}editor-bubble-link {prefixCls}editor-bubble-remove">\u53bb\u9664</span>',
{prefixCls:d}));var r=i.one("."+d+"editor-bubble-url"),q=i.one("."+d+"editor-bubble-change"),m=i.one("."+d+"editor-bubble-remove");g.Utils.preventFocus(i);q.on("click",function(d){var e=c.get("editorSelectedEl");f.useDialog(a,"link",k.config,e);d.halt()});m.on("click",function(d){h.removeLink(a,c.get("editorSelectedEl"));d.halt()});c.on("show",function(){var a=c.get("editorSelectedEl");a&&(a=a.attr(h._ke_saved_href)||a.attr("href"),r.html(a),r.attr("href",a))})}}})}});return a},{requires:["editor",
"../bubble/","./utils","../dialog-loader/","../button/"]});
KISSY.add("editor/plugin/link/utils",function(e,g){var i=e.Node,h=g.Style,f={element:"a",attributes:{href:"#(href)",title:"#(title)",_ke_saved_href:"#(_ke_saved_href)",target:"#(target)"}};return{removeLink:function(c,a){c.execCommand("save");var d=c.getSelection(),b=d.getRanges()[0];if(b&&b.collapsed)b=d.createBookmarks(),a._4e_remove(!0),d.selectBookmarks(b);else if(b){for(var d=a[0],b=d.attributes,e={},g=0;g<b.length;g++){var i=b[g];i.specified&&(e[i.name]=i.value)}d.style.cssText&&(e.style=d.style.cssText);
(new h(f,e)).remove(c.get("document")[0])}c.execCommand("save");c.notifySelectionChange()},applyLink:function(c,a,d){a._ke_saved_href=a.href;d?(c.execCommand("save"),d.attr(a)):(d=(d=c.getSelection())&&d.getRanges()[0],!d||d.collapsed?(a=new i("<a>"+a.href+"</a>",a,c.get("document")[0]),c.insertElement(a)):(c.execCommand("save"),(new h(f,a)).apply(c.get("document")[0])));c.execCommand("save");c.notifySelectionChange()},_ke_saved_href:"_ke_saved_href"}},{requires:["editor"]});
KISSY.add("editor/plugin/list-utils/btn",function(e,g){return{init:function(e,h){var f=h.buttonId,c=h.cmdType,a=h.tooltip,d=e.addButton(f,{elCls:f+"Btn",mode:g.WYSIWYG_MODE,tooltip:"\u8bbe\u7f6e"+a});e.on("selectionChange",function(){var a;(a=e.queryCommandValue(c))?(d.set("checked",!0),b.set("value",a)):d.set("checked",!1)});var b=e.addSelect(f+"Arrow",{tooltip:"\u9009\u62e9\u5e76\u8bbe\u7f6e"+a,mode:g.WYSIWYG_MODE,menu:h.menu,matchElWidth:!1,elCls:"toolbar-"+f+"ArrowBtn"});b.on("click",function(a){a=a.target.get("value");d.listValue=
a;e.execCommand(c,a);e.focus()});d.on("click",function(){var a=d.listValue;d.get("checked")&&(a=b.get("value"));e.execCommand(c,a);e.focus()})}}},{requires:["editor","../button/","../menubutton/"]});
KISSY.add("editor/plugin/list-utils/cmd",function(e,g,i,h){function f(a){this.type=a}function c(b,d){var c,e,f,h=d.blockLimit,g=d.elements;if(!h)return!1;if(g)for(f=0;f<g.length&&(c=g[f])&&c[0]!==h[0];f++)if(a[e=c.nodeName()]&&e==b)return c.css("list-style-type");return!1}var a={ol:"insertOrderedList",ul:"insertUnorderedList"},d=g.RANGE,b=g.ElementPath,n=g.Walker,k=e.UA,o=e.Node,s=e.DOM,r=/^h[1-6]$/;f.prototype={changeListType:function(a,b,d,c,e){for(var f=i.listToArray(b.root,d,h,h,h),g=[],a=0;a<
b.contents.length;a++){var k=b.contents[a];if((k=k.closest("li",h))&&k[0]&&!k.data("list_item_processed"))g.push(k),k._4e_setMarker(d,"list_item_processed",!0,h)}k=new o(b.root[0].ownerDocument.createElement(this.type));k.css("list-style-type",e);for(a=0;a<g.length;a++)e=g[a].data("listarray_index"),f[e].parent=k;for(var d=i.arrayToList(f,d,null,"p"),n,e=d.listNode.childNodes.length,a=0;a<e&&(n=new o(d.listNode.childNodes[a]));a++)n.nodeName()==this.type&&c.push(n);b.root.before(d.listNode);b.root.remove()},
createList:function(a,b,d,c){var e=b.contents,a=b.root[0].ownerDocument,f=[];if(1==e.length&&e[0][0]===b.root[0]){var g=new o(a.createElement("div"));e[0][0].nodeType!=s.NodeType.TEXT_NODE&&e[0]._4e_moveChildren(g,h,h);e[0][0].appendChild(g[0]);e[0]=g}b=b.contents[0].parent();for(g=0;g<e.length;g++)b=b._4e_commonAncestor(e[g].parent(),h);for(g=0;g<e.length;g++)for(var i=e[g],n;n=i.parent();){if(n[0]===b[0]){f.push(i);break}i=n}if(!(1>f.length)){e=new o(f[f.length-1][0].nextSibling);g=new o(a.createElement(this.type));
g.css("list-style-type",c);for(d.push(g);f.length;)d=f.shift(),c=new o(a.createElement("li")),r.test(d.nodeName())?c[0].appendChild(d[0]):(d._4e_copyAttributes(c,h,h),d._4e_moveChildren(c,h,h),d.remove()),g[0].appendChild(c[0]),k.ie||c._4e_appendBogus(h);e[0]?g.insertBefore(e,h):b.append(g)}},removeList:function(a,b,d){function c(d){if((w=new o(r[d?"firstChild":"lastChild"]))&&!(w[0].nodeType==s.NodeType.ELEMENT_NODE&&w._4e_isBlockBoundary(h,h))&&(x=b.root[d?"prev":"next"](n.whitespaces(!0),1))&&
!(w[0].nodeType==s.NodeType.ELEMENT_NODE&&x._4e_isBlockBoundary({br:1},h)))w[d?"before":"after"](a.get("document")[0].createElement("br"))}for(var e=i.listToArray(b.root,d,h,h,h),f=[],g=0;g<b.contents.length;g++){var k=b.contents[g];if((k=k.closest("li",h))&&!k.data("list_item_processed"))f.push(k),k._4e_setMarker(d,"list_item_processed",!0,h)}k=null;for(g=0;g<f.length;g++)k=f[g].data("listarray_index"),e[k].indent=-1;for(g=k+1;g<e.length;g++)if(e[g].indent>Math.max(e[g-1].indent,0)){f=e[g-1].indent+
1-e[g].indent;for(k=e[g].indent;e[g]&&e[g].indent>=k;)e[g].indent+=f,g++;g--}var r=i.arrayToList(e,d,null,"p").listNode,w,x;c(!0);c(h);b.root.before(r);b.root.remove()},exec:function(e,f){var k=e.getSelection(),i=k&&k.getRanges();if(i&&!(1>i.length)){for(var j=k.getStartElement(),j=new g.ElementPath(j),o=c(this.type,j),j=k.createBookmarks(!0),p=[],r={};0<i.length;){var v=i.shift(),w=v.getBoundaryNodes(),x=w.startNode,z=w.endNode;x[0].nodeType==s.NodeType.ELEMENT_NODE&&"td"==x.nodeName()&&v.setStartAt(w.startNode,
d.POSITION_AFTER_START);z[0].nodeType==s.NodeType.ELEMENT_NODE&&"td"==z.nodeName()&&v.setEndAt(w.endNode,d.POSITION_BEFORE_END);v=v.createIterator();for(v.forceBrBreak=!1;w=v.getNextParagraph();)if(!w.data("list_block")){w._4e_setMarker(r,"list_block",1,h);for(var z=new b(w),A=z.elements,D=null,C=!1,D=z.blockLimit,B,x=A.length-1;0<=x&&(B=A[x]);x--)if(a[B.nodeName()]&&D.contains(B)){D.removeData("list_group_object");(x=B.data("list_group_object"))?x.contents.push(w):(x={root:B,contents:[w]},p.push(x),
B._4e_setMarker(r,"list_group_object",x,h));C=!0;break}C||(z=D||z.block,z.data("list_group_object")?z.data("list_group_object").contents.push(w):(x={root:z,contents:[w]},z._4e_setMarker(r,"list_group_object",x,h),p.push(x)))}}for(i=[];0<p.length;)x=p.shift(),o?a[x.root.nodeName()]&&(x.root.css("list-style-type")==f?this.removeList(e,x,r):x.root.css("list-style-type",f)):a[x.root.nodeName()]?this.changeListType(e,x,r,i,f):(g.Utils.clearAllMarkers(r),this.createList(e,x,i,f));for(var F=this,x=0;x<i.length;x++)D=
i[x],B=function(a,b){var d=b[a?"prev":"next"](n.whitespaces(!0),1);d&&d[0]&&d.nodeName()==F.type&&d.css("list-style-type")==f&&(d.remove(),d._4e_moveChildren(b,a?!0:!1,h))},B(h,D),B(!0,D);g.Utils.clearAllMarkers(r);k.selectBookmarks(j)}}};return{ListCommand:f,queryActive:c}},{requires:["editor","../list-utils/"]});
KISSY.add("editor/plugin/list-utils/index",function(e){var g={ol:1,ul:1},i=e.Node,h=e.DOM,f=h.NodeType,c=e.UA,a={listToArray:function(d,b,c,e,f){if(!g[d.nodeName()])return[];e||(e=0);c||(c=[]);for(var s=0,r=d[0].childNodes.length;s<r;s++){var q=new i(d[0].childNodes[s]);if("li"==q.nodeName()){var m={parent:d,indent:e,element:q,contents:[]};f?m.grandparent=f:(m.grandparent=d.parent(),m.grandparent&&"li"==m.grandparent.nodeName()&&(m.grandparent=m.grandparent.parent()));b&&q._4e_setMarker(b,"listarray_index",
c.length,void 0);c.push(m);for(var l=0,t=q[0].childNodes.length,j;l<t;l++)j=new i(q[0].childNodes[l]),j[0].nodeType==h.NodeType.ELEMENT_NODE&&g[j.nodeName()]?a.listToArray(j,b,c,e+1,m.grandparent):m.contents.push(j)}}return c},arrayToList:function(d,b,e,k){e||(e=0);if(!d||d.length<e+1)return null;for(var o=d[e].parent[0].ownerDocument,s=o.createDocumentFragment(),r=null,q=e,m=Math.max(d[e].indent,0),l=null;;){var t=d[q];if(t.indent==m){if(!r||d[q].parent.nodeName()!=r.nodeName())r=d[q].parent.clone(!1),
s.appendChild(r[0]);for(var l=r[0].appendChild(t.element.clone(!1)[0]),j=0;j<t.contents.length;j++)l.appendChild(t.contents[j].clone(!0)[0]);q++}else if(t.indent==Math.max(m,0)+1)q=a.arrayToList(d,null,q,k),l.appendChild(q.listNode),q=q.nextIndex;else if(-1==t.indent&&!e&&t.grandparent){g[t.grandparent.nodeName()]?l=t.element.clone(!1)[0]:"td"!=t.grandparent.nodeName()?(l=o.createElement(k),t.element._4e_copyAttributes(new i(l))):l=o.createDocumentFragment();for(j=0;j<t.contents.length;j++)r=t.contents[j].clone(!0),
l.nodeType==f.DOCUMENT_FRAGMENT_NODE&&t.element._4e_copyAttributes(new i(r)),l.appendChild(r[0]);l.nodeType==f.DOCUMENT_FRAGMENT_NODE&&q!=d.length-1&&(l.lastChild&&l.lastChild.nodeType==h.NodeType.ELEMENT_NODE&&"_moz"==l.lastChild.getAttribute("type")&&h._4e_remove(l.lastChild),h._4e_appendBogus(l));l.nodeType==h.NodeType.ELEMENT_NODE&&h.nodeName(l)==k&&l.firstChild&&(h._4e_trim(l),r=l.firstChild,r.nodeType==h.NodeType.ELEMENT_NODE&&h._4e_isBlockBoundary(r)&&(r=o.createDocumentFragment(),h._4e_moveChildren(l,
r),l=r));r=h.nodeName(l);!c.ie&&("div"==r||"p"==r)&&h._4e_appendBogus(l);s.appendChild(l);r=null;q++}else return null;if(d.length<=q||Math.max(d[q].indent,0)<m)break}if(b)for(d=new i(s.firstChild);d&&d[0];)d[0].nodeType==h.NodeType.ELEMENT_NODE&&d._4e_clearMarkers(b,!0),d=d._4e_nextSourceNode();return{listNode:s,nextIndex:q}}};return a},{requires:["editor"]});
KISSY.add("editor/plugin/local-storage/index",function(e,g,i,h){if(!e.UA.ie&&window.localStorage)return window.localStorage;var f=g.Utils.debugUrl("plugin/local-storage/swfstore.swf?t="+ +new Date),c={width:215,border:"1px solid red"},a={width:0,border:"none"},d=new i({prefixCls:"ks-editor-",elStyle:{background:"white"},width:"0px",content:"<h1 style='text-align:center;'>\u8bf7\u70b9\u51fb\u5141\u8bb8</h1><div class='storage-container'></div>",zIndex:g.baseZIndex(g.zIndexManager.STORE_FLASH_SHOW)});d.render();d.show();var b=
new h({src:f,render:d.get("contentEl").one(".storage-container"),params:{flashVars:{useCompression:!0}},attrs:{height:138,width:"100%"},methods:["setItem","removeItem","getItem","setMinDiskSpace","getValueOf"]});e.ready(function(){setTimeout(function(){d.center()},0)});b.on("pending",function(){d.get("el").css(c);d.center();d.show();setTimeout(function(){b.retrySave()},1E3)});b.on("save",function(){d.get("el").css(a)});var n=b.setItem;e.mix(b,{_ke:1,getItem:function(a){return this.getValueOf(a)},
retrySave:function(){this.setItem(this.lastSave.k,this.lastSave.v)},setItem:function(a,b){this.lastSave={k:a,v:b};n.call(this,a,b)}});b.on("contentReady",function(){b._ready=1});return b},{requires:["editor","overlay","../flash-bridge/"]});
KISSY.add("editor/plugin/maximize/cmd",function(e,g){function i(a){this.editor=a}var h=e.UA,f=h.ie,c=document,a=e.Node,d=e.Event,b=e.DOM,n;e.augment(i,{restoreWindow:function(){var a=this,b=a.editor;!1!==b.fire("beforeRestoreWindow")&&a._resize&&(d.remove(window,"resize",a._resize),a._resize.stop(),a._resize=0,a._saveEditorStatus(),a._restoreState(),setTimeout(function(){a._restoreEditorStatus();b.notifySelectionChange();b.fire("afterRestoreWindow")},30))},_restoreState:function(){var a=this.editor,
d=a.get("textarea"),e=this._savedParents;if(e){for(var g=0;g<e.length;g++){var h=e[g];h.el.css("position",h.position)}this._savedParents=null}d.parent().css({height:this.iframeHeight});d.css({height:this.iframeHeight});b.css(c.body,{width:"",height:"",overflow:""});c.documentElement.style.overflow="";d=a.get("el")[0].style;d.position="static";d.width=this.editorElWidth;n.css({left:"-99999px",top:"-99999px"});window.scrollTo(this.scrollLeft,this.scrollTop);8>f&&a.get("toolBarEl").removeClass(a.get("prefixCls")+
"editor-toolbar-padding",void 0)},_saveSate:function(){var a=this.editor,d=[],c=a.get("el");this.iframeHeight=a.get("textarea").parent().style("height");this.editorElWidth=c.style("width");this.scrollLeft=b.scrollLeft();this.scrollTop=b.scrollTop();window.scrollTo(0,0);for(c=c.parent();c;){var e=c.css("position");"static"!=e&&(d.push({el:c,position:e}),c.css("position","static"));c=c.parent()}this._savedParents=d;8>f&&a.get("toolBarEl").addClass(a.get("prefixCls")+"editor-toolbar-padding",void 0)},
_saveEditorStatus:function(){var a=this.editor;this.savedRanges=null;h.gecko&&a.__iframeFocus&&(this.savedRanges=(a=a.getSelection())&&a.getRanges())},_restoreEditorStatus:function(){var a=this.editor,b=a.getSelection(),d=this.savedRanges;h.gecko&&a.activateGecko();d&&b&&b.selectRanges(d);a.__iframeFocus&&b&&(a=b.getStartElement())&&a.scrollIntoView(void 0,{alignWithTop:!1,allowHorizontalScroll:!0,onlyScrollIfNeeded:!0})},_maximize:function(a){var d=this.editor,e=d.get("el"),h=b.viewportHeight(),
i=b.viewportWidth(),m=d.get("textarea"),l=d.get("statusBarEl")?d.get("statusBarEl")[0].offsetHeight:0,d=d.get("toolBarEl")[0].offsetHeight;f?c.body.style.overflow="hidden":b.css(c.body,{width:0,height:0,overflow:"hidden"});c.documentElement.style.overflow="hidden";e.css({position:"absolute",zIndex:g.baseZIndex(g.zIndexManager.MAXIMIZE),width:i+"px"});n.css({zIndex:g.baseZIndex(g.zIndexManager.MAXIMIZE-5),height:h+"px",width:i+"px"});e.offset({left:0,top:0});n.css({left:0,top:0});m.parent().css({height:h-
l-d+"px"});m.css({height:h-l-d+"px"});!0!==a&&arguments.callee.call(this,!0)},_real:function(){var a=this,b=a.editor;a._resize||(a._saveEditorStatus(),a._saveSate(),a._maximize(),a._resize||(a._resize=e.buffer(function(){a._maximize();b.fire("afterMaximizeWindow")},100)),d.on(window,"resize",a._resize),setTimeout(function(){a._restoreEditorStatus();b.notifySelectionChange();b.fire("afterMaximizeWindow")},30))},maximizeWindow:function(){!1!==this.editor.fire("beforeMaximizeWindow")&&(n||(n=(new a("<iframe  style='position:absolute;top:-9999px;left:-9999px;' frameborder='0'>")).prependTo(c.body,
void 0)),this._real())},destroy:function(){this._resize&&(d.remove(window,"resize",this._resize),this._resize.stop(),this._resize=0)}});return{init:function(a){if(!a.hasCommand("maximizeWindow")){var b=new i(a);a.addCommand("maximizeWindow",{exec:function(){b.maximizeWindow()}});a.addCommand("restoreWindow",{exec:function(){b.restoreWindow()}})}}}},{requires:["editor"]});
KISSY.add("editor/plugin/maximize/index",function(e,g,i){function h(){}e.augment(h,{pluginRenderUI:function(e){i.init(e);e.addButton("maximize",{tooltip:"\u5168\u5c4f",listeners:{click:function(){this.get("checked")?(e.execCommand("maximizeWindow"),this.set("tooltip","\u53d6\u6d88\u5168\u5c4f"),this.set("contentCls","restore")):(e.execCommand("restoreWindow"),this.set("tooltip","\u5168\u5c4f"),this.set("contentCls","maximize"));e.focus()}},checkable:!0})}});return h},{requires:["editor","./cmd"]});
KISSY.add("editor/plugin/menubutton/index",function(e,g,i){g.prototype.addSelect=function(h,f,c){var c=c||i.Select,a=this.get("prefixCls")+"editor-";if(f&&(f.editor=this,f.menu&&(f.menu.zIndex=g.baseZIndex(g.zIndexManager.SELECT)),f.elCls))f.elCls=a+f.elCls;var d=(new c(e.mix({render:this.get("toolBarEl"),prefixCls:a},f))).render();d.get("el").unselectable();f.mode==g.WYSIWYG_MODE&&(this.on("wysiwygMode",function(){d.set("disabled",!1)}),this.on("sourceMode",function(){d.set("disabled",!0)}));this.addControl(h+
"/select",d);return d};return i},{requires:["editor","menubutton"]});KISSY.add("editor/plugin/multiple-upload/index",function(e,g,i){function h(e){this.config=e||{}}e.augment(h,{pluginRenderUI:function(e){var c=this;e.addButton("multipleUpload",{tooltip:"\u6279\u91cf\u63d2\u56fe",listeners:{click:function(){i.useDialog(e,"multiple-upload",c.config)}},mode:g.WYSIWYG_MODE})}});return h},{requires:["editor","../dialog-loader/"]});
KISSY.add("editor/plugin/ordered-list/cmd",function(e,g,i){var h=i.queryActive,f=new i.ListCommand("ol");return{init:function(c){c.hasCommand("insertOrderedList")||c.addCommand("insertOrderedList",{exec:function(a,b){a.focus();f.exec(a,b)}});var a=g.Utils.getQueryCmd("insertOrderedList");c.hasCommand(a)||c.addCommand(a,{exec:function(a){if((a=a.getSelection())&&!a.isInvalid)return a=a.getStartElement(),a=new g.ElementPath(a),h("ol",a)}})}}},{requires:["editor","../list-utils/cmd"]});
KISSY.add("editor/plugin/ordered-list/index",function(e,g,i,h){function f(){}e.augment(f,{pluginRenderUI:function(c){h.init(c);i.init(c,{cmdType:"insertOrderedList",buttonId:"orderedList",menu:{width:75,children:[{content:"1,2,3...",value:"decimal"},{content:"a,b,c...",value:"lower-alpha"},{content:"A,B,C...",value:"upper-alpha"},{content:"i,ii,iii...",value:"lower-roman"},{content:"I,II,III...",value:"upper-roman"}]},tooltip:"\u6709\u5e8f\u5217\u8868"})}});return f},{requires:["editor","../list-utils/btn","./cmd"]});
KISSY.add("editor/plugin/outdent/cmd",function(e,g,i){var h=i.addCommand,f=i.checkOutdentActive;return{init:function(c){h(c,"outdent");var a=g.Utils.getQueryCmd("outdent");c.hasCommand(a)||c.addCommand(a,{exec:function(a){if((a=a.getSelection())&&!a.isInvalid)return a=a.getStartElement(),a=new g.ElementPath(a),f(a)}})}}},{requires:["editor","../dent-utils/cmd"]});
KISSY.add("editor/plugin/outdent/index",function(e,g,i){function h(){}e.augment(h,{pluginRenderUI:function(e){i.init(e);e.addButton("outdent",{tooltip:"\u51cf\u5c11\u7f29\u8fdb\u91cf ",listeners:{click:function(){e.execCommand("outdent");e.focus()},afterSyncUI:function(){var c=this;e.on("selectionChange",function(){e.get("mode")!=g.SOURCE_MODE&&(e.queryCommandValue("outdent")?c.set("disabled",!1):c.set("disabled",!0))})}},mode:g.WYSIWYG_MODE})}});return h},{requires:["editor","./cmd"]});
KISSY.add("editor/plugin/overlay/index",function(e,g,i,h,f,c){var a=i.extend({bindUI:function(){h.init(this)}},{ATTRS:{prefixCls:{value:"ks-editor-"},zIndex:{value:g.baseZIndex(g.zIndexManager.OVERLAY)}}});a.Dialog=i.Dialog.extend({bindUI:function(){h.init(this)},show:function(){this.center();var d=this.get("y");200<d-e.DOM.scrollTop()&&(d=e.DOM.scrollTop()+200,this.set("y",d));a.prototype.show.call(this)}},{ATTRS:{prefixCls:{value:"ks-editor-"},zIndex:{value:g.baseZIndex(g.zIndexManager.OVERLAY)},
plugins:{value:[new c({handlers:[".ks-editor-stdmod-header"],plugins:[new f({constrain:window})]})]}}});return a},{requires:["editor","overlay","../focus-fix/","dd/plugin/constrain","component/plugin/drag"]});
KISSY.add("editor/plugin/page-break/index",function(e,g,i){function h(){}var f=e.Node;e.augment(h,{pluginRenderUI:function(c){i.init(c);var a=c.htmlDataProcessor;(a&&a.dataFilter).addRules({tags:{div:function(d){var b=d.getAttribute("style"),c;if(b)for(var e=d.childNodes,f=0;f<e.length;f++)1==e[f].nodeType&&(c=e[f]);if((c=c&&"span"==c.nodeName&&c.getAttribute("style"))&&/page-break-after\s*:\s*always/i.test(b)&&/display\s*:\s*none/i.test(c))return a.createFakeParserElement(d,"ke_pagebreak","div")}}});
c.addButton("pageBreak",{tooltip:"\u5206\u9875",listeners:{click:function(){var a=new f('<div style="page-break-after: always; "><span style="DISPLAY:none">&nbsp;</span></div>',null,c.get("document")[0]),a=c.createFakeElement(a,"ke_pagebreak","div",!1,'<div style="page-break-after: always; "><span style="DISPLAY:none">&nbsp;</span></div>');c.focus();var b=c.getSelection();if(b=b&&b.getRanges()[0]){c.execCommand("save");for(var e=b.startContainer,g=e;"body"!==e.nodeName();)g=e,e=e.parent();b.collapse(!0);b.splitElement(g);
a.insertAfter(g);c.execCommand("save")}}},mode:g.WYSIWYG_MODE})}});return h},{requires:["editor","../fake-objects/"]});
KISSY.add("editor/plugin/preview/index",function(e){function g(){}var i=window;e.augment(g,{pluginRenderUI:function(e){e.addButton("preview",{tooltip:"\u9884\u89c8",listeners:{click:function(){try{var f=i.screen,c=Math.round(0.8*f.width),a=Math.round(0.7*f.height),d=Math.round(0.1*f.width)}catch(b){c=640,a=420,d=80}f=e.getDocHtml().replace(/\${title}/,"\u9884\u89c8");c=i.open("","","toolbar=yes,location=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width="+c+",height="+a+",left="+d);a=c.document;a.open();a.write(f);
a.close();c.focus()}}})}});return g});
KISSY.add("editor/plugin/progressbar/index",function(e){function g(){g.superclass.constructor.apply(this,arguments);this._init()}var i=e.Node;g.ATTRS={container:{},width:{},height:{},progress:{value:0},prefixCls:{value:"ks-"}};e.extend(g,e.Base,{destroy:function(){this.detach();this.el.remove()},_init:function(){var g=this.get("height"),f=this.get("prefixCls"),c=new i(e.substitute("<div class='{prefixCls}editor-progressbar'  style='width:"+this.get("width")+";height:"+g+";'></div>",{prefixCls:f})),
a=this.get("container"),g=(new i(e.substitute("<div style='overflow:hidden;'><div class='{prefixCls}editor-progressbar-inner' style='height:"+(parseInt(g)-4)+"px'><div class='{prefixCls}editor-progressbar-inner-bg'></div></div></div>",{prefixCls:f}))).appendTo(c),f=(new i("<span class='"+f+"editor-progressbar-title'></span>")).appendTo(c);a&&c.appendTo(a);this.el=c;this._title=f;this._p=g;this.on("afterProgressChange",this._progressChange,this);this._progressChange({newVal:this.get("progress")})},
_progressChange:function(e){e=e.newVal;this._p.css("width",e+"%");this._title.html(e+"%")}});return g});
KISSY.add("editor/plugin/remove-format/cmd",function(e,g){function i(a,c){for(var d=0;d<c.length;d++)a.removeAttr(c[d])}var h=g.RANGE,f=g.ElementPath,c=e.DOM,a="class,style,lang,width,height,align,hspace,valign".split(/,/),d=RegExp("^(?:"+"b,big,code,del,dfn,em,font,i,ins,kbd,q,samp,small,span,strike,strong,sub,sup,tt,u,var,s".replace(/,/g,"|")+")$","i");return{init:function(b){b.hasCommand("removeFormat")||b.addCommand("removeFormat",{exec:function(){b.focus();d.lastIndex=0;var e=b.getSelection().getRanges();
b.execCommand("save");for(var g=0,o;o=e[g];g++)if(!o.collapsed){o.enlarge(h.ENLARGE_ELEMENT);var s=o.createBookmark(),r=s.startNode,q=s.endNode,m=function(a){for(var b=new f(a),c=b.elements,e=1,g;(g=c[e])&&!g.equals(b.block)&&!g.equals(b.blockLimit);e++)d.test(g.nodeName())&&a._4e_breakParent(g)};m(r);m(q);for(r=r._4e_nextSourceNode(!0,c.NodeType.ELEMENT_NODE,void 0,void 0);r&&!r.equals(q);)m=r._4e_nextSourceNode(!1,c.NodeType.ELEMENT_NODE,void 0,void 0),"img"==r.nodeName()&&(r.attr("_ke_realelement")||
/\bke_/.test(r[0].className))||(d.test(r.nodeName())?r._4e_remove(!0):i(r,a)),r=m;o.moveToBookmark(s)}b.getSelection().selectRanges(e);b.execCommand("save")}})}}},{requires:["editor"]});KISSY.add("editor/plugin/remove-format/index",function(e,g,i){function h(){}e.augment(h,{pluginRenderUI:function(e){i.init(e);e.addButton("removeFormat",{tooltip:"\u6e05\u9664\u683c\u5f0f",listeners:{click:function(){e.execCommand("removeFormat")}},mode:g.WYSIWYG_MODE})}});return h},{requires:["editor","./cmd","../button/"]});
KISSY.add("editor/plugin/resize/index",function(e,g,i){function h(c){this.config=c||{}}var f=e.Node;e.augment(h,{pluginRenderUI:function(c){var a=i.Draggable,d=c.get("statusBarEl");c.get("textarea");var b=this.config.direction||["x","y"],g="se-resize";1==b.length&&(g="x"==b[0]?"e-resize":"s-resize");var h=(new f("<div class='"+c.get("prefixCls")+"editor-resizer' style='cursor: "+g+"'></div>")).appendTo(d);c.on("maximizeWindow",function(){h.css("display","none")});c.on("restoreWindow",function(){h.css("display",
"")});var o=new a({node:h}),s=0,r=0,q=c.get("el"),m=c.get("el");o.on("dragstart",function(){s=q.height();r=m.width();c.fire("resizeStart")});o.on("drag",function(a){var d=a.left-this.get("startNodePos").left,a=a.top-this.get("startNodePos").top;e.inArray("y",b)&&c.set("height",s+a);e.inArray("x",b)&&c.set("width",r+d);c.fire("resize")});c.on("destroy",function(){o.destroy();h.remove()})}});return h},{requires:["editor","dd/base"]});
KISSY.add("editor/plugin/separator/index",function(e){function g(){}e.augment(g,{pluginRenderUI:function(g){e.all('<span class="'+g.get("prefixCls")+'editor-toolbar-separator">&nbsp;</span>').appendTo(g.get("toolBarEl"))}});return g},{requires:["editor"]});
KISSY.add("editor/plugin/smiley/index",function(e,g,i){function h(){}for(var f="<div class='{prefixCls}editor-smiley-sprite'>",c=0;98>=c;c++)f+="<a href='javascript:void(0)' data-icon='http://a.tbcdn.cn/sys/wangwang/smiley/48x48/"+c+".gif'></a>";f+="</div>";e.augment(h,{pluginRenderUI:function(a){var d=a.get("prefixCls");a.addButton("smiley",{tooltip:"\u63d2\u5165\u8868\u60c5",checkable:!0,listeners:{afterSyncUI:function(){var a=this;a.on("blur",function(){setTimeout(function(){a.smiley&&a.smiley.hide()},150)})},click:function(){var b=
this,c;if(b.get("checked")){if(!(c=b.smiley))c=b.smiley=(new i({content:e.substitute(f,{prefixCls:d}),focus4e:!1,width:300,elCls:d+"editor-popup",zIndex:g.baseZIndex(g.zIndexManager.POPUP_MENU),mask:!1})).render(),c.get("el").on("click",function(b){var b=new e.Node(b.target),c;if("a"==b.nodeName()&&(c=b.attr("data-icon")))c=new e.Node("<img alt='' src='"+c+"'/>",null,a.get("document")[0]),a.insertElement(c)}),c.on("hide",function(){b.set("checked",!1)});c.set("align",{node:this.get("el"),points:["bl",
"tl"],overflow:{adjustX:1,adjustY:1}});c.show()}else b.smiley&&b.smiley.hide()},destroy:function(){this.smiley&&this.smiley.destroy()}},mode:g.WYSIWYG_MODE})}});return h},{requires:["editor","../overlay/"]});
KISSY.add("editor/plugin/source-area/index",function(e,g){function i(){}var h=g.SOURCE_MODE,f=g.WYSIWYG_MODE;e.augment(i,{pluginRenderUI:function(c){c.addButton("sourceArea",{tooltip:"\u6e90\u7801",listeners:{afterSyncUI:function(){var a=this;c.on("wysiwygMode",function(){a.set("checked",!1)});c.on("sourceMode",function(){a.set("checked",!0)})},click:function(){this.get("checked")?c.set("mode",h):c.set("mode",f)}},checkable:!0})}});return i},{requires:["editor","../button/"]});
KISSY.add("editor/plugin/strike-through/cmd",function(e,g,i){var h=new g.Style({element:"del",overrides:[{element:"span",attributes:{style:"text-decoration: line-through;"}},{element:"s"},{element:"strike"}]});return{init:function(e){i.addButtonCmd(e,"strikeThrough",h)}}},{requires:["editor","../font/cmd"]});
KISSY.add("editor/plugin/strike-through/index",function(e,g,i,h){function f(){}e.augment(f,{pluginRenderUI:function(c){h.init(c);c.addButton("strikeThrough",{cmdType:"strikeThrough",tooltip:"\u5220\u9664\u7ebf "},i.Button)}});return f},{requires:["editor","../font/ui","./cmd"]});
KISSY.add("editor/plugin/table/index",function(e,g,i){function h(a){function b(a){!(0<e.length)&&a[0].nodeType==q.NodeType.ELEMENT_NODE&&t.test(a.nodeName())&&!a.data("selected_cell")&&(a._4e_setMarker(f,"selected_cell",!0,void 0),e.push(a))}for(var c=a.createBookmarks(),d=a.getRanges(),e=[],f={},h=0;h<d.length;h++){var i=d[h];if(i.collapsed)i=i.getCommonAncestor(),(i=i.closest("td",void 0)||i.closest("th",void 0))&&e.push(i);else{var i=new Walker(i),j;for(i.guard=b;j=i.next();)if((j=j.parent())&&
t.test(j.nodeName())&&!j.data("selected_cell"))j._4e_setMarker(f,"selected_cell",!0,void 0),e.push(j)}}g.Utils.clearAllMarkers(f);a.selectBookmarks(c);return e}function f(a,b){var c=a.getStartElement().parent("tr");if(c){var d=c.clone(!0);d.insertBefore(c);c=(b?d[0]:c[0]).cells;for(d=0;d<c.length;d++)c[d].innerHTML="",r.ie||(new m(c[d]))._4e_appendBogus(void 0)}}function c(a){if(a instanceof g.Selection){for(var b=h(a),d=b.length,a=[],e,f,i=0;i<d;i++){var j=b[i].parent(),k=j[0].rowIndex;!i&&(e=k-
1);a[k]=j;i==d-1&&(f=k+1)}i=j.parent("table");e=new m(f<i[0].rows.length&&i[0].rows[f]||0<e&&i[0].rows[e]||i[0].parentNode);for(i=a.length;0<=i;i--)a[i]&&c(a[i]);return e}a instanceof m&&(i=a.parent("table"),1==i[0].rows.length?i.remove():a.remove());return 0}function a(a,b){var c=a.getStartElement();if(c=c.closest("td",void 0)||c.closest("th",void 0))for(var d=c.parent("table"),e=c[0].cellIndex,f=0;f<d[0].rows.length;f++){var g=d[0].rows[f];g.cells.length<e+1||(c=new m(g.cells[e].cloneNode(void 0)),
r.ie||c._4e_appendBogus(void 0),g=new m(g.cells[e]),b?c.insertBefore(g):c.insertAfter(g))}}function d(a){if(a instanceof g.Selection){var b=h(a),e,f=[],a=b[0]&&b[0].parent("table"),i,j,k;i=0;for(j=b.length;i<j;i++)f.push(b[i][0].cellIndex);f.sort();i=1;for(j=f.length;i<j;i++)if(1<f[i]-f[i-1]){k=f[i-1]+1;break}k||(k=0<f[0]?f[0]-1:f[f.length-1]+1);f=a[0].rows;i=0;for(j=f.length;i<j&&!(e=f[i].cells[k]);i++);e=e?new m(e):a.prev();for(k=b.length-1;0<=k;k--)b[k]&&d(b[k]);return e}if(a instanceof m){b=a.parent("table");
if(!b)return null;e=a[0].cellIndex;for(k=b[0].rows.length-1;0<=k;k--)a=new m(b[0].rows[k]),!e&&1==a[0].cells.length?c(a):a[0].cells[e]&&a[0].removeChild(a[0].cells[e])}return null}function b(a,b){var c=new g.Range(a[0].ownerDocument);if(!c.moveToElementEditablePosition(a,b?!0:void 0))c.selectNodeContents(a),c.collapse(b?!1:!0);c.select(!0)}function n(a){var b=(a=a.getSelection())&&a.getStartElement(),c=b&&b.closest("table",void 0);if(c)return a=b.closest(function(a){var b=q.nodeName(a);return c.contains(a)&&
("td"==b||"th"==b)},void 0),b=b.closest(function(a){var b=q.nodeName(a);return c.contains(a)&&"tr"==b},void 0),{table:c,td:a,tr:b}}function k(a){return(a=n(a))&&a.td}function o(a){return(a=n(a))&&a.tr}function s(a){this.config=a||{}}var r=e.UA,q=e.DOM,m=e.Node,l=["tr","th","td","tbody","table"],t=/^(?:td|th)$/,j={"\u8868\u683c\u5c5e\u6027":n,"\u5220\u9664\u8868\u683c":k,"\u5220\u9664\u5217":k,"\u5220\u9664\u884c":o,"\u5728\u4e0a\u65b9\u63d2\u5165\u884c":o,"\u5728\u4e0b\u65b9\u63d2\u5165\u884c":o,"\u5728\u5de6\u4fa7\u63d2\u5165\u5217":k,"\u5728\u53f3\u4fa7\u63d2\u5165\u5217":k},u=(6===r.ie?["table.%2,","table.%2 td, table.%2 th,","{","border : #d3d3d3 1px dotted","}"]:" table.%2,; table.%2 > tr > td,  table.%2 > tr > th,; table.%2 > tbody > tr > td,  table.%2 > tbody > tr > th,; table.%2 > thead > tr > td,  table.%2 > thead > tr > th,; table.%2 > tfoot > tr > td,  table.%2 > tfoot > tr > th;{;border : #d3d3d3 1px dotted;}".split(";")).join("").replace(/%2/g,
"ke_show_border"),p={tags:{table:function(a){var b=a.getAttribute("class"),c=parseInt(a.getAttribute("border"),10);if(!c||0>=c)a.setAttribute("class",e.trim((b||"")+" ke_show_border"))}}},y={tags:{table:function(a){var b=a.getAttribute("class");b&&((b=e.trim(b.replace("ke_show_border","")))?a.setAttribute("class",b):a.removeAttribute("class"))}}};e.augment(s,{pluginRenderUI:function(h){h.addCustomStyle(u);var k=h.htmlDataProcessor,m=k&&k.htmlFilter;(k&&k.dataFilter).addRules(p);m.addRules(y);var o=
this,r={"\u8868\u683c\u5c5e\u6027":function(){this.hide();var a=n(h);a&&i.useDialog(h,"table",o.config,{selectedTable:a.table,selectedTd:a.td})},"\u5220\u9664\u8868\u683c":function(){this.hide();var a=h.getSelection(),b=a&&a.getStartElement();if(b=b&&b.closest("table",void 0)){h.execCommand("save");a.selectElement(b);var c=a.getRanges()[0];c.collapse();a.selectRanges([c]);a=b.parent();1==a[0].childNodes.length&&"body"!=a.nodeName()&&"td"!=a.nodeName()?a.remove():b.remove();h.execCommand("save")}},"\u5220\u9664\u884c ":function(){this.hide();h.execCommand("save");
var a=h.getSelection();b(c(a),void 0);h.execCommand("save")},"\u5220\u9664\u5217 ":function(){this.hide();h.execCommand("save");var a=h.getSelection();(a=d(a))&&b(a,!0);h.execCommand("save")},"\u5728\u4e0a\u65b9\u63d2\u5165\u884c":function(){this.hide();h.execCommand("save");var a=h.getSelection();f(a,!0);h.execCommand("save")},"\u5728\u4e0b\u65b9\u63d2\u5165\u884c":function(){this.hide();h.execCommand("save");var a=h.getSelection();f(a,void 0);h.execCommand("save")},"\u5728\u5de6\u4fa7\u63d2\u5165\u5217":function(){this.hide();h.execCommand("save");var b=h.getSelection();a(b,!0);h.execCommand("save")},
"\u5728\u53f3\u4fa7\u63d2\u5165\u5217":function(){this.hide();h.execCommand("save");var b=h.getSelection();a(b,void 0);h.execCommand("save")}},s=[];e.each(r,function(a,b){s.push({content:b})});h.addContextMenu("table",function(a){if(e.inArray(q.nodeName(a),l))return!0},{width:"120px",children:s,listeners:{click:function(a){a=a.target.get("content");r[a]&&r[a].apply(this)},beforeVisibleChange:function(a){if(a.newVal){var b=this,a=b.get("children"),c=b.get("editor");e.each(a,function(a){var d=a.get("content");!j[d]||j[d].call(b,
c)?a.set("disabled",!1):a.set("disabled",!0)})}}}});h.addButton("table",{mode:g.WYSIWYG_MODE,listeners:{click:function(){i.useDialog(h,"table",o.config,{selectedTable:0,selectedTd:0})}},tooltip:"\u63d2\u5165\u8868\u683c"})}});return s},{requires:["editor","../dialog-loader/","../contextmenu/"]});
KISSY.add("editor/plugin/underline/cmd",function(e,g,i){var h=new g.Style({element:"u",overrides:[{element:"span",attributes:{style:"text-decoration: underline;"}}]});return{init:function(e){i.addButtonCmd(e,"underline",h)}}},{requires:["editor","../font/cmd"]});
KISSY.add("editor/plugin/underline/index",function(e,g,i,h){function f(){}e.augment(f,{pluginRenderUI:function(c){h.init(c);c.addButton("underline",{cmdType:"underline",tooltip:"\u4e0b\u5212\u7ebf "},i.Button);c.docReady(function(){c.get("document").on("keydown",function(a){a.ctrlKey&&a.keyCode==e.Node.KeyCodes.U&&(c.execCommand("underline"),a.preventDefault())})})}});return f},{requires:["editor","../font/ui","./cmd"]});
KISSY.add("editor/plugin/undo/btn",function(e,g,i){e=i.extend({bindUI:function(){var e=this,f=e.get("editor");e.on("click",function(){f.execCommand("undo")});f.on("afterUndo afterRedo afterSave",function(c){0<c.index?e.set("disabled",!1):e.set("disabled",!0)})}},{ATTRS:{mode:{value:g.WYSIWYG_MODE},disabled:{value:!0}}});return{RedoBtn:i.extend({bindUI:function(){var e=this,f=e.get("editor");e.on("click",function(){f.execCommand("redo")});f.on("afterUndo afterRedo afterSave",function(c){c.index<c.history.length-
1?e.set("disabled",!1):e.set("disabled",!0)})}},{mode:{value:g.WYSIWYG_MODE},ATTRS:{disabled:{value:!0}}}),UndoBtn:e}},{requires:["editor","../button/"]});
KISSY.add("editor/plugin/undo/cmd",function(e,g){function i(a){var c=a.get("document")[0].body.innerHTML,d;c&&(d=a.getSelection());this.contents=c;this.bookmarks=d&&d.createBookmarks2(!0)}function h(a){this.history=[];this.index=-1;this.editor=a;this.bufferRunner=e.buffer(this.save,500,this);this._init()}var f=g.Utils.arrayCompare,c=e.UA;e.augment(i,{equals:function(a){if(this.contents!=a.contents)return!1;var c=this.bookmarks,a=a.bookmarks;if(c||a){if(!c||!a||c.length!=a.length)return!1;for(var d=
0;d<c.length;d++){var e=c[d],g=a[d];if(e.startOffset!=g.startOffset||e.endOffset!=g.endOffset||!f(e.start,g.start)||!f(e.end,g.end))return!1}}return!0}});var a={16:1,17:1,18:1},d={37:1,38:1,39:1,40:1,33:1,34:1};e.augment(h,{_keyMonitor:function(){var b=this,c=b.editor;c.docReady(function(){c.get("document").on("keydown",function(e){var f=e.keyCode;f in d||f in a||(90===f&&(e.ctrlKey||e.metaKey)?(!1!==c.fire("beforeRedo")&&b.restore(-1),e.halt()):89===f&&(e.ctrlKey||e.metaKey)?(!1!==c.fire("beforeUndo")&&
b.restore(1),e.halt()):!1!==c.fire("beforeSave",{buffer:1})&&b.save(1))})})},_init:function(){var a=this;a._keyMonitor();setTimeout(function(){a.save()},0)},save:function(a){var c=this.editor;if(c.get("mode")==g.WYSIWYG_MODE&&c.get("document"))if(a)this.bufferRunner();else{var a=this.history,d=this.index;a.length>d+1&&a.splice(d+1,a.length-d-1);var d=a[a.length-1],e=new i(c);if(!d||!d.equals(e))30===a.length&&a.shift(),a.push(e),this.index=d=a.length-1,c.fire("afterSave",{history:a,index:d})}},restore:function(a){if(this.editor.get("mode")==
g.WYSIWYG_MODE){var d=this.history,e=this.editor,f=e.get("document")[0].body,h=d[this.index+a];h&&(f.innerHTML=h.contents,h.bookmarks?e.getSelection().selectBookmarks(h.bookmarks):c.ie&&(f=f.createTextRange(),f.collapse(!0),f.select()),(f=e.getSelection())&&f.scrollIntoView(),this.index+=a,e.fire(0<a?"afterUndo":"afterRedo",{history:d,index:this.index}),e.notifySelectionChange());return h}}});return{init:function(a){if(!a.hasCommand("save")){var c=new h(a);a.addCommand("save",{exec:function(d,e){a.focus();
c.save(e)}});a.addCommand("undo",{exec:function(){a.focus();c.restore(-1)}});a.addCommand("redo",{exec:function(){a.focus();c.restore(1)}})}}}},{requires:["editor"]});KISSY.add("editor/plugin/undo/index",function(e,g,i,h){function f(){}e.augment(f,{pluginRenderUI:function(c){h.init(c);c.addButton("undo",{mode:g.WYSIWYG_MODE,tooltip:"\u64a4\u9500",editor:c},i.UndoBtn);c.addButton("redo",{mode:g.WYSIWYG_MODE,tooltip:"\u91cd\u505a",editor:c},i.RedoBtn)}});return f},{requires:["editor","./btn","./cmd"]});
KISSY.add("editor/plugin/unordered-list/cmd",function(e,g,i){var h=i.queryActive,f=new i.ListCommand("ul");return{init:function(c){c.hasCommand("insertUnorderedList")||c.addCommand("insertUnorderedList",{exec:function(a,b){a.focus();f.exec(a,b)}});var a=g.Utils.getQueryCmd("insertUnorderedList");c.hasCommand(a)||c.addCommand(a,{exec:function(a){if((a=a.getSelection())&&!a.isInvalid)return a=a.getStartElement(),a=new g.ElementPath(a),h("ul",a)}})}}},{requires:["editor","../list-utils/cmd"]});
KISSY.add("editor/plugin/unordered-list/index",function(e,g,i,h){function f(){}e.augment(f,{pluginRenderUI:function(c){h.init(c);i.init(c,{cmdType:"insertUnorderedList",buttonId:"unorderedList",menu:{width:75,children:[{content:"\u25cf \u5706\u70b9",value:"disc"},{content:"\u25cb \u5706\u5708",value:"circle"},{content:"\u25a0 \u65b9\u5757",value:"square"}]},tooltip:"\u65e0\u5e8f\u5217\u8868"})}});return f},{requires:["editor","../list-utils/btn","./cmd"]});
KISSY.add("editor/plugin/video/index",function(e,g,i,h,f){function c(a){this.config=a}e.augment(c,{pluginRenderUI:function(a){function c(a){for(var b=0;b<k.length;b++){var d=k[b];if(d.reg.test(a))return d}}f.init(a);var b=a.htmlDataProcessor,e=b&&b.dataFilter,k=[],o=this.config;o.providers&&k.push.apply(k,o.providers);o.getProvider=c;e&&e.addRules({tags:{object:function(a){var e=a.getAttribute("classid"),f=a.childNodes;if(!e){for(e=0;e<f.length;e++)if("embed"==f[e].nodeName){if(!i.isFlashEmbed(f[e]))break;
if(c(f[e].getAttribute("src")))return b.createFakeParserElement(a,"ke_video","video",!0)}return null}for(e=0;e<f.length;e++){var g=f[e];if("param"==g.nodeName&&"movie"==g.getAttribute("name").toLowerCase()&&c(g.getAttribute("value")||g.getAttribute("VALUE")))return b.createFakeParserElement(a,"ke_video","video",!0)}},embed:function(a){if(!i.isFlashEmbed(a))return null;if(c(a.getAttribute("src")))return b.createFakeParserElement(a,"ke_video","video",!0)}}},4);var s=new h({editor:a,cls:"ke_video",type:"video",
pluginConfig:this.config,bubbleId:"video",contextMenuId:"video",contextMenuHandlers:{"\u89c6\u9891\u5c5e\u6027":function(){var a=this.get("editorSelectedEl");a&&s.show(a)}}});a.addButton("video",{tooltip:"\u63d2\u5165\u89c6\u9891",listeners:{click:function(){s.show()}},mode:g.WYSIWYG_MODE})}});return c},{requires:["editor","../flash-common/utils","../flash-common/baseClass","../fake-objects/"]});
KISSY.add("editor/plugin/xiami-music/index",function(e,g,i,h,f){function c(){c.superclass.constructor.apply(this,arguments)}function a(a){this.config=a||{}}e.extend(c,i,{_updateTip:function(a,b){var c=this.get("editor").restoreRealElement(b);c&&(a.html(b.attr("title")),a.attr("href",this._getFlashUrl(c)))}});e.augment(a,{pluginRenderUI:function(a){function b(a){return/xiami\.com/i.test(a)}f.init(a);var e=a.htmlDataProcessor,i=e&&e.dataFilter;i&&i.addRules({tags:{object:function(a){var c=a.getAttribute("title"),
d,f;d=a.getAttribute("classid");var g=a.childNodes;if(!d){for(d=0;d<g.length;d++)if(f=g[d],"embed"==f.nodeName){if(!h.isFlashEmbed(f))break;if(b(f.attributes.src))return e.createFakeParserElement(a,"ke_xiami","xiami-music",!0,{title:c})}return null}for(d=0;d<g.length;d++)if(f=g[d],"param"==f.nodeName&&"movie"==f.getAttribute("name").toLowerCase()&&b(f.getAttribute("value")||f.getAttribute("VALUE")))return e.createFakeParserElement(a,"ke_xiami","xiami-music",!0,{title:c})},embed:function(a){if(h.isFlashEmbed(a)&&
b(a.getAttribute("src")))return e.createFakeParserElement(a,"ke_xiami","xiami-music",!0,{title:a.getAttribute("title")})}}},4);var o=new c({editor:a,cls:"ke_xiami",type:"xiami-music",bubbleId:"xiami",pluginConfig:this.config,contextMenuId:"xiami",contextMenuHandlers:{"\u867e\u7c73\u5c5e\u6027":function(){var a=this.get("editorSelectedEl");a&&o.show(a)}}});a.addButton("xiamiMusic",{tooltip:"\u63d2\u5165\u867e\u7c73\u97f3\u4e50",listeners:{click:function(){o.show()}},mode:g.WYSIWYG_MODE})}});return a},{requires:["editor","../flash-common/baseClass",
"../flash-common/utils","../fake-objects/"]});KISSY.add("editor/full",function(e,g){return g},{requires:["editor"]});
