1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-22 15:02:51 +02:00

docs: Experiment with alternate options documentation format

This commit is contained in:
Sunny Hirai
2021-06-06 17:50:49 -07:00
parent 3baf1301bc
commit e2ae33043a

View File

@@ -52,10 +52,24 @@ Creates a new, empty `Editor` object.
#### `Editor.above<T extends Ancestor>(editor: Editor, options?) => NodeEntry<T> | undefined` #### `Editor.above<T extends Ancestor>(editor: Editor, options?) => NodeEntry<T> | undefined`
Get the ancestor above a location in the document. Get the matching ancestor above a location in the document.
Options: `{at?: Location, match?: NodeMatch, mode?: 'highest' | 'lowest', voids?: boolean}` Options: `{at?: Location, match?: NodeMatch, mode?: 'highest' | 'lowest', voids?: boolean}`
```ts
type Options = {
at?: Location
match?: NodeMatch<T>
mode?: 'highest' | 'lowest'
voids?: boolean
}
```
- `mode?`: If `lowest` (default), returns the lowest matching ancestor. If `highest`, returns the highest matching ancestor.
- `voids?`: If `false` (default), ignore void objects. If `true`, include `void` objects.
- `at?`: Where to start at which is `editor.selection` by default.
- `match?`: Narrow the match
#### `Editor.after(editor: Editor, at: Location, options?) => Point | undefined` #### `Editor.after(editor: Editor, at: Location, options?) => Point | undefined`
Get the point after a location. Get the point after a location.