Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#5099 closed defect (fixed)

[patch]Failure to load Editor programmatically on hidden element

Reported by: Adam Peller Owned by: liucougar
Priority: high Milestone: 1.1
Component: Editor Version: 1.0
Keywords: Cc:
Blocked By: Blocking:

Description

  • Test case uses Dojo 1.0 over CDN
    • Bug still present on FF2
    • Test case works on IE7
  • Contains two editing areas
    1. Raw HTML editing area
      • initially visible
    2. Dojo Editor editing area
      • initially hidden
      • editor lazily loaded
  • Contains two buttons
    1. HTML: Loads raw HTML area
    2. Rich Text: Loads Dojo Editor area
  • Contents are sync'd up between both editing areas on switch

Steps To Reproduce

  1. Open dojo-editor-test.html using FF2
  2. Click "Rich Text" button
    • BUG: Dojo Editor fails to load
    • Error in firebug console:
 [Exception... "Component returned failure code: 0x80040111 (
NS_ERROR_NOT_AVAILABLE) [nsIDOMNSHTMLDocument.designMode]" nsresult: "
0x80040111 (NS_ERROR_NOT_AVAILABLE)" location: "JS frame :: http://o.aolcdn.com/dojo/
1.0.0/dijit/_editor/RichText.xd.js :: anonymous :: line 12" data: no]

Attachments (2)

dojo-editor-test.html (6.5 KB) - added by Adam Peller 12 years ago.
test case from Mike Pawlowski, IBM (CCLA)
design-mode.patch (4.8 KB) - added by Adam Peller 12 years ago.
Variation of technique from #1301. Seems to work fine.

Download all attachments as: .zip

Change History (9)

Changed 12 years ago by Adam Peller

Attachment: dojo-editor-test.html added

test case from Mike Pawlowski, IBM (CCLA)

comment:1 Changed 12 years ago by Adam Peller

Summary: Failure to load Editor programmatically over CDNFailure to load Editor programmatically on hidden element

CDN is not required to reproduce this bug.

probably a dup of #1301, #3980, but there's a nice test case here.

Changed 12 years ago by Adam Peller

Attachment: design-mode.patch added

Variation of technique from #1301. Seems to work fine.

comment:2 Changed 12 years ago by Adam Peller

Summary: Failure to load Editor programmatically on hidden element[patch]Failure to load Editor programmatically on hidden element

comment:3 in reply to:  description ; Changed 12 years ago by guest

i just have the same bug with dojo one i managed to solve the problem by commenting the following line

ifrFunc = dojo.hitch(this, function(){
			if(!_iframeInitialized){
				_iframeInitialized = true;
			}else{ return; }
			if(!this.editNode){
				try{
					if(this.iframe.contentWindow){
						this.window = this.iframe.contentWindow;
						this.document = this.iframe.contentWindow.document
					}else if(this.iframe.contentDocument){
						// for opera
						this.window = this.iframe.contentDocument.window;
						this.document = this.iframe.contentDocument;
					}
					if(!this.document.body){
						throw 'Error'; 
					}
				}catch(e){
					setTimeout(ifrFunc,500);
					_iframeInitialized = false;
					return;
				}

				dojo._destroyElement(tmpContent);

	line 520 RitchText.js --> //this.document.designMode = "on";

---> line 520 RitchText?.js

and it works fine till now with FF2

comment:4 in reply to:  3 Changed 12 years ago by guest

Replying to guest:

i just have the same bug with dojo one i managed to solve the problem by commenting the following line

ifrFunc = dojo.hitch(this, function(){
			if(!_iframeInitialized){
				_iframeInitialized = true;
			}else{ return; }
			if(!this.editNode){
				try{
					if(this.iframe.contentWindow){
						this.window = this.iframe.contentWindow;
						this.document = this.iframe.contentWindow.document
					}else if(this.iframe.contentDocument){
						// for opera
						this.window = this.iframe.contentDocument.window;
						this.document = this.iframe.contentDocument;
					}
					if(!this.document.body){
						throw 'Error'; 
					}
				}catch(e){
					setTimeout(ifrFunc,500);
					_iframeInitialized = false;
					return;
				}

				dojo._destroyElement(tmpContent);

	line 520 RitchText.js --> //this.document.designMode = "on";

---> line 520 RitchText?.js

and it works fine till now with FF2

or if you wanna to enable the desinMode just change the line to setTimeout(function(){this.document.designMode = "on"},10);

comment:5 Changed 12 years ago by Adam Peller

Resolution: fixed
Status: newclosed

(In [11651]) Set design mode using setDisabled() and use a callback onFocus in case it fails initially (hidden case on FF2) Fixes #5099

comment:6 Changed 12 years ago by Adam Peller

(In [11652]) Fix disabled bit. Fixes #5099

comment:7 Changed 12 years ago by Adam Peller

(In [11653]) once more with the setDisabled() state. Hope I got it right this time. Fixes #5099

Note: See TracTickets for help on using tickets.