Skip to main content
The root container for all document content. Every editor starts with a Document node that contains all blocks like paragraphs, headings, and lists.

Structure

Why it’s essential

  • Required root - Every editor needs exactly one document node
  • Content validation - Ensures at least one block element exists
  • Document operations - Enables document-level commands and queries

Commands

getDocumentStats

Get document statistics
Returns word count, character count, and paragraph count
Example:

clearDocument

Clear entire document
Replaces all content with an empty paragraph
Example:

setSectionPageMarginsAtSelection

Set page margins for the section at the current cursor position. Example:
Parameters:
Object
Object with optional topInches, rightInches, bottomInches, leftInches (numbers in inches)

Source code