Page MenuHomePhabricator

Cannot paste nested list from Google Docs
Closed, ResolvedPublic8 Estimate Story Points

Description

Open https://docs.google.com/document/d/1r-FFOXrCfNpuzMGSl0UCA5ACL4BmUT18sRywxFEkkw8/edit#. Copy all the text in the document. Try to paste the text into a VisualEditor surface. Nothing visible will happen, and the console will log the error "Cannot insert list even after closing all containing nodes".

Details

Related Gerrit Patches:

Event Timeline

nshahquinn-wmf raised the priority of this task from to Medium.
nshahquinn-wmf updated the task description. (Show Details)
nshahquinn-wmf added a subscriber: nshahquinn-wmf.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMay 4 2015, 11:48 PM
nshahquinn-wmf added a subscriber: Esanders.
Esanders renamed this task from Cannot paste ordered list from Google Docs to Cannot paste nested list from Google Docs.May 12 2015, 7:21 AM

The minimal use case is

  • B
    • C

This is because Google generates invalid HTML

<ul>
  <li>B</li>
  <ul><li>C</li></ul>
</ul>

The second ul should be wrapped in an li

Can we fix up their broken HTML for them rather than refuse to paste?

We should do more wrapping in the converter - but that is a big task.

We should get Google Docs to fix this upstream. Do we have a contact?

To get what they intended we shouldn't be wrapping the second list, but moving it up into the first listitem:

<ul>
  <li>
    B
  <ul><li>C</li></ul>
  </li>
</ul>

This makes the task much more complex as we are essentially guessing a sensible structure based on our knowledge of how people incorrectly write list markup. Any fixes for this would be a hack specifically for lists.

Are you sure that this requires a nested list? I can't paste any lists at all (not even a single item individually selected from a list), from Google docs into VisualEditor (using Safari). If I remove the list formatting from the item, then it pastes correctly.

I can paste single lists fine. If you have something you can reproduce then you can share the document publically and I can see if it's the same issue.

Change 270041 had a related patch set uploaded (by Esanders):
Fix structure of broken nested lists from Google Docs

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

Change 270041 merged by jenkins-bot:
Fix structure of broken nested lists from Google Docs

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

Esanders closed this task as Resolved.Feb 12 2016, 7:50 PM
Esanders claimed this task.