attrValueEq
testedStructural equality for two attribute values. Order-insensitive for object keys, deep for arrays/objects. Used by mark/attr deduplication and tests.
Signature
export function attrValueEq(a: AttrValue | undefined, b: AttrValue | undefined): boolean{ ... }Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
a | AttrValue | undefined | — | — |
b | AttrValue | undefined | — | — |
Returns
booleanRelated Types
AttrValue
Attribute values are JSON-serializable so documents round-trip losslessly and a CRDT adapter can map them onto its own primitives without special-casing.
export type AttrValue
= | string
| number
| boolean
| null
| readonly AttrValue[]
| { readonly [key: string]: AttrValue };Mark
An inline formatting mark applied to a run of text (bold, italic, link, ...).
type is the registry key; attrs holds mark-specific data (e.g. link href).
interface Mark| Property | Type | Default | Description |
|---|---|---|---|
typereadonly | string | — | — |
attrs?readonly | Attrs | — | — |
Marks
A normalized set of marks: at most one per type, sorted by type.
export type Marks = readonly Mark[];InlineNode
A run of text sharing the same marks. The chosen inline representation ("marked runs") renders to per-block contenteditable as a span list and maps isomorphically onto a character-sequence CRDT with formatting.
interface InlineNode| Property | Type | Default | Description |
|---|---|---|---|
textreadonly | string | — | — |
marksreadonly | Marks | — | — |
Inline
A block's inline content: an ordered, normalized list of runs.
export type Inline = readonly InlineNode[];Node
A document block. id is stable across split/merge/move.
interface Node| Property | Type | Default | Description |
|---|---|---|---|
idreadonly | string | — | — |
typereadonly | string | — | — |
attrsreadonly | Attrs | — | — |
contentreadonly | Content | — | — |
Content
A block's content. Three shapes, chosen by the block's schema:
- Inline for text blocks (paragraph, heading, list item),
- readonly Node[] for container blocks (reserved; no default block uses it),
- null for atom/void blocks (image, divider).
export type Content = Inline | readonly Node[] | null;WritekitDocument
The writekit document: an ordered list of top-level blocks. Default blocks are flat (lists use indent attributes, not nesting), so document helpers operate on the top-level array.
interface WritekitDocument| Property | Type | Default | Description |
|---|---|---|---|
typereadonly | 'doc' | — | — |
contentreadonly | readonly Node[] | — | — |
Slice
A fragment of a document — what copy produces and paste consumes. The block model is flat, so ProseMirror's open depths collapse to two flags: whether the fragment's first/last block continues the text it lands in (a range cut out of the middle of paragraphs) or stands on its own (whole blocks).
interface Slice| Property | Type | Default | Description |
|---|---|---|---|
blocksreadonly | readonly Node[] | — | — |
openStartreadonly | boolean | — | The first block's runs continue the block the caret is in — no boundary before them. |
openEndreadonly | boolean | — | The last block stays open: the caret lands inside it and the tail of the split block joins it. |