Rich text / foldkit-richtext-dom/events

restoreSelection

function · packages/richtext-dom/src/events.ts:182

function restoreSelection(
  dom: EditorDom,
  selection: RichText.Selection | null,
): void

Puts the browser selection back where the semantic state says it is. Direction is preserved through setBaseAndExtent when the environment has it; jsdom and some engines only offer a range, which cannot express direction.