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

Constrain selection to editor element when probing for range #542

Merged
merged 4 commits into from
Mar 15, 2017

Conversation

bantic
Copy link
Collaborator

@bantic bantic commented Mar 15, 2017

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

Add toggle-editable button, error display, selection display, special
styles for when editing is disabled.
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
@bantic bantic merged commit 9b7f58c into master Mar 15, 2017
@bantic bantic deleted the fix-triple-selection-486 branch March 15, 2017 22:06
@bantic bantic mentioned this pull request Mar 15, 2017
@bantic
Copy link
Collaborator Author

bantic commented May 25, 2017

released in v0.10.16

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.

Triple-clicking to select throws an error when editing is disabled
1 participant