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

moving cards in disabled editor can cause editor.range to go out of sync #475

Closed
bantic opened this issue Aug 30, 2016 · 0 comments
Closed

Comments

@bantic
Copy link
Collaborator

bantic commented Aug 30, 2016

In a disabled editor, the _readRangeFromDOM method no-ops. This can cause editor.range to stay cached on an old state. If that range references sections that have since been programmatically deleted from the post, unexpected errors can happen, for example when snapshotting the range (to add to the undo stack), the range.head.section is expected to have a post property, but if that section has been removed it no longer will. This causes an error in the position#leafSectionIndex code.

bantic added a commit that referenced this issue Aug 30, 2016
Because `_readRangeFromDOM` doesn't do anything
if the editor is non-editable, the editor may get stuck with a range
that is pointing at a section that has been removed from the post.
This causes the error seen when doing the `post.walkAllLeafSections`
later in the snapshot code. The post is undefined because it is read off
the card, but the card that the range points at has been removed.

Fixes #475
bantic added a commit that referenced this issue Aug 30, 2016
Because `_readRangeFromDOM` doesn't do anything
if the editor is non-editable, the editor may get stuck with a range
that is pointing at a section that has been removed from the post.
This causes the error seen when doing the `post.walkAllLeafSections`
later in the snapshot code. The post is undefined because it is read off
the card, but the card that the range points at has been removed.

Fixes #475
bantic added a commit that referenced this issue Aug 30, 2016
Because `_readRangeFromDOM` doesn't do anything
if the editor is non-editable, the editor may get stuck with a range
that is pointing at a section that has been removed from the post.
This causes the error seen when doing the `post.walkAllLeafSections`
later in the snapshot code. The post is undefined because it is read off
the card, but the card that the range points at has been removed.

Fixes #475
johnelliott pushed a commit to dailybeast/mobiledoc-kit that referenced this issue Feb 7, 2017
…le#476)

Because `_readRangeFromDOM` doesn't do anything
if the editor is non-editable, the editor may get stuck with a range
that is pointing at a section that has been removed from the post.
This causes the error seen when doing the `post.walkAllLeafSections`
later in the snapshot code. The post is undefined because it is read off
the card, but the card that the range points at has been removed.

Fixes bustle#475
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

1 participant