Visual Caret

Custom visual caret overlay that hides the native caret in the editor and positions a DOM element at the selection.

Access:

app.getService('visualCaret')

App code:

const visualCaret = app.getService('visualCaret');

Plugin:

const visualCaret = this.app.getService('visualCaret');

addExclude#

Adds a CSS selector to the exclude list so the visual caret is suppressed when focus or selection is inside matching elements.

Parameters:

  • selector (string) — CSS selector

Returns: void

const vc = visualCaret.create(editor, caretEl); vc.addExclude('.rx-ai-prompt');

removeExclude#

Removes a previously added exclude selector from the controller.

Parameters:

  • selector (string) — CSS selector

Returns: void

const vc = visualCaret.create(editor, caretEl); vc.removeExclude('.rx-ai-prompt');