eo-typewriterjs / withSelection
Function: withSelection()
ts
function withSelection(
state,
cursorId,
from,
to): TTypewriterState;Defined in: core/state/helpers/typewriter-state.helper.ts:52
Parameters
| Parameter | Type | Description |
|---|---|---|
state | TTypewriterState | The current typewriter state |
cursorId | string | The cursor id that owns this selection |
from | number | The start index of the selection (inclusive) |
to | number | The end index of the selection (exclusive) |
Returns
A new TTypewriterState with the selection updated
Description
Return a new state with the selection for the given cursor set. If from === to the selection is cleared instead.