editor-para-min.js revision 216633e2ad28e9568a902f3763c3bef052c5f908
YUI.add("editor-para",function(F){var C=function(){C.superclass.constructor.apply(this,arguments);},B="host",D="body",A="nodeChange",E=D+" > p";F.extend(C,F.Base,{_fixFirstPara:function(){var G=this.get(B),I=G.getInstance(),H;I.one("body").set("innerHTML","<p>"+I.Selection.CURSOR+"</p>");H=new I.Selection();H.focusCursor(true,false);},_onNodeChange:function(L){var M=this.get(B),J=M.getInstance();switch(L.changedType){case"keydown":if(J.config.doc.childNodes.length<2){var P=J.config.doc.body.innerHTML;if(P&&P.length<5&&P.toLowerCase()=="<br>"){this._fixFirstPara();}}break;case"backspace-up":case"backspace-down":case"delete-up":if(!F.UA.ie){var G=J.all(E),O,N,K,I,H;N=J.one(D);if(G.item(0)){N=G.item(0);}O=N.one("br");if(O){O.removeAttribute("id");O.removeAttribute("class");}I=J.Selection.getText(N);I=I.replace(/ /g,"").replace(/\n/g,"");if(I.length===0){if(!N.test("p")){this._fixFirstPara();}H=null;if(L.changedNode&&L.changedNode.test("p")){H=L.changedNode;}if(!H&&M._lastPara&&M._lastPara.inDoc()){H=M._lastPara;}if(H&&!H.test("p")){H=H.ancestor("p");}if(H){if(!H.previous()){L.changedEvent.frameEvent.halt();}}}}break;}},_afterEditorReady:function(){var G=this.get(B),H=G.getInstance();if(H){H.Selection.filterBlocks();}},_afterContentChange:function(){var G=this.get(B),H=G.getInstance();if(H&&H.Selection){H.Selection.filterBlocks();}},_afterPaste:function(){var G=this.get(B),I=G.getInstance(),H=new I.Selection();F.later(50,G,function(){I.Selection.filterBlocks();});},initializer:function(){var G=this.get(B);G.on(A,F.bind(this._onNodeChange,this));G.after("ready",F.bind(this._afterEditorReady,this));G.after("contentChange",F.bind(this._afterContentChange,this));if(F.Env.webkit){G.after("dom:paste",F.bind(this._afterPaste,this));}}},{NAME:"editorPara",NS:"editorPara",ATTRS:{host:{value:false}}});F.namespace("Plugin");F.Plugin.EditorPara=C;},"@VERSION@",{requires:["editor-base","selection"],skinnable:false});