2021-04-27 17:41:24 +08:00
# setTextSelection
2021-05-28 03:37:47 +08:00
If you think of selection in the context of an editor, you’ ll probably think of a text selection. With `setTextSelection` you can control that text selection and set it to a specified range or position.
2021-04-27 17:41:24 +08:00
2021-06-23 03:35:39 +08:00
See also: [focus ](/api/commands/focus ), [setNodeSelection ](/api/commands/set-node-selection ), [deleteSelection ](/api/commands/delete-selection ), [selectAll ](/api/commands/select-all )
2021-05-27 16:53:34 +08:00
## Parameters
`position: number | Range`
2021-05-28 03:37:47 +08:00
Pass a number, or a Range, for example `{ from: 5, to: 10 }` .
2021-05-27 16:53:34 +08:00
## Usage
```js
// Set the cursor to the specified position
editor.commands.setTextSelection(10)
// Set the text selection to the specified range
editor.commands.setTextSelection({ from: 5, to: 10 })
```