1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-01-30 03:37:46 +01:00

docs: Organize the Range docs into sections by type

This commit is contained in:
Sunny Hirai 2021-03-29 23:26:24 -07:00
parent cffbdb1afd
commit 1f9bf19e3b

View File

@ -12,6 +12,14 @@ interface Range {
## Static methods
- [Relationship methods](#relationship-methods)
- [Check methods](#check-methods)
- [Transform method](#transform-method)
### Relationship methods
Relationship of a Range like its start and end points and the intersection with another Range.
###### `Range.edges(range: Range, options?): [Point, Point]`
Get the start and end points of a `range`, in the order in which they appear in the document.
@ -22,6 +30,22 @@ Options: `{reverse?: boolean}`
Get the end point of a `range`.
###### `Range.intersection(range: Range, another: Range): Range | null`
Get the intersection of one `range` with `another`.
###### `Range.points(range: Range): Generator<PointEntry>`
Iterate through all the point entries in a `range`.
###### `Range.start(range: Range): Point`
Get the start point of a `range`
### Check methods
Check some attribute of a Range. Always returns a boolean.
###### `Range.equals(range: Range, another: Range): boolean`
Check if a `range` is exactly equal to `another`.
@ -30,10 +54,6 @@ Check if a `range` is exactly equal to `another`.
Check if a `range` includes a path, a point, or part of another range.
###### `Range.intersection(range: Range, another: Range): Range | null`
Get the intersection of one `range` with `another`.
###### `Range.isBackward(range: Range): boolean`
Check if a `range` is backward, meaning that its anchor point appears _after_ its focus point in the document.
@ -54,13 +74,7 @@ Check if a `range` is forward. This is the opposite of `Range.isBackward` and is
Check if a `value` implements the `Range` interface.
###### `Range.points(range: Range): Generator<PointEntry>`
Iterate through all the point entries in a `range`.
###### `Range.start(range: Range): Point`
Get the start point of a `range`
### Transform methods
###### `Range.transform(range: Range, op: Operation, options): Range | null`