-
Notifications
You must be signed in to change notification settings - Fork 3.3k
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
Doc: What does hanging
mean?
#3683
Comments
Hey @lcswillems, from the issue template:
(Or, you could restructure this as a documentation request!) |
I have updated the issue. Why not allowing Github Discussions on this repo? The big advantage is that they will be indexed by Google. |
That is a good suggestion. @CameronAckermanSEL, thoughts? |
Its a fair point, however this has been a long standing request by Ian and it's really up to him to change it. That said, the request for documentation on what hanging means is a perfectly reasonable enhancement request for the documentation |
Perhaps you know this, but I think @lcswillems means the relatively new Discussions feature, like for example, https://github.com/zeit/next.js/discussions. The concept didn't exist in Github until recently. They don't count as issues, and can be answered by anyone. Might help with some of the recurring questions we get in Slack about DOM selection, last focused position, how to match/nodes effectively etc. (I definitely agree we shouldn't have questions as issues here.) |
Oh! I didn't know that feature was a thing! |
@lcswillems Maybe we can guess the meaning of |
I don't get it either... Is somebody able to explain this concept with a sentence? |
From my experience, hanging means that the selection is on a node but hasn't really selected anything in the node. For example: Given this slate document:
It would render like so:
Now if we selected the "two":
We don't really have a guarantee of the selection's path and offset for the anchor and focus points. Let's go over the possible scenarios for
If you use Hehe, I came here looking for whether there was a bug with hanging selection and I ended up finding that someone has already created an issue and PR. Hope it gets merged soon! |
Thank you for your answer! Now, I get it! A simple sentence would be: A range is hanging if it starts at the end of a node or ends at the start of a node. |
Perhaps include a note about when/why this happens, why it matters, and when/why/how to fix it? |
Hello! Wanted to point out that based on the implementation, neither offset can be non-zero. I think that means
? If it should be an or, I think the the code has a bug and should be if ((start.offset !== 0 && end.offset !== 0) || Range.isCollapsed(range)) { @ianstormtaylor does that sound right? |
Also intrested here, does partially hanging (scenario 2 and 3) can defined as hanging? |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Question
From the source code and the documentation, I can't understand what "hanging" means. Could somebody explain?
I think it would be nice to explain it somewhere in the documentation.
The text was updated successfully, but these errors were encountered: