Changeset 12842
- Timestamp:
- 03/03/08 13:29:43 (9 months ago)
- Files:
-
- 1 modified
-
dijit/trunk/_editor/RichText.js (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
dijit/trunk/_editor/RichText.js
r12767 r12842 28 28 }else{ 29 29 //dojo.body() is not available before onLoad is fired 30 try {30 try{ 31 31 dojo.doc.write('<textarea id="' + dijit._scopeName + '._editor.RichText.savedContent" ' + 32 32 'style="display:none;position:absolute;top:-100px;left:-100px;height:3px;width:3px;overflow:hidden;"></textarea>'); … … 329 329 // Safari's selections go all out of whack if we do it inline, 330 330 // so for now IE is our only hero 331 //if (typeof dojo.doc.body.contentEditable != "undefined"){331 //if(typeof dojo.doc.body.contentEditable != "undefined"){ 332 332 if(dojo.isIE || dojo.isSafari || dojo.isOpera){ // contentEditable, easy 333 333 var ifr = this.iframe = dojo.doc.createElement('iframe'); … … 378 378 _getIframeDocTxt: function(/* String */ html){ 379 379 var _cs = dojo.getComputedStyle(this.domNode); 380 if( !this.height && !dojo.isMoz){380 if(dojo.isIE || (!this.height && !dojo.isMoz)){ 381 381 html="<div>"+html+"</div>"; 382 382 } … … 648 648 dijit.registerWin(this.window); 649 649 } 650 if( this.height || dojo.isMoz){650 if(!dojo.isIE && (this.height || dojo.isMoz)){ 651 651 this.editNode=this.document.body; 652 652 }else{ 653 653 this.editNode=this.document.body.firstChild; 654 var _this = this; 655 if(dojo.isIE){ // #4996 IE wants to focus the BODY tag 656 this.editNode.parentNode.onfocus = 657 function(){ 658 if(!_this.editNode.blurring){ 659 _this.editNode.focus(); 660 } 661 _this.editNode.blurring = false; 662 } 663 } 654 664 } 655 665 … … 681 691 }else{ // IE contentEditable 682 692 // give the node Layout on IE 693 this.connect(this.document, "onmousedown", "_onMouseDown"); // #4996 fix focus 683 694 this.editNode.style.zoom = 1.0; 684 695 } … … 696 707 onKeyDown: function(/* Event */ e){ 697 708 // summary: Fired on keydown 698 699 // console.info("onkeydown:", e.keyCode);700 709 701 710 // we need this event at the moment to get the events from control keys … … 703 712 // keyPress events can be emulated by the keyDown and keyUp detection. 704 713 if(dojo.isIE){ 705 if(e.keyCode === dojo.keys.BACKSPACE && this.document.selection.type === "Control"){ 714 if(e.keyCode == dojo.keys.TAB && e.shiftKey && !e.ctrlKey && !e.altKey){ 715 // focus the BODY so the browser will tab away from it instead 716 this.editNode.blurring = true; 717 this.editNode.parentNode.focus(); 718 }else if(e.keyCode === dojo.keys.BACKSPACE && this.document.selection.type === "Control"){ 706 719 // IE has a bug where if a non-text object is selected in the editor, 707 720 // hitting backspace would act as if the browser's back button was … … 715 728 this.onKeyPress(e); 716 729 } 717 } 718 else if(dojo.isMoz){ 730 }else if(dojo.isMoz){ 719 731 if(e.keyCode == dojo.keys.TAB && !e.shiftKey && !e.ctrlKey && !e.altKey && this.iframe){ 720 732 // update iframe document title for screen reader … … 725 737 this.iframe.focus(); // this.focus(); won't work 726 738 dojo.stopEvent(e); 727 }else if (e.keyCode == dojo.keys.TAB && e.shiftKey){739 }else if(e.keyCode == dojo.keys.TAB && e.shiftKey){ 728 740 // if there is a toolbar, set focus to it, otherwise ignore 729 if (this.toolbar){741 if(this.toolbar){ 730 742 this.toolbar.focus(); 731 743 } … … 745 757 onKeyPress: function(e){ 746 758 // summary: Fired on keypress 747 748 // console.info("onkeypress:", e.keyCode);749 759 750 760 // handle the various key events … … 788 798 this.onDisplayChanged(e); 789 799 }, 800 801 _onMouseDown: function(/*Event*/e){ // IE only to prevent 2 clicks to focus 802 if(!this._focused && !this.disabled){ 803 this.focus(); 804 } 805 }, 806 790 807 _onBlur: function(e){ 791 808 this.inherited(arguments); … … 798 815 this.iframe.contentDocument.title = this._localizedIframeTitles.iframeEditTitle; 799 816 } 800 // console.info('_onBlur')801 817 }, 802 818 _initialFocus: true, 803 819 _onFocus: function(/*Event*/e){ 804 // console.info('_onFocus')805 820 // summary: Fired on focus 806 821 this.inherited(arguments); … … 1314 1329 1315 1330 // line height is squashed for iframes 1316 // FIXME: why was this here? if (this.iframe){ this.domNode.style.lineHeight = null; }1331 // FIXME: why was this here? if(this.iframe){ this.domNode.style.lineHeight = null; } 1317 1332 1318 1333 if(this.interval){ clearInterval(this.interval); }