-
Notifications
You must be signed in to change notification settings - Fork 151
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
Triple-clicking to select throws an error when editing is disabled #486
Labels
Comments
@YoranBrondsema thanks as always for the very thorough bug report (and failing test). I'll take a look at this. Should be possible to tighten up |
bantic
added a commit
that referenced
this issue
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
bantic
added a commit
that referenced
this issue
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
bantic
added a commit
that referenced
this issue
Mar 15, 2017
#542) * clean up unnecessary text-with-atoms builder in tests * Update debug page Add toggle-editable button, error display, selection display, special styles for when editing is disabled. * failing test for demonstrate 486 * 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The problem is that when selecting by triple-clicking, the tail of the selection is outside of the editor. I added a failing test in this PR.
I think it can be solved by identifying this case and then limiting the selection to the last possible position inside the editor (I guess the direction of the selection has to be taken into account as well).
The text was updated successfully, but these errors were encountered: