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

Parse ul and ols correctly #188

Merged
merged 1 commit into from
Oct 27, 2015
Merged

Parse ul and ols correctly #188

merged 1 commit into from
Oct 27, 2015

Conversation

bantic
Copy link
Collaborator

@bantic bantic commented Oct 23, 2015

This adds code to parse DOM with ul and ol correctly. Prior to this, markups with tagName "li" were incorrectly generated sometimes, and it was possible to create a corrupt mobiledoc by pasting in a list.

fixes #183

The parsing is fairly naive, and doesn't handle all types of nested lists. On those that it can't handle it just ignores the parsed sections rather than inserting invalid stuff into the mobiledoc, though.
There is a commented-out test for the type of nested lists that can appear in google docs HTML.

Pasting a list into content-kit can sometimes do nothing when the post to be inserted is a single list section. PostEditor#insertPost will incorrectly interpret that as a single markup section. This doesn't cause errors but it does prevent the list from being pasted. Pasting a list if it is part of a larger body (at least 1 other section) works correctly.

@bantic
Copy link
Collaborator Author

bantic commented Oct 23, 2015

Added #189 and #190 to address the extra work mentioned above.

});

/*
* FIXME: Google docs nests uls like this
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

punting on this for now?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. See #189. The immediate goal of this PR is to fix the problem where pasting a list (any list) could put the mobiledoc into a corrupt state (markups with "li" tagName outside of actual list sections).

@mixonic
Copy link
Contributor

mixonic commented Oct 27, 2015

@bantic drat, needs a rebase

bantic added a commit that referenced this pull request Oct 27, 2015
@bantic bantic merged commit 34ca437 into master Oct 27, 2015
@bantic bantic deleted the parse-lists branch October 27, 2015 17:33
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

Successfully merging this pull request may close these issues.

parse pasted HTML that includes LI items properly
2 participants