-
Notifications
You must be signed in to change notification settings - Fork 151
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(486): Constrain selection to editor element when probing for range (
#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
- Loading branch information
Showing
6 changed files
with
229 additions
and
80 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,22 @@ | ||
#toolbar button.active { | ||
font-weight: bold; | ||
} | ||
|
||
#error { | ||
color: red; | ||
} | ||
|
||
#error .name { | ||
font-weight: bold; | ||
} | ||
|
||
#editor { | ||
outline: 1px solid black; | ||
width: 200px; | ||
min-height: 300px; | ||
} | ||
|
||
#editor[contenteditable="false"] { | ||
color: #9e9e9e; | ||
background-color: #f1f1f1; | ||
} |
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
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
Oops, something went wrong.