Opened 12 years ago

Closed 12 years ago

#4216 closed defect (fixed)

dijit._editor.RichText.getValue() breaks after setValue('') on FireFox

Reported by: guest Owned by: liucougar
Priority: high Milestone: 0.9
Component: Dijit Version: 0.9
Keywords: Cc:
Blocked By: Blocking:

Description

Apparently, under FireFox? (I haven't tested on IE yet) the RichText? widget is dependent on a div that lives in the created iframe. Getting everything out of sync with this div, will cause getValue() to always return ''. There are actually 2 ways to break it:

  • The easiest, is to call setValue(''). It will clear out the div, and all additional input appears before the div. Since its this div that it uses to pull content for getValue(), it returns nothing.
  • You can delete the div by editing. To do this, select all the content and hit delete. Then put the cursor at the absolute beginning and tap delete 2 or 3 times. Now, the div doesn't exist!

I don't know the fix, but here is what I've changed to get my application to work. In dijit/_editor/RichText.js in the onLoad() function around line 647, it has the following code:

if(this.height){
    this.editNode=this.document.body;
}else{
    this.editNode=this.document.body.firstChild;
}

I've changed it always do: "this.editNode = this.document.body;"

I don't understand this code very well, so there are probably bigger implications to my change that I don't understand. But, I hope this is enough to help someone fix this!

Change History (4)

comment:1 Changed 12 years ago by Adam Peller

Owner: set to liucougar

comment:2 Changed 12 years ago by liucougar

Resolution: worksforme
Status: newclosed

this should have been fixed in trunk, if not, please reopen this

comment:3 Changed 12 years ago by guest

Resolution: worksforme
Status: closedreopened

I am unable to get trunk right now (it keeps hanging part of the way through the checkout) but I am still able to get the bug to occur here:

http://archive.dojotoolkit.org/nightly/dojotoolkit/dijit/tests/test_Editor.html

Using the first textbox on the page, I am able to get it into the state described above, where:

  • hitting the "getValue" button will always put "13" in my console no matter how much text in in there,
  • a bunch of "pnode has no properties" errors

I can see via FireBug?, that the <div> got deleted from editing.

This is all using FireFox? 2.0.0.6 under Debian Etch. I've tested today with IE6, and this problem doesn't exist there.

comment:4 Changed 12 years ago by liucougar

Resolution: fixed
Status: reopenedclosed

(In [10296]) fixes #4216

Note: See TracTickets for help on using tickets.