Available since v0.10.0
Configuration
Handle drops outside editor viewport
CSS class for field styling
Default field background color
Maximum annotations per document
Usage
Basic Setup:Commands
Find & Search
findFieldAnnotations
Find field annotations matching a predicate function
Added in v0.10.3
Function to test each annotation node
ProseMirror editor state
Matching field annotations
findFieldAnnotationsBetween
Find all field annotations between two positions
Start position
End position
ProseMirror document node
Field annotations in range
findFieldAnnotationsByFieldId
Find field annotations by field ID(s)
Single field ID or array of field IDs
ProseMirror editor state
Matching field annotations
findFirstFieldAnnotationByFieldId
Find the first field annotation matching a field ID
Added in v0.10.2
Field ID to search for
ProseMirror editor state
First matching annotation or null
findHeaderFooterAnnotationsByFieldId
Find field annotations in headers and footers by field ID or array of field IDs.
Added in v0.11.2
The field ID or array of field IDs
The main editor instance
The currently active section editor
Array of field annotations with their positions
getAllFieldAnnotations
Get all field annotations in the document
ProseMirror editor state
Array of field annotations with positions
getAllFieldAnnotationsWithRect
Get all field annotations with their bounding rectangles
Added in v0.11.0
ProseMirror editor view
ProseMirror editor state
Annotations with positions and rectangles
Delete & Remove
findRemovedFieldAnnotations
Find field annotation nodes that were removed in a transaction
Added in v0.11.2
ProseMirror transaction to analyze
Array of removed field annotation nodes with their positions
deleteFieldAnnotations
Delete field annotations by field ID
Field ID or array of field IDs to delete
boolean
Command success status
deleteFieldAnnotationsByNode
Delete field annotations by node references
Array of annotation objects to delete
boolean
Command success status
deleteFieldAnnotation
Delete a single field annotation
Annotation object to delete
boolean
Command success status
sliceFieldAnnotations
Delete a portion of annotations associated with a field
The field ID or array of field IDs
Index at which to end extraction
boolean
Command success status
Create & Add
addFieldAnnotation
Add field annotation at specified position
Document position to insert annotation
Field annotation attributes
Whether to focus editor after insertion
boolean
Command success status
addFieldAnnotationAtSelection
Add field annotation at current selection position
Field annotation attributes
Whether to focus editor after insertion
boolean
Command success status
Update & Edit
replaceWithFieldAnnotation
Replace text ranges with field annotations
Array of field replacement objects
Options object
boolean
Command success status
replaceFieldAnnotationsWithLabelInSelection
Replace field annotations with text labels in current selection
Added in v0.11.0
Additional options
boolean
Command success status
replaceFieldAnnotationsWithLabel
Replace field annotations with text labels
Added in v0.11.0
Field ID(s) to replace
Replace options
boolean
Command success status
resetFieldAnnotations
Reset all field annotations to their default values
boolean
Command success status
updateFieldAnnotations
Update field annotations by field ID
Field ID or array of field IDs
Attributes to update
boolean
Command success status
updateFieldAnnotation
Update a specific field annotation instance
Annotation object with pos and node
Attributes to update
boolean
Command success status
updateFieldAnnotationsAttributes
Update the attributes of annotations
Array of annotations to update
Attributes to update
boolean
Command success status
setFieldAnnotationsHiddenByCondition
Hide field annotations based on a condition
Function to test each annotation
Whether to show non-matching annotations
boolean
Command success status
unsetFieldAnnotationsHidden
Show all hidden field annotations
boolean
Command success status
setFieldAnnotationsVisibility
Set visibility for all field annotations
Visibility value (‘visible’ or ‘hidden’)
boolean
Command success status
setFieldAnnotationsHighlighted
Set highlighted status for annotations matching predicate
Function to test each annotation node
Whether to highlight matching annotations
boolean
Command success status
toggleFieldAnnotationsFormat
Toggle formatting for field annotations in selection
Format name (bold, italic, underline)
Whether to set selection after toggle
boolean
Command success status
setFieldAnnotationsFontFamily
Set font family for field annotations in current selection
Font family name to apply
Whether to set node selection after update
boolean
Command success status
setFieldAnnotationsFontSize
Set font size for field annotations in current selection
Font size value (e.g., ‘12pt’, ‘14px’)
Whether to set node selection after update
boolean
Command success status
setFieldAnnotationsTextHighlight
Set text highlight color for field annotations in current selection
Highlight color value (e.g., ‘#ffff00’, ‘yellow’)
Whether to set node selection after update
boolean
Command success status
setFieldAnnotationsTextColor
Set text color for field annotations in current selection
Text color value (e.g., ‘#000000’, ‘black’)
Whether to set node selection after update
boolean
Command success status
Helpers
transactionDeletedAnything
Check if a transaction contains any deletion operations
Parameters:
ProseMirror transaction to check
boolean
True if transaction contains deletions
trackFieldAnnotationsDeletion
Track field annotation deletions in a transaction and emit events
Added in v0.11.2
SuperDoc editor instance
ProseMirror transaction
void
handleDropOutside
Handle field annotation drops outside editor boundaries
Parameters:
Drop handling parameters
Events
fieldAnnotationClicked
Field annotation clicked event
Event Data:
node
(Node) - The clicked annotation nodenodePos
(number) - Position of the node in the document
fieldAnnotationDropped
Field annotation dropped event
Event Data:
sourceField
(object) - The dropped field attributes