DwtHtmlEditor -- Exception when started in a hidden tab

Have a great idea for extending Zimbra? Share ideas, ask questions, contribute, and get feedback.
4338Chouser
Posts: 6
Joined: Fri Sep 12, 2014 9:56 pm

DwtHtmlEditor -- Exception when started in a hidden tab

Postby 4338Chouser » Thu Nov 10, 2005 4:04 pm

I'm using a DwtHtmlEditor in HTML mode inside a DwtTabViewPage. When this tab is the only one in the DwtTabView, I have no problem. But if another tab is the default, when I switch to the editor's tab and click inside the widget, I get this exception (in FireFox, not in IE):
Exception ``[Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMNSHTMLDocument.queryCommandState]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: http://.../zimbra/boot.js :: anonymous :: line 15392" data: no]'' thrown from function anonymous()
line 15392 of our boot.js corresponds with line 620 of DwtHtmlEditor.js:



var iFrameDoc = this._getIframeDoc();

ev.isBold = iFrameDoc.queryCommandState(DwtHtmlEditor.BOLD_STYLE); // line 620

ev.isItalic = iFrameDoc.queryCommandState(DwtHtmlEditor.ITALIC_STYLE);



Any ideas about what's going wrong?

--Chouser


14319KevinH
Ambassador
Ambassador
Posts: 4558
Joined: Fri Sep 12, 2014 9:52 pm

DwtHtmlEditor -- Exception when started in a hidden tab

Postby 14319KevinH » Thu Nov 10, 2005 4:26 pm

The iFrame may not be in designMode any more. There are some bugs we've seen where the iframe will *forget* it's in design mode and then you get exceptions. If your using Firefox 1.5 it also seems to thrwo mroe exceptions than normal. Does this effect the user of your app? Or are you just seeing the exceptions?
rdargahi
Posts: 39
Joined: Fri Sep 12, 2014 9:52 pm

DwtHtmlEditor -- Exception when started in a hidden tab

Postby rdargahi » Thu Nov 10, 2005 5:30 pm

We have definitely seen this error under FF1.5 (and we have made several fixes to code to deal with it - which will be available in the next release).
pshah
Outstanding Member
Outstanding Member
Posts: 264
Joined: Fri Sep 12, 2014 9:55 pm

DwtHtmlEditor -- Exception when started in a hidden tab

Postby pshah » Thu Nov 10, 2005 7:25 pm

In the meanwhile, make an extra call to the "_enableDesignMode" method in DwtHtmlEditor - I'm assuming you created a subclass of DwtTabViewPage, so you can make the call by overloading the showMe() method (dont forget to call the base class first).
This way, you force the html editor (re: iframe) to always remember that its in design mode.
4338Chouser
Posts: 6
Joined: Fri Sep 12, 2014 9:56 pm

DwtHtmlEditor -- Exception when started in a hidden tab

Postby 4338Chouser » Fri Nov 11, 2005 2:02 pm

Thanks for all your suggestions.
I did fail to mention that after clicking in the DwtHtmlEditor, and after the exception, the insertion point (cursor) does NOT show up in the Editor, and typing doesn't insert any text. It just doesn't work.
I didn't subclass DwtTabViewPage... should I have? :) I just create a Page and then use it as a parent for the various widgets I want to stick in there. So I did try overriding showMe like this:
  var chatmsg = ... // this is my DwtHtmlEditor

chattab.showMe = function() {

DwtTabViewPage.prototype.showMe.call(this);

alert('_enableDesignMode');

chatmsg._enableDesignMode();

};


The alert shows up when I switch to the chat tab, but I still get the exception when I try to use the Editor. I was playing with some resize event handling elsewhere and found it useful to delay examining the DOM object sizes for a moment, so I thought something similar might work here:
  var chatmsg = ... // this is my DwtHtmlEditor

chattab.showMe = function() {

DwtTabViewPage.prototype.showMe.call(this);

setTimeout( function() {

alert('_enableDesignMode');

chatmsg._enableDesignMode();

}, 1 );

};


Now the alert doesn't show up until the Editor is visible in the window (after switching to its tab). But all to no avail -- same exception, same failing Editor widget.
So how soon is that new version coming?

--Chouser

Return to “Developers”

Who is online

Users browsing this forum: JDunphy and 3 guests