1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-29 18:09:49 +02:00

docs: Update all reference docs to use a combined list for anchor links

This commit is contained in:
Sunny Hirai
2021-03-30 00:08:35 -07:00
parent a02787539a
commit 28314d82fc
10 changed files with 60 additions and 36 deletions

View File

@@ -9,11 +9,12 @@ interface Element {
}
```
## Static methods
- [Static methods](static-methods)
- [Retrieval methods](#retrieval-methods)
- [Check methods](#check-methods)
## Static methods
### Retrieval methods
###### `Element.matches(element: Element, props: Partial<Element>): boolean`

View File

@@ -1,9 +1,16 @@
# Location
## Static methods
The Location interface is a union of the ways to refer to a specific location in a Slate document: paths, points or ranges. Methods will often accept a Location instead of requiring only a Path, Point or Range.
```typescript
type Location = Path | Point | Range
```
- [Static methods](static-methods)
- [Check methods](#check-methods)
## Static methods
### Check methods
###### `Location.isLocation(value: any): value is Location`

View File

@@ -1,11 +1,12 @@
# Node
## Static methods
- [Static methods](#static-methods)
- [Retrieval methods](#retrieval-methods)
- [Text methods](#text-methods)
- [Check methods](#check-methods)
## Static methods
### Retrieval methods
###### `Node.ancestor(root: Node, path: Path): Ancestor`

View File

@@ -6,12 +6,13 @@
type Path = number[]
```
## Static methods
- [Static methods](#static-methods)
- [Retrieval methods](#retrieval-methods)
- [Check methods](#check-methods)
- [Transform method](#transform-method)
## Static methods
### Retrieval methods
###### `Path.ancestors(path: Path, options: { reverse?: boolean } = {}): Path[]`

View File

@@ -10,8 +10,13 @@ interface PointRef {
}
```
- [Static methods](#static-methods)
- [Transform methods](#trasnform-methods)
## Static methods
### Transform methods
###### `PointRef.transform(ref: PointRef, op: Operation)`
Transform the point refs current value by an `op`.

View File

@@ -10,12 +10,13 @@ interface Point {
}
```
## Static methods
- [Static methods](#static-methods)
- [Retrieval methods](#retrieval-methods)
- [Check methods](#check-methods)
- [Transform method](#transform-method)
## Static methods
### Retrieval methods
###### `Point.compare(point: Point, another: Point): -1 | 0 | 1`

View File

@@ -10,8 +10,13 @@ interface RangeRef {
}
```
- [Static methods](#static-methods)
- [Transform methods](#transform-methods)
## Static methods
### Transform methods
###### `RangeRef.transform(ref: RangeRef, op: Operation)`
Transform the range refs current value by an `op`.

View File

@@ -10,11 +10,12 @@ interface Range {
}
```
## Static methods
- [Static methods](#static-methods)
- [Retrieval methods](#retrieval-methods)
- [Check methods](#check-methods)
- [Transform method](#transform-method)
- [Transform methods](#transform-methods)
## Static methods
### Retrieval methods

View File

@@ -9,11 +9,12 @@ interface Text {
}
```
## Static methods
- [Static methods](#static-methods)
- [Retrieval methods](#retrieval-methods)
- [Check methods](#check-methods)
## Static methods
### Retrieval methods
###### `Text.matches(text: Text, props: Partial<Text>): boolean`

View File

@@ -2,15 +2,14 @@
Transforms are helper functions operating on the document. They can be used in defining your own commands.
Jump to:
- [Node options](#node-options)
- [Static methods](#static-methods)
- [Node transforms](#node-transforms)
- [Selection transforms](#selection-transforms)
- [Text transforms](#text-transforms)
- [Editor transforms](#editor-transforms)
- [Node Options](#node-options)
- [Node Transforms](#node-transforms)
- [Selection Transforms](#selection-transforms)
- [Text Transforms](#text-transforms)
- [Editor Transforms](#general-transforms)
## Node Options
## Node options
All transforms support a parameter `options`. This includes options specific to the transform, and general `NodeOptions` to specify the place in the document that the transform is applied to.
@@ -23,7 +22,9 @@ interface NodeOptions {
}
```
## Node transforms
## Static methods
### Node transforms
Transforms that operate on nodes.
@@ -87,7 +88,7 @@ Move the nodes from an origin to a destination. A destination must be specified
Options supported: `NodeOptions & {to: Path}`. For `options.mode`, `'all'` is also supported.
## Selection transforms
### Selection transforms
Transforms that operate on the document's selection.
@@ -121,7 +122,7 @@ Options: `{edge?: 'anchor' | 'focus' | 'start' | 'end'}`
Set new properties on the selection.
## Text transforms
### Text transforms
Transforms that operate on text.
@@ -143,7 +144,7 @@ Insert a string of text at the specified location in the document. If no locatio
Options: `{at?: Location, voids?: boolean}`
## General transform
### Editor transforms
###### `Transforms.transform(editor: Editor, transform: Transform)`