Skip to main content

getDOMSelectionRangeAndPoints

function

Resolves the live DOM Range (for layout reads like `getBoundingClientRect`) and the anchor/focus boundary points in one pass, sharing a single getComposedStaticRange read rather than computing it twice as a call to getDOMSelectionRange followed by getDOMSelectionPoints would. Use this at sites that need both shapes from the same selection.

function getDOMSelectionRangeAndPoints(domSelection: Selection, rootElement: HTMLElement | null): { points: DOMSelectionBoundaryPoints; range: Range | null; }

Import

import { getDOMSelectionRangeAndPoints } from '@modular/sdk/editor';

Notes

returns
The composed Range plus the boundary points; the Range is null when the selection has no ranges.