Installation
The virtual selection extension is included in theprosekit package.
Styling
You need to import the virtual selection styles:Usage
API reference
defineVirtualSelection()
Creates a virtual selection extension that shows the selection range when the editor loses focus.
Behavior
The virtual selection extension:- Shows selection when editor is not focused
- Hides automatically when editor regains focus
- Maintains selection state across focus changes
- Works with collaboration to show other users’ selections
Use cases
Toolbar interaction
Keep selection visible while using toolbar buttons
Collaboration
Show selections of multiple users
Dialogs and popovers
Maintain selection context when opening dialogs
Multi-editor views
Show which editor has the logical selection
Examples
With toolbar
Custom styling
Related
- Collaboration - Multi-user editing
- Yjs - Real-time collaboration with Yjs
- Loro - Real-time collaboration with Loro