getDOMSelectionRange
functionReturns a live DOM Range for the Selection, resolved through any DOM ShadowRoots enclosing `rootElement`. Inside a shadow tree `Selection.getRangeAt(0)` is retargeted to the shadow host, so this builds a Range from the composed boundary points instead (see getComposedStaticRange); in the light DOM it returns `getRangeAt(0)` unchanged. Use this instead of `getRangeAt(0)` when the Range is needed for layout (e.g. `getBoundingClientRect`), which a StaticRange cannot provide.
Import
import { getDOMSelectionRange } from '@modular/sdk/editor';Notes
- returns
- A live Range, or null when the selection has no ranges.