fn
createSelectionBridge
Signature
ts
export function createSelectionBridge(
getRoot: () => HTMLElement | null,
blockElements: BlockElementRegistry,
): SelectionBridge{ ... }Parameters
| Parameter | Type | Description |
|---|---|---|
getRoot | () => HTMLElement | null | — |
blockElements | BlockElementRegistry | — |
Returns
SelectionBridge| Property | Type | Description |
|---|---|---|
read | () => Selection | null | Read the native selection as a model selection (null if outside writekit). |
write | (selection: Selection) => void | Apply a model selection to the native selection (focusing the root). |
save | () => Selection | null | Snapshot the current model selection. |
restore | (selection: Selection | null) => void | Restore a previously saved selection. |
domPointToOffset | (host: HTMLElement, node: Node, offset: number) => number | — |
offsetToDomPoint | (host: HTMLElement, offset: number) => { node: Node; offset: number } | — |