@mcut/timeline
shiftRunsForEdit
Generated TypeScript API reference for the public mcut SDK.
mcut SDK / timeline/src / shiftRunsForEdit
Function: shiftRunsForEdit()
function shiftRunsForEdit(
runs,
oldText,
newText): object[];Defined in: packages/timeline/src/rich-text.ts:133
Remap runs across a text edit, given the before/after strings. The edit region is recovered by common prefix/suffix; offsets after it shift, offsets inside clamp to its bounds. Typing INSIDE a styled run grows the run (the new characters inherit its style), which is what every rich editor does.
Parameters
runs
readonly object[]
oldText
string
newText
string
Returns
object[]