Opened 14 years ago

Closed 11 years ago

#6161 closed defect (fixed)

Editor getValue() returns nested <p>

Reported by: guest Owned by:
Priority: high Milestone: 1.7
Component: Editor Version: 1.0
Keywords: Cc:
Blocked By: Blocking:

Description (last modified by bill)

I have run into a difficult issue with the Editor control in IE7 and dojo 1.0.2. A simple copy/paste operation causes the Editor.getValue() to be invalid HTML. To reproduce the error:

  1. Start with an empty Editor control.
  2. Type a, hit enter, type b, hit enter.
  3. Highlight the a and make it bold (or any other markup).
  4. Highlight the b line so you get the newline.
  5. Copy
  6. Paste next to the a.

The result is arguably incorrect as you now have a bold a, bold b and regular b (each on their own line) when one would expect two regular b's. The exact spacing (two lines, three lines, etc) is debatable and completely irrelevant. The real problem, however, is the markup that is returned from getValue() is invalid. It is as follows:

< p >< strong >a< p >b< /p >< /strong >< /p >< p >b< /p >< p >b< /p >

If you put it back into the control (ie if the markup is saved like this), it will get progressively worse each time as more and more b's are added. Any help in resolving this issue would be greatly appreciated.

Note: You can accomplish the same incorrect markup just by adding newlines but the repro steps are easier here.

Change History (5)

comment:1 Changed 14 years ago by bill

Description: modified (diff)

I assume step #4 you need to do a copy?

comment:2 Changed 14 years ago by bill

Milestone: 1.2

comment:3 Changed 13 years ago by bill

Description: modified (diff)
Milestone: 1.22.0
Summary: Paste error in EditorEditor getValue() returns nested <p>

I reproduced the problem; i see the nested <p> tags. Happens even after the refactor to not use iframes (as often)....

seems like a tough one to fix though, and I'm not sure what the practical ramifications are. Does the content produced on IE make FF fall over (i.e., if someone edits a document on IE, causing this problem, and them someone else views it on firefox).

comment:4 Changed 12 years ago by bill

Milestone: 2.0future
Owner: liucougar deleted

comment:5 Changed 11 years ago by Jared Jurkiewicz

Milestone: future1.7
Resolution: fixed
Status: newclosed

I think this is actually fixed by a combination of fixes to formatting, EnterKeyHandling?, PrettyPrint?, and/or the SafePaste? plugin. I tried this in the safepaste example (which uses all of the above), and it seems to work fine in 1.7 (I don't see duplications).

So, marking this as fixed!

Note: See TracTickets for help on using tickets.