1 line
21 KiB
JavaScript
1 line
21 KiB
JavaScript
Type.registerNamespace("Sys.Extended.UI.HtmlEditor");Sys.Extended.UI.HtmlEditor.DesignPanelEventHandler=function(n){var t,ui,vt,yt,fi,w,di,ei,pt,ct,nt,rt,u,si,hi,vi,y,ft,kt,dt,nr,c,a,et,g,it,ot,e,tt,ni,ti,pi,o,at,l,ri,h,ii,st,f,i;try{if(t=this,t._editPanel!=Sys.Extended.UI.HtmlEditor.LastFocusedEditPanel)return!0;if(Sys.Extended.UI.HtmlEditor.isIE)try{ui=this._doc.selection;fi=this._createRange(ui)}catch(ur){return Sys.Extended.UI.HtmlEditor._stopEvent(n),!1}if((n.type=="mousedown"||n.type=="dblclick")&&this._focus(!0),!Sys.Extended.UI.HtmlEditor.isIE&&n.type=="keydown"&&n.keyCode==Sys.UI.Key.tab&&this._editPanel.get_suppressTabInDesignMode())return Sys.Extended.UI.HtmlEditor.LastFocusedEditPanel=null,!0;if(this.isPopup())return Sys.Extended.UI.HtmlEditor._stopEvent(n),!1;if(vt=!1,t._contextElement&&t._contextElement!=null){if(Function.createDelegate(this,Sys.Extended.UI.HtmlEditor.RemoveContextMenu)(),n.type=="keydown"||n.type=="keypress"){Sys.Extended.UI.HtmlEditor._stopEvent(n);return}vt=!0}if(typeof t.captureInDesign=="function"&&t.captureInDesign(n)===!1){Sys.Extended.UI.HtmlEditor._stopEvent(n);return}if(Sys.Extended.UI.HtmlEditor.isIE&&n.type=="mousedown"&&n.ctrlKey){var f=t._getSelection(),bi=n.clientX,ki=n.clientY;return setTimeout(function(){var r=t._getSelection(),i,n;for(r.type.toLowerCase()!="control"&&(i=t._doc.body.createTextRange(),i.moveToPoint(bi,ki),i.select()),r=t._getSelection(),i=t._createRange(r),n=Sys.Extended.UI.HtmlEditor.getSelParent(t);n!=null&&n.tagName.toUpperCase()!="BODY";){if(n.tagName.toUpperCase()=="A"&&n.href!=null&&typeof n.href!="undefined"&&n.href.length>0){window.open(n.href,"LinkViewWindow");break}n=n.parentNode}},0),Sys.Extended.UI.HtmlEditor._stopEvent(n),!1}if(u=Sys.Extended.UI.HtmlEditor.isIE?n.srcElement:n.target,u.tagName!=null&&typeof u.tagName!="undefined"&&(u.tagName.toUpperCase()=="HTML"||u.tagName.toUpperCase()=="BODY")?t.__kkoka!=!0&&(t.__kkoka=!0,setTimeout(function(){if(t._editPanel==Sys.Extended.UI.HtmlEditor.LastFocusedEditPanel&&!t.toEndOfProtected())try{t.focusEditor()}catch(n){}t.__kkoka=!1},0)):Sys.Extended.UI.HtmlEditor.contentEditable(u)!=null&&setTimeout(function(){t._editPanel==Sys.Extended.UI.HtmlEditor.LastFocusedEditPanel&&t.toEndOfProtected()},0),vt&&Sys.Extended.UI.HtmlEditor.isIE){yt=this._getSelection();try{if(fi=this._createRange(yt),yt.type.toLowerCase()=="control")return Sys.Extended.UI.HtmlEditor._stopEvent(n),!1}catch(fr){return Sys.Extended.UI.HtmlEditor._stopEvent(n),!1}}if(w=Sys.Extended.UI.HtmlEditor.isIE&&n.type=="keydown"||n.type=="keypress",di=n.type+"--"+w,w&&!this._editPanel.get_keyboardEnabled())return Sys.Extended.UI.HtmlEditor._stopEvent(n),!1;if(o=String.fromCharCode(Sys.Extended.UI.HtmlEditor.isIE?n.keyCode:n.charCode).toLowerCase(),w&&t._editPanel.get_hotkeys()!=null&&t._editPanel.get_hotkeys().length>0)for(ei=t._editPanel.get_hotkeys().length,pt=o,(n.keyCode==18||n.keyCode==17||n.keyCode==16)&&(pt=null),ct=0;ct<ei;ct++)if(nt=t._editPanel.get_hotkeys()[ct],nt[1]==pt&&nt[2]==n.altKey&&nt[3]==n.shiftKey&&nt[4]==n.ctrlKey)return typeof nt[0]=="function"&&setTimeout(function(){nt[0](t);t.onContentChanged();t.focusEditor()},0),Sys.Extended.UI.HtmlEditor._stopEvent(n),!1;if(w&&n.shiftKey&&n.keyCode==45)this._commonPaste(n);else if(w&&n.ctrlKey&&n.altKey&&n.keyCode==Sys.UI.Key.home){for(rt=null,u=Sys.Extended.UI.HtmlEditor.getSelParent(t);u&&(u.nodeType==3||u.tagName&&u.tagName.toUpperCase()!="BODY");){if(u.nodeType==3||!u.tagName){u=u.parentNode;continue}if(a=u.tagName.toUpperCase(),!Sys.Extended.UI.HtmlEditor.canBeInsideP(u)&&a!="P"){if(a=="TD")while(a!="TABLE")u=u.parentNode,a=u.tagName.toUpperCase();else if(a=="LI")while(a!="OL"&&a!="UL")u=u.parentNode,a=u.tagName.toUpperCase();rt=u;break}u=u.parentNode}if(rt!=null){var f=t._getSelection(),i=t._createRange(f),v=t._doc.createTextNode("");if(rt.parentNode.insertBefore(v,rt),Sys.Extended.UI.HtmlEditor.isIE){var wt=t._createRange(f),oi=t._createRange(f),bt=t._doc.createElement("span"),lt=t._doc.createElement("span");v.parentNode.insertBefore(bt,v);v.nextSibling?v.parentNode.insertBefore(lt,v.nextSibling):v.parentNode.appendChild(lt);try{wt.moveToElementText(bt);oi.moveToElementText(lt);wt.setEndPoint("EndToEnd",oi);wt.select()}catch(ur){}v.parentNode.removeChild(bt);v.parentNode.removeChild(lt)}else t._removeAllRanges(f),i.setStart(v,0),i.setEnd(v,0),t._selectRange(f,i)}}else if(Sys.Extended.UI.HtmlEditor.isIE&&n.keyCode>=33&&n.keyCode<=40&&!n.shiftKey)si=n.keyCode==Sys.UI.Key.pageDown||n.keyCode==Sys.UI.Key.end||n.keyCode==Sys.UI.Key.right||n.keyCode==Sys.UI.Key.down,setTimeout(function(){var u=t._getSelection(),r=t._createRange(u),n,i;u.type.toLowerCase()=="control"&&(n=r.item(0),n.contentEditable&&n.contentEditable!="false"||(r.remove(0),u.empty(),r=t._createRange(u),i=t._doc.createElement("SPAN"),i.appendChild(t._doc.createTextNode("")),si?n.nextSibling==null?n.parentNode.appendChild(i):n.parentNode.insertBefore(i,n.nextSibling):n.parentNode.insertBefore(i,n),r.moveToElementText(i),r.select(),setTimeout(function(){t.focusEditor();i.parentNode.removeChild(i)},0)))},0);else if((w&&!Sys.Extended.UI.HtmlEditor.isSafari||Sys.Extended.UI.HtmlEditor.isSafari&&n.type=="keydown")&&n.ctrlKey&&!n.altKey){t._a_prize=!1;var f=null,i=null,o=String.fromCharCode(Sys.Extended.UI.HtmlEditor.isIE||Sys.Extended.UI.HtmlEditor.isOpera||Sys.Extended.UI.HtmlEditor.isSafari?n.keyCode:n.charCode).toLowerCase(),p=null,ut=null;if((Sys.Extended.UI.HtmlEditor.isIE||Sys.Extended.UI.HtmlEditor.isSafari)&&n.keyCode==17)return!1;if(Sys.Extended.UI.HtmlEditor.isIE||n.keyCode!=Sys.UI.Key.end||n.shiftKey){if(n.keyCode==46&&this.isShadowed())return Sys.Extended.UI.HtmlEditor._stopEvent(n),!1;if(n.keyCode==46||n.keyCode==Sys.UI.Key.backspace)(Sys.Extended.UI.HtmlEditor.isIE&&n.type=="keydown"||!Sys.Extended.UI.HtmlEditor.isIE&&n.type=="keypress")&&this._saveContent();else switch(o){case"a":if(Sys.Extended.UI.HtmlEditor.isIE)t._a_prize=!0;else return f=this._getSelection(),this._removeAllRanges(f),i=this._createRange(),i.selectNodeContents(this._doc.body),this._selectRange(f,i),Sys.Extended.UI.HtmlEditor._stopEvent(n),!1;break;case"z":return this.undo(),Sys.Extended.UI.HtmlEditor._stopEvent(n),!1;case"p":if(!Sys.Extended.UI.HtmlEditor.isIE)return setTimeout(function(){t._contextMenuCallP()},0),Sys.Extended.UI.HtmlEditor._stopEvent(n),!1;break;case"y":return this.redo(),Sys.Extended.UI.HtmlEditor._stopEvent(n),!1;case"x":if(this.isShadowed())return Sys.Extended.UI.HtmlEditor._stopEvent(n),!1;if(this._saveContent(),Sys.Extended.UI.HtmlEditor.isIE&&n.type=="keydown")return t.openWait(),setTimeout(function(){t._copyCut(o,!1);t.closeWait()},0),Sys.Extended.UI.HtmlEditor._stopEvent(n),!1;break;case"c":if(this.isShadowed())return Sys.Extended.UI.HtmlEditor._stopEvent(n),!1;if(Sys.Extended.UI.HtmlEditor.isIE&&n.type=="keydown")return t.openWait(),setTimeout(function(){t._copyCut(o,!1);t.closeWait();setTimeout(function(){t._ifShadow()},0)},0),Sys.Extended.UI.HtmlEditor._stopEvent(n),!1;break;case"v":if(this.isShadowed())return Sys.Extended.UI.HtmlEditor._stopEvent(n),!1;if(Sys.Extended.UI.HtmlEditor.isIE)return this._saveContent(),!0;this._commonPaste(n);break;case"b":return this._execCommand("bold",!1,ut),Sys.Extended.UI.HtmlEditor._stopEvent(n),!1;case"i":return this._execCommand("italic",!1,ut),Sys.Extended.UI.HtmlEditor._stopEvent(n),!1;case"u":return this._execCommand("underline",!1,ut),Sys.Extended.UI.HtmlEditor._stopEvent(n),!1;case"s":return this._execCommand("strikethrough",!1,ut),Sys.Extended.UI.HtmlEditor._stopEvent(n),!1;case"l":p="justifyleft";break;case"e":p="justifycenter";break;case"r":p="justifyright";break;case"j":p="justifyfull";break;case"q":return alert(this._doc.body.innerHTML),Sys.Extended.UI.HtmlEditor._stopEvent(n),!1;case"0":return hi="Your browser:\n\n"+navigator.userAgent,alert(hi),Sys.Extended.UI.HtmlEditor._stopEvent(n),!1;case"9":if(Sys.Extended.UI.HtmlEditor.isIE)f=t._getSelection(),i=t._createRange(f),alert("boundingLeft: "+i.boundingLeft+" boundingTop: "+i.boundingTop+"\nboundingWidth: "+i.boundingWidth+" boundingHeight: "+i.boundingHeight);else{var f=t._getSelection(),i=t._createRange(f),r=i.startContainer,b=i.endContainer,k="";k+="startContainer: "+(r.nodeType==1?r.tagName:"text")+"\n";k+="endContainer : "+(b.nodeType==1?b.tagName:"text")+"\n";r==b&&(k+="startOffset: "+i.startOffset+"\n",k+="endOffset : "+i.endOffset+"\n",r.nodeType==1&&(r=r.childNodes.item(i.startOffset),r&&r.nodeType?(k+="startOffset node: "+(r.nodeType==1?r.tagName:"text")+"\n",i.startOffset!=i.endOffset&&(r=b.childNodes.item(i.endOffset),r&&r.nodeType&&(k+="endOffset node: "+(r.nodeType==1?r.tagName:"text")+"\n"))):k+=r));alert(k)}return Sys.Extended.UI.HtmlEditor._stopEvent(n),!1}}else t._setToEnd();p&&(this._execCommand(p,!1,ut),p!="formatblock"||Sys.Extended.UI.HtmlEditor.isIE||(this._saveContent(),this._undo(!1)),Sys.Extended.UI.HtmlEditor._stopEvent(n),(p=="delete"||p=="paste")&&this._clearP())}else if(w||(Sys.Extended.UI.HtmlEditor.isSafari||Sys.Extended.UI.HtmlEditor.isOpera)&&n.type=="keydown"){if(Sys.Extended.UI.HtmlEditor.isIE&&this._tryForward&&(i=this._createRange(this._getSelection()),i.select(),this._tryForward=!1),o=String.fromCharCode(Sys.Extended.UI.HtmlEditor.isIE?n.keyCode:n.charCode).toLowerCase(),t._a_prize){t._a_prize=!1;function gi(){var i=t._createRange(t._getSelection()),n=i.parentElement();if(n&&n.nodeType==1&&n.tagName.toUpperCase()=="P"){while(n.firstChild)n.parentNode.insertBefore(n.firstChild,n);n.parentNode.removeChild(n)}}setTimeout(gi,0)}if(this.isShadowed())return Sys.Extended.UI.HtmlEditor._stopEvent(n),!1;switch(n.keyCode){case Sys.UI.Key.tab:if((Sys.Extended.UI.HtmlEditor.isSafari||Sys.Extended.UI.HtmlEditor.isOpera)&&n.type!="keydown")break;if(this._editPanel.get_suppressTabInDesignMode())return Sys.Extended.UI.HtmlEditor.isSafari&&Sys.Extended.UI.HtmlEditor._stopEvent(n),Sys.Extended.UI.HtmlEditor.LastFocusedEditPanel=null,!0;this.isControl()||this.insertHTML(" ");Sys.Extended.UI.HtmlEditor._stopEvent(n);break;case 46:case Sys.UI.Key.backspace:if((Sys.Extended.UI.HtmlEditor.isSafari||Sys.Extended.UI.HtmlEditor.isOpera)&&n.type!="keydown")break;if(((Sys.Extended.UI.HtmlEditor.isIE||Sys.Extended.UI.HtmlEditor.isSafari)&&n.type=="keydown"||!Sys.Extended.UI.HtmlEditor.isIE&&n.type=="keypress")&&this._saveContent(),Sys.Extended.UI.HtmlEditor.isIE){if(f=t._getSelection(),f.type.toLowerCase()=="control"){if(n.keyCode==8){setTimeout(function(){t._ifShadow();t.onContentChanged()},0);Sys.Extended.UI.HtmlEditor._stopEvent(n);return}if(c=t._createRange(f),ft=c.item(0),ft.tagName.toUpperCase()=="EMBED"){for(ft.src="",ft.parentNode.removeChild(ft);c.length>0;)c.remove(0);try{c.collapse(!1)}catch(ur){}Sys.Extended.UI.HtmlEditor._stopEvent(n);t._saveContent();setTimeout(function(){t._undo(!1);t.onContentChanged()},0);return}}kt=t._doc.body.getElementsByTagName("EMBED").length;kt>0&&(dt=t._body.ownerDocument.createElement("div"),t._body.appendChild(dt),nr=n.keyCode,setTimeout(function(){t._body.removeChild(dt);var n=t._doc.body.getElementsByTagName("EMBED");kt!=n.length&&(t._saveContent(),setTimeout(function(){t._undo(!1);t.onContentChanged()},0))},0));setTimeout(function(){t._clearP()},0)}else{var i=this._createRange(this._getSelection()),r=i.startContainer,b=i.endContainer;if(n.type=="keypress"&&(Sys.Extended.UI.HtmlEditor.contentEditable(r)!=null||Sys.Extended.UI.HtmlEditor.contentEditable(b)!=null))return Sys.Extended.UI.HtmlEditor._stopEvent(n),!1;if(r==b&&r.nodeType==1&&r.tagName.toUpperCase()=="TD"&&i.startOffset==i.startOffset&&r.childNodes.item(i.startOffset)&&r.childNodes.item(i.startOffset).tagName&&r.childNodes.item(i.startOffset).tagName.toUpperCase()=="BR"){for(var ci=r.childNodes.item(i.startOffset),li=0,ai=0,d=ci.previousSibling;d;)li++,d=d.previousSibling;for(d=ci.nextSibling;d;)ai++,d=d.nextSibling;if(n.keyCode==46&&ai==0||n.keyCode==Sys.UI.Key.backspace&&li==0||n.keyCode==46&&r.firstChild==r.lastChild&&r.firstChild.nodeType==1)return Sys.Extended.UI.HtmlEditor._stopEvent(n),!1}if(r==b&&r.nodeType==3&&i.startOffset==i.endOffset&&!Sys.Extended.UI.HtmlEditor.isOpera){if(vi=r.data+"",n.keyCode==46&&i.startOffset==vi.length&&!(r.nextSibling&&r.nextSibling.nodeType==3))return r.nextSibling&&(r.parentNode.removeChild(r.nextSibling),t.onContentChanged()),Sys.Extended.UI.HtmlEditor._stopEvent(n),!1;if(n.keyCode==Sys.UI.Key.backspace&&i.startOffset==0&&!(r.previousSibling&&r.previousSibling.nodeType==3))return r.previousSibling&&(r.parentNode.removeChild(r.previousSibling),t.onContentChanged()),Sys.Extended.UI.HtmlEditor._stopEvent(n),!1}if(n.keyCode==Sys.UI.Key.backspace&&r.nodeType==1&&r==b&&i.startOffset==i.endOffset&&(y=r.childNodes.item(i.startOffset),y!=null&&y.nodeType==1&&y.tagName.toUpperCase()=="BR"&&(y=y.previousSibling,y!=null&&y.nodeType!=3)))return y.parentNode.removeChild(y),t.onContentChanged(),Sys.Extended.UI.HtmlEditor._stopEvent(n),!1;setTimeout(function(){var o=t._getSelection(),n=t._createRange(o),f=n.startContainer,s=n.endContainer,i;if(Sys.Extended.UI.HtmlEditor.contentEditable(f)!=null||Sys.Extended.UI.HtmlEditor.contentEditable(s)!=null){t._undo(!1);return}if(Sys.Extended.UI.HtmlEditor.isOpera&&f==s&&f.nodeType==3&&f.data.length==0)f.parentNode.removeChild(f);else if(f==s&&f.nodeType==1&&Sys.Extended.UI.HtmlEditor.isStyleTag(f.tagName)&&n.startOffset==n.endOffset&&f.childNodes.length==0){while(f.parentNode.nodeType==1&&Sys.Extended.UI.HtmlEditor.isStyleTag(f.parentNode.tagName)&&f.parentNode.childNodes.length==1)f=f.parentNode;var r=f.nextSibling,u=f.previousSibling,e=f.parentNode;e.removeChild(f);t.onContentChanged();r==null&&u==null?(n.setStart(e,0),n.setEnd(e,0)):r!=null&&u!=null?r.nodeType==3&&u.nodeType==3?(i=(""+u.data+"").length,u.appendData(r.data),e.removeChild(r),n.setStart(u,i),n.setEnd(u,i)):u.nodeType==3?(i=(""+u.data+"").length,n.setStart(u,i),n.setEnd(u,i)):r.nodeType==3?(n.setStart(r,0),n.setEnd(r,0)):r.childNodes.length>0?(n.setStart(r,0),n.setEnd(r,0)):(i=Sys.Extended.UI.HtmlEditor.__getIndex(r),n.setStart(e,i),n.setEnd(e,i)):u!=null?u.nodeType==3?(i=(""+u.data+"").length,n.setStart(u,i),n.setEnd(u,i)):(i=u.childNodes.length,i>0?(n.setStart(u,i),n.setEnd(u,i)):(i=Sys.Extended.UI.HtmlEditor.__getIndex(u),n.setStart(e,i),n.setEnd(e,i))):r!=null&&(r.nodeType==3?(n.setStart(r,0),n.setEnd(r,0)):(i=r.childNodes.length,i>0?(n.setStart(r,i),n.setEnd(r,i)):(i=Sys.Extended.UI.HtmlEditor.__getIndex(r),n.setStart(e,i),n.setEnd(e,i))));t._removeAllRanges(o);t._selectRange(o,n)}},0)}break;case Sys.UI.Key.enter:if((Sys.Extended.UI.HtmlEditor.isSafari||Sys.Extended.UI.HtmlEditor.isOpera)&&n.type=="keydown")break;if((!Sys.Extended.UI.HtmlEditor.isIE&&n.type=="keypress"||Sys.Extended.UI.HtmlEditor.isIE&&n.type=="keydown")&&this._saveContent(),Sys.Extended.UI.HtmlEditor.isIE&&n.type=="keydown"){if(f=t._getSelection(),f.type.toLowerCase()=="control")break;if(c=t._createRange(f),n.shiftKey)break;else{if(e=c.parentElement(),e.tagName.toUpperCase()=="TEXTAREA")break;while(e&&e.tagName&&e.tagName.toUpperCase()!="BODY"&&Sys.Extended.UI.HtmlEditor.isStyleTag(e.tagName))e=e.parentNode;if(e&&e.tagName&&(a=e.tagName.toUpperCase(),a=="P"||a=="LI")){if(a=="LI"){function tr(){var n;for(c=t._createRange(t._getSelection()),n=c.parentElement();n&&n.tagName&&n.tagName.toUpperCase()!="BODY"&&Sys.Extended.UI.HtmlEditor.isStyleTag(n.tagName);)n=n.parentNode;if(n&&n.nodeType==1&&n.tagName.toUpperCase()=="P"){for(var r=t._doc.createElement("span"),u=t._doc.createTextNode(" "),i=n;i.firstChild!=null&&i.firstChild.nodeType==1;)i=i.firstChild;if(i.nodeType==1)for(i.appendChild(u),i.appendChild(r);n.firstChild;)n.parentNode.insertBefore(n.firstChild,n);else n.parentNode.insertBefore(u,n),n.parentNode.insertBefore(r,n);n.parentNode.removeChild(n);c.moveToElementText(r);c.select();r.parentNode.removeChild(r);t.onContentChanged()}}setTimeout(tr,0)}break}try{var gt=Sys.Extended.UI.HtmlEditor.smartClassName+"_middle_add",s=null,tt="<span id="+gt+"><\/span>";function ir(){var i=t._getSelection(),n=t._createRange(i);s!=null&&(s.innerHTML=" ",n.moveToElementText(s),n.select(),s.parentNode.insertBefore(s.firstChild,s),s.parentNode.removeChild(s),t.onContentChanged())}if(c.pasteHTML(tt),et=!1,s=t._doc.getElementById(gt),s!=null){for(g=s.nextSibling,it=s.parentNode;g==null&&it!=null&&Sys.Extended.UI.HtmlEditor.isStyleTag(it.tagName);)g=it.nextSibling,it=it.parentNode;g==null||Sys.Extended.UI.HtmlEditor.isInlineElement(g)||g.tagName==null||typeof g.tagName=="undefined"||(ot=g.tagName.toUpperCase(),ot!="BR"&&ot!="UL"&&ot!="OL"&&ot!="P"&&(et=!0));s.parentNode.removeChild(s)}if(c.pasteHTML("<br/>"+(et?tt:"")),et&&(s=t._doc.getElementById(gt)),c.select(),et)return setTimeout(ir,0),Sys.Extended.UI.HtmlEditor._stopEvent(n),!1}catch(fr){}}Sys.Extended.UI.HtmlEditor._stopEvent(n)}else if(!n.shiftKey&&(Sys.Extended.UI.HtmlEditor.isSafari||Sys.Extended.UI.HtmlEditor.isOpera)){for(e=Sys.Extended.UI.HtmlEditor.getSelParent(this),e.nodeType==3&&(e=e.parentNode);e&&e.tagName&&e.tagName.toUpperCase()!="BODY"&&Sys.Extended.UI.HtmlEditor.isStyleTag(e.tagName);)e=e.parentNode;if(e&&e.tagName&&(e.tagName.toUpperCase()=="P"||e.tagName.toUpperCase()=="LI"))break;tt="<br />";Sys.Extended.UI.HtmlEditor.isOpera&&(f=t._getSelection(),i=t._createRange(f),i.startContainer==i.endContainer&&(i.startContainer.nodeType==1?(ni=i.startContainer.childNodes.item(i.startOffset),ni.nodeType==1&&ni.tagName.toUpperCase()=="BR"&&(tt+="<br />")):i.startContainer.nodeType!=3||i.startOffset!=i.endOffset||i.startContainer.data.length!=i.endOffset||i.startContainer.nextSibling&&i.startContainer.nextSibling.nodeType==3||(tt+=" ")));this.insertHTML(tt);Sys.Extended.UI.HtmlEditor._stopEvent(n);Sys.Extended.UI.HtmlEditor.isOpera&&(f=t._getSelection(),i=t._createRange(f),i.startContainer==i.endContainer&&i.startContainer.nodeType==3&&i.startOffset==i.endOffset&&i.startContainer.data.length==0&&(ti=i.startContainer.previousSibling,i.startContainer.parentNode.removeChild(i.startContainer),t._removeAllRanges(f),i=t._createRange(),i.setStart(ti,0),i.setEnd(ti,1),t._selectRange(f,i)));t.onContentChanged()}else Sys.Extended.UI.HtmlEditor.isSafari&&(this.insertHTML("<br/>"),Sys.Extended.UI.HtmlEditor._stopEvent(n),t.onContentChanged())}}else t._a_prize=!1;if(Sys.Extended.UI.HtmlEditor.isIE&&n.type=="keypress"&&!n.ctrlKey){var o=n.keyCode,ii=t._getSelection(),st=t._createRange(ii);if(st.text.length>0){var ht=String.fromCharCode(o),yi=Sys.Extended.UI.HtmlEditor.capLock(n),rr=n.shiftKey&&!yi||yi;return rr||(ht=ht.toLowerCase()),l=Sys.Extended.UI.HtmlEditor.smartClassName+"StyleForTyping",h=t._doc.getElementById(l),h!=null&&(ht="<span id='"+l+"'><\/span>"+ht+"<span id='"+l+l+"'><\/span>",h.parentNode.removeChild(h)),st.pasteHTML(ht),h!=null&&(t.trickWithStyles(l),h=t._doc.getElementById(l+l),h.parentNode.removeChild(h)),Sys.Extended.UI.HtmlEditor._stopEvent(n),t.onContentChanged(),!1}}if(n.type=="mouseup"||n.type=="mousedown"||n.type=="keydown"){if(pi=!0,n.type=="keydown"&&!n.ctrlKey&&(o=n.keyCode,(o>=48&&o<=90||o==32||o==13||o>=186&&o<=222||o>=96&&o<=111)&&t._StyleForTyping!=null)){for(t.n_arr=[],at=0;at<t._StyleForTyping.length;at++)t.n_arr.push(t._StyleForTyping[at]);l=Sys.Extended.UI.HtmlEditor.smartClassName+"StyleForTyping";ri=!0;Sys.Extended.UI.HtmlEditor.isIE?(t.insertHTML("<span id='"+l+"'> <\/span>"),h=t._doc.getElementById(l),h&&h.nextSibling&&h.nextSibling.nodeType==3?(ri=!1,ii=t._getSelection(),st=t._createRange(ii),st.moveToElementText(t._doc.getElementById(l)),st.select()):h&&h.removeChild(h.firstChild)):t.insertHTML("<span id='"+l+"'><\/span>");ri&&setTimeout(function(){t.trickWithStyles(l);t.onContentChanged()},0)}if((pi||!Sys.Extended.UI.HtmlEditor.isIE)&&!t._updated_now){t._updateTimer&&(clearTimeout(t._updateTimer),t._updateTimer=null);t._updateTimerLimit=3;function wi(){if(t._editPanel==Sys.Extended.UI.HtmlEditor.LastFocusedEditPanel)try{if(Sys.Extended.UI.HtmlEditor.isIE){try{var n=t._doc.selection}catch(i){return!1}if(t._getSelection().type=="None"&&t._doc.queryCommandValue("backcolor")==0&&t._doc.queryCommandValue("forecolor")==0&&(t._updateTimerLimit--,t._updateTimerLimit>0)){t._updateTimer=setTimeout(wi,100);return}}t._updated_now=!0;t._editPanel.updateToolbar();t._updated_now=!1;t._updateTimer=null;Sys.Extended.UI.HtmlEditor.isIE||t.focusEditor()}catch(i){}}t._updateTimer=setTimeout(wi,300)}}return!Sys.Extended.UI.HtmlEditor.isIE&&(n.type=="keydown"||n.type=="keyup")||Sys.Extended.UI.HtmlEditor.isIE&&(n.type=="keydown"||n.type=="keyup")&&(n.keyCode==16||n.keyCode==20)||(t._StyleForTyping=null),Sys.Extended.UI.HtmlEditor.isSafari&&setTimeout(function(){t._createRange(t._getSelection())},0),Sys.Extended.UI.HtmlEditor.isIE||setTimeout(function(){var i,n,r;t._editPanel==Sys.Extended.UI.HtmlEditor.LastFocusedEditPanel&&(i=t._getSelection(),n=t._createRange(i),n.startContainer.nodeType!=3&&n.startContainer==n.endContainer&&n.startOffset==n.endOffset&&n.startContainer.childNodes.item(n.startOffset)&&n.startContainer.childNodes.item(n.startOffset).nodeType==3&&(r=n.startContainer.childNodes.item(n.startOffset),i.collapseToEnd(),t._removeAllRanges(i),i=t._getSelection(),n=t._createRange(i),n.setStart(r,0),n.setEnd(r,0),t._selectRange(i,n)))},0),Sys.Extended.UI.HtmlEditor.isIE||(f=t._getSelection(),i=t._createRange(f),t._saved_startContainer=i.startContainer,t._saved_startOffset=i.startOffset),setTimeout(function(){try{t._editPanel==Sys.Extended.UI.HtmlEditor.LastFocusedEditPanel&&t._ifShadow()}catch(n){}},0),n.type=="keydown"&&(t._AfterOnContentChanged!=null&&typeof t._AfterOnContentChanged!="undefined"&&t._AfterOnContentChanged||(t._AfterOnContentChanged=!0,setTimeout(function(){t._editPanel==Sys.Extended.UI.HtmlEditor.LastFocusedEditPanel&&(t.onContentChanged(),t._AfterOnContentChanged=!1)},0))),!0}catch(fr){return Sys.Extended.UI.HtmlEditor._stopEvent(n),!1}}; |