Hi there! π
First of all, great work on this library β we're really enjoying using it.
I wanted to ask if it would be possible to expose the caret's screen coordinates (x, y) via a callback, something like:
onCaretPositionChange?: (position: { x: number; y: number }) => void;
Why we need this:
We're implementing a mention popup (triggered by @ / # indicators) and we'd love to position it near the caret β similar to how desktop editors like VS Code, Slack, or Notion show autocomplete suggestions right at the cursor.
Currently, onChangeSelection provides character offsets (start, end, text), which is great for text manipulation, but doesn't give us the pixel coordinates needed to position a floating UI element near the caret.
Without screen coordinates, the best we can do is show the mention list relative to the editor container (e.g. pinned to the bottom), which works but isn't as polished as anchoring it to the cursor position.
Is this something that could be supported, or is there a workaround we might be missing? Would love to hear your thoughts.
Thanks!
Hi there! π
First of all, great work on this library β we're really enjoying using it.
I wanted to ask if it would be possible to expose the caret's screen coordinates (x, y) via a callback, something like:
Why we need this:
We're implementing a mention popup (triggered by
@/#indicators) and we'd love to position it near the caret β similar to how desktop editors like VS Code, Slack, or Notion show autocomplete suggestions right at the cursor.Currently,
onChangeSelectionprovides character offsets (start,end,text), which is great for text manipulation, but doesn't give us the pixel coordinates needed to position a floating UI element near the caret.Without screen coordinates, the best we can do is show the mention list relative to the editor container (e.g. pinned to the bottom), which works but isn't as polished as anchoring it to the cursor position.
Is this something that could be supported, or is there a workaround we might be missing? Would love to hear your thoughts.
Thanks!