Bug 14350
Summary: | WordPress: Editor strips paragraph breaks | ||
---|---|---|---|
Product: | WebKit | Reporter: | Mayel de Borniol - LeLab.TV <deborniol> |
Component: | Evangelism | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED FIXED | ||
Severity: | Critical | CC: | deborniol, oliver |
Priority: | P2 | Keywords: | InRadar |
Version: | 523.x (Safari 3) | ||
Hardware: | Mac (PowerPC) | ||
OS: | OS X 10.4 | ||
URL: | http://wordpress.org/ | ||
Bug Depends on: | |||
Bug Blocks: | 13744 |
Mayel de Borniol - LeLab.TV
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.
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Mayel de Borniol - LeLab.TV
Bug cross posted to : http://trac.wordpress.org/ticket/4521
Oliver Hunt
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.
Mayel de Borniol - LeLab.TV
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>
David Kilzer (:ddkilzer)
Should this bug block Bug 6627?
Mayel de Borniol - LeLab.TV
David Kilzer :
In my opinion, it should. It prevents the WP editor from being usable.
Justin Garcia
> 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.
Justin Garcia
<rdar://problem/5368629> WordPress: Editor strips paragraph breaks
Justin Garcia
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.
Justin Garcia
Filed a TinyMCE bug:
http://sourceforge.net/tracker/index.php?func=detail&aid=1765800&group_id=103281&atid=635682
David Kilzer (:ddkilzer)
Moving to Evangelism per Comment #8 and Comment #9.
Justin Garcia
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
Justin Garcia
Looks like 2.5 was deployed at wordpress.com. I can no longer reproduce this.