bug
selection.hasEndAtEndOf doesn't work if you pass inline node in it.
https://jsfiddle.net/fj9dvhom/577/
http://recordit.co/XMfNjE5Lpq
Windows 10, Google Chrome Version 67.0.3396.87 (Official Build) (64-bit), [email protected]
selection.hasEndAtEndOf works for inline nodes
I think this method doesn't work at all, not only for inline nodes. Also, I would check hasAnchorAtEndOf and hasFocusAtEndOf.
@travigd I'm not sure that the issue you linked is connected to this bug. You've reported a feature but what I've described is clearly a bug. @ianstormtaylor I would appreciate if you add bug label to this issue.
@alexeychikk It's related to the same core issue (which manifests as a proper bug here) of how slate handles where the selection lies at the boundary of texts and inlines. The short version of it is, for something like texttexttext|inline (where | represents the cursor), Slate considers the selection to be at the right edge of the text rather than at the left edge of the inline (a side effect of how selection is always considered to be _inside_ of a leaf node, rather than, say, in-between two nodes).
I think the fix for the methods you mentioned here would be to also check that if the selection isn't within the current node, you'd also need to check if it's at the right edge of the preceding node or the left edge of the subsequent node.
Hey, thanks for using Slate! Unfortunately, we can't offer support for usage questions in the issues here because it becomes overwhelming to maintain the project if the issues are filled with questions.
However, we do have a Slack channel and people are constantly asking and answering questions in there. So I'm going to close this issue, but I definitely recommend joining the Slack channel if you want to find people that might be able to help.
Thanks for understanding!
Hey, @ianstormtaylor, I think this falls into bug territory, or at least a feature request. I haven't been working with Slate very much in the last few weeks but as far as I'm aware, there's no easy way to solve the problem described.
There are at least a few use cases for wanting to know if the range is at the logical edge (beginning or end) of a node, most importantly, this scenario: for <Inline One>|<Inline Two> (where | is the cursor/caret), we should have hasLogicalEndAtEndOf(inlineOne) === true EVEN IF the selection is technically considered to be at the beginning of the second inline.
This is not easily solvable right now using the existing Slate core.
@travigd that's very fair, I agree with you. I think we can handle that discussion in https://github.com/ianstormtaylor/slate/issues/1914
Whoops, I forgot I opened that. Thanks!!
Most helpful comment
@travigd that's very fair, I agree with you. I think we can handle that discussion in https://github.com/ianstormtaylor/slate/issues/1914