Changeset 13382
- Timestamp:
- 04/22/08 08:28:57 (7 months ago)
- Location:
- dijit/trunk/_editor
- Files:
-
- 2 modified
-
plugins/AlwaysShowToolbar.js (modified) (2 diffs)
-
RichText.js (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
dijit/trunk/_editor/plugins/AlwaysShowToolbar.js
r13380 r13382 5 5 _handleScroll: true, 6 6 setEditor: function(e){ 7 console.log('Port AlwaysShowToolbar plugin to work with Editor without iframe'); 8 return; 7 if(!e.iframe){ 8 console.log('Port AlwaysShowToolbar plugin to work with Editor without iframe'); 9 return; 10 } 11 9 12 this.editor = e; 10 // setTimeout(dojo.hitch(this,this.enable), 10000); 13 11 14 e.onLoadDeferred.addCallback(dojo.hitch(this, this.enable)); 12 // this.scrollInterval = setInterval(dojo.hitch(this, "globalOnScrollHandler"), 100);13 15 }, 14 16 enable: function(d){ … … 46 48 // this.editorObject.style.height = this._lastHeight + "px"; 47 49 dojo.marginBox(e.iframe, { h: this._lastHeight }); 48 // this.iframe.height=this._lastHeight+10+'px';49 // this.iframe.style.height=this._lastHeight+'px';50 50 } 51 51 }, -
dijit/trunk/_editor/RichText.js
r13381 r13382 151 151 if(!this.iframe){ 152 152 var ifr = this.iframe = dojo.doc.createElement("iframe"); 153 ifr.id=this.id ;153 ifr.id=this.id+'_iframe'; 154 154 // this.iframe.src = "about:blank"; 155 155 // document.body.appendChild(this.iframe); … … 332 332 333 333 setDisabled: function(/*Boolean*/ disabled){ 334 if(disabled){ 335 //AP: 336 // why isn't this set in the constructor, or put in 337 // mozSettingProps as a hash? 338 this._mozSettings = [ false, this.blockNodeForEnter==='BR' ]; 334 if(!dojo.isMoz){ 335 dijit._editor.RichText.prototype.setDisabled.call(this, disabled); 336 return; 339 337 } 340 338 this.document.designMode = disabled ? 'off' : 'on'; 341 if(!disabled && this._mozSettings){ 342 dojo.forEach(this._mozSettingProps, function(s,i){ 343 this.document.execCommand(s,false,this._mozSettings[i]); 344 },this); 339 if(!disabled && this._mozSettingProps){ 340 var ps=this._mozSettingProps; 341 for(var n in ps){ 342 if(ps.hasOwnProperty(n)){ 343 try{ 344 this.document.execCommand(n,false,ps[n]); 345 }catch(e){} 346 } 347 } 345 348 } 346 349 this.disabled = disabled; … … 355 358 356 359 dojo.declare("dijit._editor.RichText", dijit._Widget, { 357 constructor: function( ){360 constructor: function(paras){ 358 361 // summary: 359 362 // dijit._editor.RichText is the core of the WYSIWYG editor in dojo, which … … 403 406 this.onLoadDeferred = new dojo.Deferred(); 404 407 405 this.useIframe = (dojo.isFF && (dojo.isFF < 3)) || this.useIframe || this.styleSheets.length; 408 //in this constructor, mixin properties are not yet merged, so we have to check for paras here 409 this.useIframe = (dojo.isFF && (dojo.isFF < 3)) || paras['useIframe'] || paras['styleSheets']; 406 410 407 411 if(this.useIframe){ … … 713 717 714 718 disabled: true, 715 _mozSettingProps: ['styleWithCSS','insertBrOnReturn'],719 _mozSettingProps: {'styleWithCSS':false}, 716 720 717 721 setDisabled: function(/*Boolean*/ disabled){ … … 750 754 751 755 var events = this.events.concat(this.captureEvents); 752 var ap = (this.iframe) ? this. window: this.editNode;756 var ap = (this.iframe) ? this.document : this.editNode; 753 757 dojo.forEach(events, function(item){ 754 758 // dojo.connect(ap, item.toLowerCase(), console, "debug"); 755 759 this.connect(ap, item.toLowerCase(), item); 756 760 }, this); 757 if(!dojo.isIE){ 758 try{ // sanity check for Mozilla 759 // this.document.execCommand("useCSS", false, true); // old moz call 760 this.document.execCommand("styleWithCSS", false, false); // new moz call 761 //this.document.execCommand("insertBrOnReturn", false, false); // new moz call 762 }catch(e2){ } 763 // FIXME: when scrollbars appear/disappear this needs to be fired 764 }else{ // IE contentEditable 761 if(dojo.isIE){ // IE contentEditable 765 762 // give the node Layout on IE 766 763 this.editNode.style.zoom = 1.0; … … 832 829 833 830 // function call after the character has been inserted 834 setTimeout(dojo.hitch(this, "onKeyPressed", e), 1); 831 if(!this._onKeyHitch){ 832 this._onKeyHitch=dojo.hitch(this, "onKeyPressed"); 833 } 834 setTimeout(this._onKeyHitch, 1); 835 835 return true; 836 836 }, … … 848 848 }, 849 849 850 onKeyPressed: function(/*Event*/e){ 851 return; 850 onKeyPressed: function(){ 852 851 this.onDisplayChanged(/*e*/); // can't pass in e 853 852 }, … … 928 927 clearTimeout(this._updateTimer); 929 928 } 930 this._updateTimer = setTimeout( // really? we hitch every time?931 dojo.hitch(this,"onNormalizedDisplayChanged"),932 this.updateInterval933 );929 if(!this._updateHandler){ 930 this._updateHandler = dojo.hitch(this,"onNormalizedDisplayChanged"); 931 } 932 this._updateTimer = setTimeout(this._updateHandler, this.updateInterval); 934 933 }, 935 934 onNormalizedDisplayChanged: function(){ … … 939 938 // If something needs to happen immidiately after a 940 939 // user change, please use onDisplayChanged instead 941 this._updateTimer = null;940 delete this._updateTimer; 942 941 }, 943 942 onChange: function(newContent){