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

Update transforms.md (#4247)

Clarify the different usage for `select` and `setSelect`
This commit is contained in:
Juan J. Jimenez-Anca
2021-05-07 14:49:13 +01:00
committed by GitHub
parent e6413d4625
commit 1808d0ed9e

View File

@@ -106,7 +106,7 @@ Options: `{edge?: 'anchor' | 'focus' | 'start' | 'end'}`
#### `Transforms.select(editor: Editor, target: Location)`
Set the selection to a new value specified by `target`.
Set the selection to a new value specified by `target`. When a selection already exists, this method is just a proxy for `setSelection` and will update the existing value.
#### `Transforms.deselect(editor: Editor)`
@@ -126,7 +126,7 @@ Options: `{edge?: 'anchor' | 'focus' | 'start' | 'end'}`
#### `Transforms.setSelection(editor: Editor, props: Partial<Range>)`
Set new properties on the selection.
Set new properties on an active selection. Since the value is a `Partial<Range>`, this method can only handle updates to an existing selection. If there is no active selection the operation will be void. Use `select` if you'd like to create a selection when there is none.
### Text transforms