Skip to content

addPointerListener

addPointerListener<T>(editor, type, listener, lineFilter?): () => void

Defined in: extensions/hover.ts:34

The editor lines have pointer-events: none which means that all pointer and mouse events are captured by the textarea element itself. This utlity can be used to add a subset of pointer and mouse listeners that will be called with the token the pointer is on. If the pointer isn’t on a token, then the line itself will be passed to the listener.

T extends AllowedEditorPointerEvents

PrismEditor

Editor to add the listener to.

T

Event to listen to.

(e, target) => any

Listener called with the event and target token.

(line, lineNumber, e) => boolean

If a line won’t have any tokens the listener is interested in, then this filter can return false to skip computing the target token at the cursor’s position for a performance boost. If ommitted, the listener will be called for all lines.

Cleanup function to remove the listener.

(): void

void