How it works
Every block-level node (paragraphs, headings, etc.) automatically receives a uniquesdBlockId attribute. This enables:
- Precise targeting - Manipulate specific blocks even as document changes
- Change tracking - Know exactly which blocks were modified
- Collaborative editing - Reference blocks consistently across clients
- Programmatic updates - Update document structure via APIs
Use case
- Document APIs - Build REST APIs that manipulate specific blocks
- Collaboration - Track who edited which blocks in real-time
- Comments & Annotations - Attach metadata to specific blocks
- Version Control - Diff documents at the block level
- Templates - Replace placeholder blocks with dynamic content
Commands
replaceBlockNodeById
Replace a block node by its ID with new content
The replacement node should have the same type as the original
string
required
The sdBlockId of the node to replace
ProseMirrorNode
required
The replacement ProseMirror node
deleteBlockNodeById
Delete a block node by its ID
Completely removes the node from the document
string
required
The sdBlockId of the node to delete
updateBlockNodeAttributes
Update attributes of a block node by its ID
Merges new attributes with existing ones
string
required
The sdBlockId of the node to update
Object
required
Attributes to update
Helpers
getBlockNodes
Get all block nodes in the document
Example:
Array<BlockNodeInfo>
required
See BlockNodeInfo type definition
getBlockNodeById
Get a specific block node by its ID
Example:
string
required
The sdBlockId to search for
Array<BlockNodeInfo>
required
See BlockNodeInfo type definition
getBlockNodesByType
Get all block nodes of a specific type
Example:
string
required
The node type name (e.g., ‘paragraph’, ‘heading’)
Array<BlockNodeInfo>
required
See BlockNodeInfo type definition
getBlockNodesInRange
Get all block nodes within a position range
Example:
number
required
Start position
number
required
End position
Array<BlockNodeInfo>
required
See BlockNodeInfo type definition

