mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-12 10:14:02 +02:00
Moved documentation for refs in the Editor into its own section
This commit is contained in:
@@ -35,6 +35,7 @@ interface Editor {
|
|||||||
- [Manipulation methods](editor.md#manipulation-methods)
|
- [Manipulation methods](editor.md#manipulation-methods)
|
||||||
- [Check methods](editor.md#check-methods)
|
- [Check methods](editor.md#check-methods)
|
||||||
- [Normalization methods](editor.md#normalization-methods)
|
- [Normalization methods](editor.md#normalization-methods)
|
||||||
|
- [Ref methods](editor.md#ref-methods)
|
||||||
- [Instance methods](editor.md#instance-methods)
|
- [Instance methods](editor.md#instance-methods)
|
||||||
- [Schema-specific methods to override](editor.md#schema-specific-instance-methods-to-override)
|
- [Schema-specific methods to override](editor.md#schema-specific-instance-methods-to-override)
|
||||||
- [Element Type Methods](editor.md/#element-type-methods)
|
- [Element Type Methods](editor.md/#element-type-methods)
|
||||||
@@ -161,32 +162,12 @@ Get the path of a location.
|
|||||||
|
|
||||||
Options: `{depth?: number, edge?: 'start' | 'end'}`
|
Options: `{depth?: number, edge?: 'start' | 'end'}`
|
||||||
|
|
||||||
#### `Editor.pathRef(editor: Editor, path: Path, options?) => PathRef`
|
|
||||||
|
|
||||||
Create a mutable ref for a `Path` object, which will stay in sync as new operations are applied to the editor.
|
|
||||||
|
|
||||||
Options: `{affinity?: 'backward' | 'forward' | null}`
|
|
||||||
|
|
||||||
#### `Editor.pathRefs(editor: Editor) => Set<PathRef>`
|
|
||||||
|
|
||||||
Get the set of currently tracked path refs of the editor.
|
|
||||||
|
|
||||||
#### `Editor.point(editor: Editor, at: Location, options?) => Point`
|
#### `Editor.point(editor: Editor, at: Location, options?) => Point`
|
||||||
|
|
||||||
Get the start or end point of a location.
|
Get the start or end point of a location.
|
||||||
|
|
||||||
Options: `{edge?: 'start' | 'end'}`
|
Options: `{edge?: 'start' | 'end'}`
|
||||||
|
|
||||||
#### `Editor.pointRef(editor: Editor, point: Point, options?) => PointRef`
|
|
||||||
|
|
||||||
Create a mutable ref for a `Point` object, which will stay in sync as new operations are applied to the editor.
|
|
||||||
|
|
||||||
Options: `{affinity?: 'backward' | 'forward' | null}`
|
|
||||||
|
|
||||||
#### `Editor.pointRefs(editor: Editor) => Set<PointRef>`
|
|
||||||
|
|
||||||
Get the set of currently tracked point refs of the editor.
|
|
||||||
|
|
||||||
#### `Editor.positions(editor: Editor, options?) => Generator<Point, void, undefined>`
|
#### `Editor.positions(editor: Editor, options?) => Generator<Point, void, undefined>`
|
||||||
|
|
||||||
Iterate through all of the positions in the document where a `Point` can be placed. The first `Point` returns is always the starting point followed by the next `Point` as determined by the `unit` option.
|
Iterate through all of the positions in the document where a `Point` can be placed. The first `Point` returns is always the starting point followed by the next `Point` as determined by the `unit` option.
|
||||||
@@ -218,16 +199,6 @@ Options: `{at?: Location, match?: NodeMatch, mode?: 'all' | 'highest' | 'lowest'
|
|||||||
|
|
||||||
Get a range of a location.
|
Get a range of a location.
|
||||||
|
|
||||||
#### `Editor.rangeRef(editor: Editor, range: Range, options?) => RangeRef`
|
|
||||||
|
|
||||||
Create a mutable ref for a `Range` object, which will stay in sync as new operations are applied to the editor.
|
|
||||||
|
|
||||||
Options: `{affinity?: 'backward' | 'forward' | 'outward' | 'inward' | null}`
|
|
||||||
|
|
||||||
#### `Editor.rangeRefs(editor: Editor) => Set<RangeRef>`
|
|
||||||
|
|
||||||
Get the set of currently tracked range refs of the editor.
|
|
||||||
|
|
||||||
#### `Editor.start(editor: Editor, at: Location) => Point`
|
#### `Editor.start(editor: Editor, at: Location) => Point`
|
||||||
|
|
||||||
Get the start point of a location.
|
Get the start point of a location.
|
||||||
@@ -376,6 +347,38 @@ Options: `{force?: boolean}`
|
|||||||
Call a function, deferring normalization until after it completes.
|
Call a function, deferring normalization until after it completes.
|
||||||
See [Normalization - Implications for Other Code](./11-normalizing.md#implications-for-other-code);
|
See [Normalization - Implications for Other Code](./11-normalizing.md#implications-for-other-code);
|
||||||
|
|
||||||
|
### Ref Methods
|
||||||
|
|
||||||
|
#### `Editor.pathRef(editor: Editor, path: Path, options?) => PathRef`
|
||||||
|
|
||||||
|
Create a mutable ref for a `Path` object, which will stay in sync as new operations are applied to the editor.
|
||||||
|
|
||||||
|
Options: `{affinity?: 'backward' | 'forward' | null}`
|
||||||
|
|
||||||
|
#### `Editor.pathRefs(editor: Editor) => Set<PathRef>`
|
||||||
|
|
||||||
|
Get the set of currently tracked path refs of the editor.
|
||||||
|
|
||||||
|
#### `Editor.pointRef(editor: Editor, point: Point, options?) => PointRef`
|
||||||
|
|
||||||
|
Create a mutable ref for a `Point` object, which will stay in sync as new operations are applied to the editor.
|
||||||
|
|
||||||
|
Options: `{affinity?: 'backward' | 'forward' | null}`
|
||||||
|
|
||||||
|
#### `Editor.pointRefs(editor: Editor) => Set<PointRef>`
|
||||||
|
|
||||||
|
Get the set of currently tracked point refs of the editor.
|
||||||
|
|
||||||
|
#### `Editor.rangeRef(editor: Editor, range: Range, options?) => RangeRef`
|
||||||
|
|
||||||
|
Create a mutable ref for a `Range` object, which will stay in sync as new operations are applied to the editor.
|
||||||
|
|
||||||
|
Options: `{affinity?: 'backward' | 'forward' | 'outward' | 'inward' | null}`
|
||||||
|
|
||||||
|
#### `Editor.rangeRefs(editor: Editor) => Set<RangeRef>`
|
||||||
|
|
||||||
|
Get the set of currently tracked range refs of the editor.
|
||||||
|
|
||||||
## Instance Methods
|
## Instance Methods
|
||||||
|
|
||||||
### Schema-specific instance methods to override
|
### Schema-specific instance methods to override
|
||||||
|
Reference in New Issue
Block a user