-
Notifications
You must be signed in to change notification settings - Fork 152
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Constrain selection to editor element when probing for range
This fixes an issue where `Position.fromNode` would be called with a node that is outside the editor element, triggering a failed assertion. Now, Cursor constrains the selection to only include the extent inside the editor element before looking up Positions from the anchor and focus nodes. Most of the time this situation is prevented by the browser (it refuses to allow one to create a selection that crosses into or out of the contentEditable div), but when `editor.disableEditing()` is called, a user can triple-click the last part of the mobiledoc document which causes the browser (for Chrome and Safari, but not Firefox) to extend the selection *outside* the editor's element. Fixes #486 as reported by @YoranBrondsema
- Loading branch information
Showing
2 changed files
with
53 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters