Ticket #6112: 6112_focus.patch
| File 6112_focus.patch, 3.0 kB (added by liucougar, 10 months ago) |
|---|
-
_editor/RichText.js
324 324 } 325 325 326 326 this.isClosed = false; 327 // Safari's selections go all out of whack if we do it inline, 328 // so for now IE is our only hero 329 //if(typeof dojo.doc.body.contentEditable != "undefined"){ 327 330 328 if(dojo.isIE || dojo.isSafari || dojo.isOpera){ // contentEditable, easy 331 329 var ifr = this.iframe = dojo.doc.createElement('iframe'); 332 330 ifr.id=this.id; … … 377 375 378 376 _getIframeDocTxt: function(/* String */ html){ 379 377 var _cs = dojo.getComputedStyle(this.domNode); 380 if( dojo.isIE || (!this.height && !dojo.isMoz)){378 if(!this.height && !dojo.isMoz){ 381 379 html="<div style='height:100%;'>"+html+"</div>"; 382 380 } 383 381 var font = [ _cs.fontWeight, _cs.fontSize, _cs.fontFamily ].join(" "); … … 648 646 this.window.__registeredWindow=true; 649 647 dijit.registerWin(this.window); 650 648 } 651 if( !dojo.isIE && (this.height || dojo.isMoz)){649 if(this.height || dojo.isMoz){ 652 650 this.editNode=this.document.body; 653 651 }else{ 654 652 this.editNode=this.document.body.firstChild; 655 var _this = this; 656 if(dojo.isIE){ // #4996 IE wants to focus the BODY tag 657 this.editNode.parentNode.onfocus = 658 function(){ 659 if(!_this.editNode.blurring){ 660 _this.editNode.focus(); 661 } 662 _this.editNode.blurring = false; 663 } 653 if(dojo.isIE && !this.height){ // #4996 IE wants to focus the BODY tag when it should focus 654 var _this = this; 655 this.editNode.parentNode.onfocus = function(){ 656 if(!_this.editNode.blurring){ 657 _this.editNode.focus(); 658 } 659 _this.editNode.blurring = false; 660 } 664 661 } 665 662 } 666 663 … … 713 710 // keyPress events can be emulated by the keyDown and keyUp detection. 714 711 if(dojo.isIE){ 715 712 if(e.keyCode == dojo.keys.TAB && e.shiftKey && !e.ctrlKey && !e.altKey){ 716 // focus the BODYso the browser will tab away from it instead713 // focus the documentElement so the browser will tab away from it instead 717 714 this.editNode.blurring = true; 718 this.editNode.parentNode.focus(); 715 this.editNode.blur(); 716 this.document.documentElement.focus(); 719 717 }else if(e.keyCode === dojo.keys.BACKSPACE && this.document.selection.type === "Control"){ 720 718 // IE has a bug where if a non-text object is selected in the editor, 721 719 // hitting backspace would act as if the browser's back button was … … 833 831 // TODO: why is this needed - should we deprecate this ? 834 832 blur: function(){ 835 833 // summary: remove focus from this instance 836 if(!dojo.isIE && this. window.document.documentElement && this.window.document.documentElement.focus){837 this. window.document.documentElement.focus();834 if(!dojo.isIE && this.document.documentElement && this.document.documentElement.focus){ 835 this.document.documentElement.focus(); 838 836 }else if(dojo.doc.body.focus){ 839 837 dojo.doc.body.focus(); 840 838 }