Page MenuHomePhabricator

Line breaks pasted as <br>s in Firefox
Closed, ResolvedPublic8 Estimated Story Points

Description

Steps to reproduce:

0. Possible requirement: Be me (may be difficult to reproduce in the lab).

  1. Open a page in VisualEditor.
  1. Type an unformatted list in some other software, with one line per item and no blank lines between items:
Apples
Blueberries
Cherries
Dates
  1. Copy the list and paste it into the VisualEditor document. Note that it displays as expected: four items, one line each.
  1. Select all items and use the tool in the toolbar to format it as an unordered (bullet) list.
  1. Notice the odd appearance: one bullet, but everything is indented (equivalent to the results you would get if you had typed * Apples <br> Blueberries <br> Cherries <br> Dates in wikitext).
  1. Save the page.
  1. Notice the even odder appearance: one list entry of all four items, with plain spaces instead of the line breaks.

This screenshot shows the pre-save appearance of the pasted lists in this edit: https://en.wikipedia.org/w/index.php?diff=675021989&oldid=673351584

Screen Shot 2015-08-07 at 11.00.52 AM.png (677×290 px, 56 KB)

This edit was done in Firefox 39 on Mac OS 10.10. To make the short list, I manually typed it in each of the following applications, and the copied and pasted it into a blank, unformatted new line in VisualEditor: Apple Mail (default set to plain text), Apple Pages, Apple Notes, wikitext editor (opened in Firefox), Apple TextEdit, Gmail (default set to rich text; opened in Safari). This can also be reproduced in Safari 8.

Workaround: Press backspace at the start of the second "item" to make it join the first item. Then press return to split the item. Repeat until all the items have a visible bullet.

Event Timeline

I removed Parsoid here, since this is not really a Parsoid issue but a VE interface issue with copy-pasting of text. I use this workaround in VE all the time when pasting newline-separated text that I want to be converted to a list.

Esanders renamed this task from Pasted lists of multiple lines are treated as one list item with <br> to Line breaks pasted as <br>s in Firefox.Nov 12 2015, 7:05 PM

Change 252762 had a related patch set uploaded (by Esanders):
Paste sanitization: Treat <br> breaks as node splits

https://gerrit.wikimedia.org/r/252762

Change 252762 merged by jenkins-bot:
Paste sanitization: Treat <br> breaks as node splits

https://gerrit.wikimedia.org/r/252762