Opened 14 years ago

Closed 13 years ago

#670 closed defect (wontfix)

Toggling between html and text modes corrupts the HTML with IE

Reported by: euler@… Owned by: gogo
Priority: high Milestone:
Component: Xinha Core Version:
Severity: critical Keywords:
Cc:

Description

Switch to text mode, then copy paste the following line:

<p><u>a<p></p></u></p>

Switch to htmlmode, then to textmode.

With Firefox, everything is fine.
With IE, the resulting HTML is:
<p><u>a</u><p></p></p><p></p>

With the GetHTML plugin, the HTML is very similar to the original one (it just adds a <p/> at the end).

The problem appears when you copy/paste Word documents and is within getHTMLWrapper. If we use innerHTML instead of getHTMLWrapper, everything works fine.

It's critical when you want to copy/paste Word documents.
(I'm still tracking the problem).

Change History (3)

comment:1 Changed 14 years ago by euler@…

I just found how to fix the problem (in an ugly way).

Replace HTMLArea.getHTML with:

HTMLArea.getHTML = function(root, outputRoot, editor){
 if (HTMLArea.is_ie)
 {
  return editor._iframe.contentWindow.document.body.innerHTML;
 }
 try{
  return HTMLArea.getHTMLWrapper(root,outputRoot,editor);
 }
 catch(e){
  alert('Your Document is not well formed. Check JavaScript console for details.');
  return editor._iframe.contentWindow.document.body.innerHTML;
 }
}

comment:2 Changed 14 years ago by euler@…

A better fix:

replace

  return editor._iframe.contentWindow.document.body.innerHTML;

with

  return root.innerHTML;

BTW, you can reproduce this problem with Word documents including underlined headings.

comment:3 Changed 13 years ago by gogo

  • Resolution set to wontfix
  • Status changed from new to closed

If you are pasting word documents though, wouldn't you be pasting into the WYSIWYG view rather than html view? We shouldn't be going out of our way to work around people putting in invalid html ( <p><u>a<p></p></u></p> is invalid because a block element (<p>) is inside an inline element (<u>))

Note: See TracTickets for help on using tickets.