KISSY.Editor.add("removeformat",function(l){l.addPlugin("removeformat",function(){function q(b,d){for(var c=0;c<d.length;c++)b.removeAttr(d[c])}var g=KISSY.Editor,r=g.RANGE,s=g.ElementPath,m=g.NODE,t="class,style,lang,width,height,align,hspace,valign".split(/,/),i=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"),v=l.addButton("removeformat",{title:"\u6e05\u9664\u683c\u5f0f",mode:g.WYSIWYG_MODE,contentCls:"ke-toolbar-removeformat",offClick:function(){var b=
this.editor;b.focus();i.lastIndex=0;var d=b.getSelection().getRanges();b.fire("save");for(var c=0,e;e=d[c];c++)if(!e.collapsed){e.enlarge(r.ENLARGE_ELEMENT);var j=e.createBookmark(),a=j.startNode,n=j.endNode,h=function(o){for(var k=new s(o),u=k.elements,p=1,f;f=u[p];p++){if(f._4e_equals(k.block)||f._4e_equals(k.blockLimit))break;i.test(f._4e_name())&&o._4e_breakParent(f)}};h(a);h(n);for(a=a._4e_nextSourceNode(true,m.NODE_ELEMENT);a;){if(a._4e_equals(n))break;h=a._4e_nextSourceNode(false,m.NODE_ELEMENT);
a._4e_name()=="img"&&a.attr("_ke_realelement")||(i.test(a._4e_name())?a._4e_remove(true):q(a,t));a=h}e.moveToBookmark(j)}b.getSelection().selectRanges(d);b.fire("save")}});this.destroy=function(){v.destroy()}})},{attach:false});
