Page MenuHomePhabricator

When splitting a paragraph, trim whitespace from the start of the new one
Closed, ResolvedPublic

Description

See https://en.wikipedia.org/w/index.php?title=Convenience_food&diff=612944999&oldid=609370408

Steps to Reproduce: Take an existing text, and insert a new paragraph at the end of a word but before the next space. The space is then carried over to be the first character of the next paragraph. It gets nowikied in order no to create a preformatted line.

Suggestion: Remove spaces at the beginning of paragraphs, as they'll get nowiki'ed. If there are cases where we actually want that, then instead of removing them on save, we could remove them during the creation of the paragraph, and only keep them if they're added manually by the user after the creation of the paragraph.

Event Timeline

Jdforrester-WMF raised the priority of this task from to Normal.
Jdforrester-WMF updated the task description. (Show Details)
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMar 25 2015, 7:43 PM
Elitre added a subscriber: Elitre.Mar 25 2015, 7:48 PM
gpaumier set Security to None.Mar 25 2015, 9:14 PM
gpaumier added a subscriber: Eloquence.

The linked diff is 9 months old. Using the instructions I can't reproduce this any more: pressing Enter in "Foo Bar" to create "Foo" and " Bar" in the editor results in "Foo\n\nBar" in wikitext.

The inserted paragraphs have visible extra leading spaces in VE:
<span typeof="mw:Nowiki" id="mwSQ" class="ve-ce-mwNowikiAnnotation">&nbsp; </span>

Can it be just to copying text (from somewhere) with those &nbsp;?

I think it might be that wrapper paragraphs (a special type of paragraph) bypass the whitespace stripping code, but that's just a theory.

The diff you showed me earlier didn't look like a copy-paste diff, it looked like the user was removing a bunch of stuff.