Path
[0, 0]
.[]
. For example, to select the whole contents of the editor, call Transforms.select(editor, [])
Point
offset
into a specific text node. Their interface is:🤖 Points always refer to text nodes! Since they are the only ones with strings that can have cursors.
Range
A user may make a selection from left to right (in document order) or right to left (reverse of document order). The anchor is where the user began the selection and the focus is where the user ends the selection. If you make a selection with a desktop mouse, the anchor is placed where you pressed the mouse button and the focus is placed where you released the mouse button. Anchor and focus should not be confused with the start and end positions of a selection, since anchor can be placed before the focus or vice versa, depending on the direction you made your selection. —Selection
, MDN​
Editor
. For example, say someone has the whole sentence currently selected:🤖 The selection concept is also borrowed from the DOM, seeSelection
, MDN, although in a greatly-simplified form because Slate doesn't allow for multiple ranges inside a single selection, which makes things a lot easier to work with.
Selection
interface. It's just an object that happens to respect the more general-purpose Range
interface instead.