R
I

SelectionBridge

Maps the native `Selection`/`Range` (over the single editable root) to model coordinates and back.

Signature

ts
interface SelectionBridge

Properties

PropertyTypeDescription
read() => Selection | nullRead the native selection as a model selection (null if outside editor).
write(selection: Selection) => voidApply a model selection to the native selection (focusing the root).
save() => Selection | nullSnapshot the current model selection.
restore(selection: Selection | null) => voidRestore a previously saved selection.
domPointToOffset(host: HTMLElement, node: Node, offset: number) => number
offsetToDomPoint(host: HTMLElement, offset: number) => { node: Node; offset: number; }