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

Error when adding a selection outside the editor while not editing #395

Closed
YoranBrondsema opened this issue May 11, 2016 · 2 comments
Closed

Comments

@YoranBrondsema
Copy link
Collaborator

When the editing mode is disabled, adding a selection outside of the editor (for example by triple clicking) throws an error.

Error: Could not find parent section for un-mapped text node "outside section"

I started a PR with a failing test: #394.

However, before I continue, @bantic maybe you can tell me what the best way to proceed would be. My thinking would be to exclude any selection outside of the editor. So when a selection includes a node after the editor, limit the selection to the last node in the editor. And if a selection includes a node from before the editor, limit the selection to the first node in the editor.

This will however, prevent from selecting anything outside of the editor. Alternatively, one could "split" the selection in two. Have the editor part handled by mobiledoc-kit and leave the other part as it is. I'm not sure how feasible that is so I'd like to have your input.

@bantic
Copy link
Collaborator

bantic commented May 11, 2016

@YoranBrondsema Thanks for raising. I am inclined to think that when the editor is disabled, it shouldn't pay any attention to the selection — this error could be fixed by disabling the selection-detection code altogether when editing is disabled.
Do you have a use case for wanting to still have the editor react to text selection even when editing is disabled?

@YoranBrondsema
Copy link
Collaborator Author

@bantic No, not that I can think of right now. And your solution makes sense, I'll proceed with that. Thanks!

bantic added a commit that referenced this issue May 11, 2016
…on-editing

Fix bug #395: Error when adding a selection outside the editor while not editing
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

2 participants