Installation
The gap cursor extension is included in theprosekit package.
Styling
You need to import the gap cursor styles to make the cursor visible:Usage
API reference
defineGapCursor()
Creates a gap cursor extension that captures clicks near and arrow-key-motion past places that don’t have a normally selectable position nearby.
The cursor is drawn as an element with class ProseMirror-gapcursor.
Behavior
The gap cursor extension:- Captures clicks near positions without selectable content
- Handles arrow keys to navigate through gap positions
- Shows visual indicator at the gap cursor position
- Works with block nodes like images, tables, and horizontal rules
Use cases
Adjacent images
Place cursor between two images without text
Before/after tables
Navigate to positions around tables
Around horizontal rules
Select positions near dividers
Block node boundaries
Navigate document structure
Examples
Basic setup with images
With tables
Custom styling
Related
- Drop cursor - Visual indicator for drag-and-drop
- Image - Image nodes that benefit from gap cursor
- Table - Table nodes that benefit from gap cursor