Range
API reference for ranges in Slate.
A Range is a set of points that refer to a specific span of a Slate document. They can define a span inside a single node or span across multiple nodes. A range consists of two points: an anchor (start) and a focus (end).
type TRange = {
anchor: Point
focus: Point
}
RangeAPI
transform
Transform a range by an operation.
edges
Get the start and end points of a range.
end
Get the end point of a range.
equals
Check if two ranges are exactly equal.
includes
Check if a range includes a path, point, or part of another range.
intersection
Get the intersection of two ranges.
isBackward
Check if a range is backward (anchor point appears after focus point).
isCollapsed
Check if a range is collapsed (both points refer to the same position).
isExpanded
Check if a range is expanded (not collapsed).
isForward
Check if a range is forward (anchor point appears before focus point).
isRange
Check if a value implements the TRange
interface.
points
Iterate through all point entries in a range.
start
Get the start point of a range.
surrounds
Check if a range completely surrounds another range.
Types
TRange
TRange
objects are a set of points that refer to a specific span of a Slate document. They can define a span inside a
single node or span across multiple nodes.
Range
is a type alias for TRange
.