a confusing case in selection
or collapsed selection
#5623
acumen1005
started this conversation in
General
Replies: 2 comments
-
The selection has not collapsed as the anchor and the focus are not on the same point. A collapsed selection would have the anchor and the focus on the same point. Example: editor = <editor>
<paragraph>
<text>
the text
<cursor/>
</text>
</paragraph>
</editor> The selection would be editor.selection == {
anchor: {path: [0, 0], offset: 8},
focus: {path: [0, 0], offset: 8}
} Then SlateRange.isCollapsed(editor.selection) === true The cursor is at :
|
Beta Was this translation helpful? Give feedback.
0 replies
-
{ |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm confused by this example. Consider the following Slate document
[{text: 'one '}, {text: 'two', bold: true}, {text: ' three'}]
It would render like so:
Now if we selected the "two":
Then move the focus handle to left until they(anchor and focus) collapse, like:
Now the selection is:
My confusion arises in how to determine if the selection has collapsed, given that the anchor and focus in the above selection do not definitely match.
Beta Was this translation helpful? Give feedback.
All reactions