Skip to content

@jsvision/code-editor / documentSelection

Function: documentSelection()

documentSelection(value, length): DocumentSelection

Defined in: code-editor/src/document/types.ts:282

Normalizes a public selection input into trusted document offsets.

Parameters

value

DocumentSelectionInput

length

number

Returns

DocumentSelection

Example

ts
const caret = documentSelection({ anchor: 2, head: 2 }, snapshot.length);