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

Fix an issue where we sometimes inserted a non line before a line #619

Merged
merged 1 commit into from Mar 24, 2016

Conversation

fracmak
Copy link
Contributor

@fracmak fracmak commented Mar 22, 2016

If an embed is the first item in quill, and you insert text before it, it'll end up getting inserted at the root by accident. This guards against that by wrapping any non-line blocks before line blocks in a block blot.

@@ -43,6 +43,15 @@ class Scroll extends Parchment.Scroll {
this.optimize();
}

insertBefore(childBlot, refBlot) {
if (!isLine(childBlot) && isLine(refBlot)) {
Copy link
Member

Choose a reason for hiding this comment

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

Why is the second condition isLine(refBlot) necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah, good point, fixed

@jhchen jhchen merged commit 6299cc3 into quilljs:develop Mar 24, 2016
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.

None yet

2 participants