@eigenpal/docx-editor-core/prosemirror/conversion
Document Conversion Utilities
Bidirectional conversion between Document (DOCX) and ProseMirror document.
Functions(7)
createEmptyDoc
Create an empty ProseMirror document
declare function createEmptyDoc(): Node;footnoteToProseDoc
Convert footnote/endnote content (array of Paragraph/Table blocks) to a ProseMirror document. Mirrors `headerFooterToProseDoc` so footnotes flow through the same body pipeline (toFlowBlocks → measureBlocks → renderFragment) and inherit its block support — paragraph + table + image + textBox + fields. Pre-PR, footnoteLayout's `convertFootnoteToContent` re-implemented run/paragraph conversion by hand and silently dropped tables, images, and fields nested inside a footnote.
declare function footnoteToProseDoc(content: Array<Paragraph | Table>, options?: ToProseDocOptions & {
theme?: Theme | null;
}): Node;Convert a ProseMirror document to our Document type
declare function fromProseDoc(pmDoc: Node, baseDocument?: Document): Document;proseDocToBlocks
Convert a ProseMirror document back to an array of Paragraph/Table blocks. Used for converting edited header/footer PM content back to the document model.
declare function proseDocToBlocks(pmDoc: Node): (Paragraph | Table)[];Convert a Document to a ProseMirror document
declare function toProseDoc(document: Document, options?: ToProseDocOptions): Node;updateDocumentContent
Update a Document with content from a ProseMirror document Preserves all non-content parts of the original document
declare function updateDocumentContent(originalDocument: Document, pmDoc: Node): Document;Interfaces(1)
ToProseDocOptions
Options for document conversion
interface ToProseDocOptions| Member | Type | Summary |
|---|---|---|
| styles? | StyleDefinitions | Style definitions for resolving paragraph styles |