Citation commands

Create, approve, restore, or remove citations through editor commands.

Run these commands on a configured editor. Commands return true on success. Expected failures leave the document unchanged, return false, and call onError if configured. Use editor.can() to validate without editing the document or calling onError. See error codes for recovery steps.

createCitation

Attach a source to selected text, a selected node, or a node at an explicit position. The command records the initial confirmed reference and the creator.

editor.commands.createCitation({ sourceId: 'manual' })
Field in CreateCitationOptionsTypeDescription
sourceIdstringRequired. An ID in the configured source collection.
positionnumberOptional. The ProseMirror position immediately before a node. Overrides the current selection.

Returns false for an unknown source, unsupported selection or position, schema restriction, or invalid user.

approveCitation

Confirm the current text and source revision and record the approver. Pass a citation ID from a query, such as the id of the item selected in your review UI.

editor.commands.approveCitation(citation.id)

Returns false for an unknown citation, missing source, or invalid user.

revertCitation

Restore the last confirmed text of an inline citation and reevaluate affected citations. The confirmed source revision stays the same.

editor.commands.revertCitation(citation.id)

Returns false for an unknown citation, node citation, unsupported restoration, schema restriction, or invalid user. A change that only affects hard breaks and triggers textChanged also returns false. Edit the breaks directly before reviewing again.

removeCitation

Remove one citation and keep the cited content, source, and other citations.

editor.commands.removeCitation(citation.id)

Returns false if the citation no longer exists.