fn

insertSliceAt

tested

Splice a fragment into the working document at anchor, recording the steps on tr, and return the selection that lands after it. Inline fragments insert in place. Block fragments split the caret's block: an open first block merges into the head, an open last block into the tail, whole blocks go between. An empty line the fragment lands in is replaced, not kept, and an empty head/tail adopts the type of the block it merges with — pasting a heading into a blank paragraph yields a heading.

Signature

ts
export function insertSliceAt(tr: Transaction, state: WritekitState, slice: Slice, anchor: InsertAnchor): Selection{ ... }

Parameters

ParameterTypeDescription
trTransaction—
stateWritekitState—
sliceSlice—
anchorInsertAnchor—

Returns

Selection