Selection commands
The Tiptap editor provides editor commands for managing selection and focus within your documents. Here’s an overview of the essential selection commands that help you manage cursor movement, selections, and focus behavior.
Use Cases
- Managing Focus and Blur: Control focus behavior using
focus
andblur
. - Deleting and Selecting Content: Use commands like
deleteSelection
andselectAll
to efficiently manage content. - Navigating the Document: Scroll to a specific position or node using
scrollIntoView
and select specific nodes withselectNodeBackward
,selectNodeForward
, orselectParentNode
.
List of selection commands
Command | Description |
---|---|
blur | Removes focus from the editor. |
deleteRange | Deletes everything in a range. |
deleteSelection | Deletes the current selection or cursor position. |
enter | Simulates an Enter key press, creating a new line. |
focus | Sets focus back to the editor and moves the cursor to a specified position. |
keyboardShortcut | Triggers a ShortcutEvent with a given name. |
scrollIntoView | Scrolls the view to the current selection or cursor position. |
selectAll | Selects the entire document. |
selectNodeBackward | Selects the node before the current textblock if the cursor is at the start of a textblock. |
selectNodeForward | Selects the node after the current textblock if the cursor is at the end of a textblock. |
selectParentNode | Moves the selection to the parent node of the currently selected node. |
setNodeSelection | Creates a new NodeSelection at a given position. |
setTextSelection | Controls the text selection by setting it to a specified range or position. |