Bug 14350 - WordPress: Editor strips paragraph breaks
Summary: WordPress: Editor strips paragraph breaks
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Evangelism (show other bugs)
Version: 523.x (Safari 3)
Hardware: Mac (PowerPC) OS X 10.4
: P2 Critical
Assignee: Nobody
URL: http://wordpress.org/
Keywords: InRadar
Depends on:
Blocks: 13744
  Show dependency treegraph
 
Reported: 2007-06-23 19:05 PDT by Mayel de Borniol - LeLab.TV
Modified: 2008-04-18 14:20 PDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mayel de Borniol - LeLab.TV 2007-06-23 19:05:50 PDT
When typing a post in WordPress 2.2.1 with visual editor activated, line breaks appear in the editor, but are stripped out when saving the post or switching to "Code View". 

This doesn't occur when setting WebKit's UA to Mozilla.
Comment 1 Mayel de Borniol - LeLab.TV 2007-06-23 19:17:51 PDT
Bug cross posted to : http://trac.wordpress.org/ticket/4521
Comment 2 Oliver Hunt 2007-06-23 19:22:37 PDT
Behaviour changes to be *almost* correct when using the firefox UA.

It looks like the switch between code and visual mode is stripping out <p> and <br> elements for some reason.

When using firefox UA it looked like it was hiding <br> and <p> in code editing mode, and reinserting them (or something) in visual mode, so something is that logic is probably the cause of the woes.
Comment 3 Mayel de Borniol - LeLab.TV 2007-06-23 19:30:45 PDT
Oliver Hunt's comment makes sense since that's the normal behavior in Firefox :
When switching to code editing mode, there are no <p> and <br> (but actual new lines)

But when saving the post, there should <p> and <br>
Comment 4 David Kilzer (:ddkilzer) 2007-06-23 23:04:28 PDT
Should this bug block Bug 6627?

Comment 5 Mayel de Borniol - LeLab.TV 2007-06-24 16:45:04 PDT
David Kilzer :

In my opinion, it should. It prevents the WP editor from being usable.
Comment 6 Justin Garcia 2007-06-24 20:17:39 PDT
> Should this bug block Bug 6627?

TinyMCE's advanced editor's "Show Source" feature doesn't have this problem, so no, since this seems to be specific to WordPress.  Nevertheless, this bug is real serious, and so we should try to get it addressed asap. 
Comment 7 Justin Garcia 2007-08-01 15:58:58 PDT
<rdar://problem/5368629> WordPress: Editor strips paragraph breaks
Comment 8 Justin Garcia 2007-08-01 17:13:11 PDT
Looks like the textarea that WordPress uses to submit contains (as children) text nodes and brs:

TEXTAREA	0x1779c6c0 CLASS=mceEditor STYLE=display: none; 
      #text	0x187be120 "foo"
      BR	0x187be150
      BR	0x187be1c0
      #text	0x187be260 "bar"
      BR	0x187be290
      BR	0x187be300
      #text	0x187be3a0 "baz"

But the value() of the textarea is "foobarbaz".  I made this reduction:

<script>
function foo() {
    textarea = document.getElementById("textarea");
    textarea.appendChild(document.createTextNode("foo"));
    textarea.appendChild(document.createElement("br"));
    textarea.appendChild(document.createTextNode("bar"));
}
function bar() {
    alert(textarea.value);
}
</script>

<textarea id="textarea"></textarea>
<input type="button" onclick="foo();">
<input type="button" onclick="bar();">

And it behaves the same way in FF.  I don't think this is the right way to submit the content of the editable region.  This seems like a WordPress bug.
Comment 10 David Kilzer (:ddkilzer) 2007-08-02 06:48:42 PDT
Moving to Evangelism per Comment #8 and Comment #9.

Comment 11 Justin Garcia 2008-03-21 00:37:24 PDT
Apparently this is fixed in WordPress 2.5, which is set to be released shortly:

http://trac.wordpress.org/ticket/4521
http://blog.wired.com/monkeybites/2008/03/catch-a-sneak-p.html
Comment 12 Justin Garcia 2008-04-18 14:20:52 PDT
Looks like 2.5 was deployed at wordpress.com.  I can no longer reproduce this.