Skip to content

Type Editor


Type Editor / @type-editor/selection-util / selection-from-dom

selection-from-dom

Functions

FunctionDescription

selectionFromDOM

Converts a DOM selection to a ProseMirror Selection.

This function reads the current browser selection and translates it into a ProseMirror selection that can be used with the editor state. It handles various edge cases including collapsed selections, node selections, and multi-range selections.