Skip to content

eo-typewriterjs


eo-typewriterjs / withSelection

Function: withSelection()

ts
function withSelection(
   state, 
   cursorId, 
   from, 
   to): TTypewriterState;

Defined in: core/state/helpers/typewriter-state.helper.ts:52

Parameters

ParameterTypeDescription
stateTTypewriterStateThe current typewriter state
cursorIdstringThe cursor id that owns this selection
fromnumberThe start index of the selection (inclusive)
tonumberThe end index of the selection (exclusive)

Returns

TTypewriterState

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.

Released under the MIT License.