Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pasting text that contains a newline inside a list throws an error #456

Closed
YoranBrondsema opened this issue Aug 22, 2016 · 5 comments
Closed
Assignees

Comments

@YoranBrondsema
Copy link
Collaborator

To reproduce

  1. Go to the demo (https://bustlelabs.github.io/mobiledoc-kit/demo/)
  2. Add a list (either unordered or ordered)
  3. Copy the two lines in the "RAW Paste Data" section in http://pastebin.com/CdrMjutM and paste into the list

You would expect it to create a new list item for each line of text but instead it throws an error Uncaught Error: Cannot insert non-list-item to list (is: markup-section).

error

@YoranBrondsema
Copy link
Collaborator Author

YoranBrondsema commented Aug 22, 2016

I figured it's because parsePostFromText transforms the text into paragraphs, divided by the newlines. Then it makes sense that it fails.

A solution would be to turn the parser into a "context-dependent" parser, i.e. if the cursor is in a list, then parse this particular example as list items, else as paragraphs. Any thoughts on this @bantic @mixonic?

Alternatively, do a transform when inserting the items to the list section.

@bantic bantic self-assigned this Aug 23, 2016
@bantic
Copy link
Collaborator

bantic commented Aug 23, 2016

@YoranBrondsema Thanks for the detailed bug description...I'm looking into it this morning.

bantic added a commit that referenced this issue Aug 23, 2016
@bantic
Copy link
Collaborator

bantic commented Aug 23, 2016

bantic added a commit that referenced this issue Aug 23, 2016
The first section is merged, subsequent sections form new list items.

Fixes #456
bantic added a commit that referenced this issue Aug 23, 2016
…#459)

The first section is merged, subsequent sections form new list items.

Fixes #456
@YoranBrondsema
Copy link
Collaborator Author

@bantic Wow, many thanks!

@bantic
Copy link
Collaborator

bantic commented Aug 23, 2016

@YoranBrondsema no problem. Thank you for the detailed description!

released in v0.10.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants