Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#325 closed defect (fixed)

Empty paragraphs (<p /> ) not shown in wysiwyg (IE)

Reported by: niko Owned by: gogo
Priority: high Milestone: Version 1.0
Component: Xinha Core Version: trunk
Severity: critical Keywords: <p /> ie empty paragraph space hidden


insert a empty paragraph, switch into html-view and back and the empty paragraph won't be shown anymore, although its still in the html-code.

<p />

it is caused by the <p /> (<p /> is not visible - even on a test-html-page!)

i think this is caused by getHTMLWrapper, i did some debugging in there.
as some kind of a workaround this works for me:

--- htmlarea.js (Revision 223)
+++ htmlarea.js (Arbeitskopie)
@@ -4665,7 +4665,14 @@
         html += " " + name + '="' + HTMLArea.htmlEncode(value) + '"';
       if (html != "") {
-        html += closed ? " />" : ">";
+        if(closed && root_tag=="p") {
+          //never use <p /> as empty paragraphs won't be visible
+          html += ">&nbsp;</p>";
+        } else if(closed) {
+          html += " />";
+        } else {
+          html += ">";
+        }
     var containsBlock = false;

although it doesn't solve the real problem.

please review this patch, and report if you have the same problems too.

Change History (4)

comment:1 Changed 15 years ago by wymsy

A simpler solution might be (haven't tested on this case) to add <p> tags to the list HTMLArea._closingTags, along with h1 - h6 tags, which also have a variety of problems in IE if not closed. But I think an even better solution may lie in the approach in ticket #253, which would replace most of the getHTMLWrapper code with a set of regular expressions that clean up the innerHTML produced by the browser. This would get rid of all the hacks that have been added to getHTMLWrapper for all the special cases that keep popping up. I have been experimenting with this and it looks very promising. It seems to handle this issue, for example, as well as the special cases added for form elements (value and onclick attributes). I plan to post my test code in the next day or so under ticket #253 so others can try to break it.

comment:2 Changed 15 years ago by niko

i hope this will be the final solution for all of those problems...

and much faster too i think...

comment:3 Changed 15 years ago by niko

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

commited this patch in changeset:226 to fix the bug for now, will be replaced by #253 hopefully soon

comment:4 Changed 15 years ago by wymsy

Unfortunately, further testing has revealed a problem in IE that may make #253 unusable. I'll post the details under that ticket.

Note: See TracTickets for help on using tickets.