marksAtOffset
function marksAtOffset(spans, offset): MarkInstance[];Defined in: document.ts:124
Returns the marks an insertion at offset should inherit. Used by the
input pipeline so typing inside an existing marked run (e.g. in the middle
of an code span) extends the run instead of splitting it. Rules:
- if
offsetis strictly inside one span (start < offset < end), inherit that span’s marks; - if
offsetsits exactly between two spans (right edge of A == left edge of B), inherit the intersection of A.marks and B.marks (so a mark that spans across the boundary continues, but a mark that starts/ends at the boundary does not); - at the very start or end of the block, no marks inherit.
Boundary intersection is the conservative ProseMirror-ish “non-inclusive at
the right edge” behavior — typing right after code does not extend code,
matching Notion. Callers wanting “extend at trailing edge” semantics for
specific marks (bold/italic) can override via stored-marks state.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
spans | TextSpan[] | undefined |
offset | number |