New

docx-editor 1.x has shipped. Vue support, i18n, agents. Read the migration guide →

API Referencev1.0.2

@eigenpal/docx-editor-core/prosemirror/conversion/fromProseDoc

ProseMirror to Document Conversion

Converts a ProseMirror document back to our Document type. This enables round-trip editing: DOCX - Document - PM - Document - DOCX

Key responsibilities: - Coalesce consecutive text with same marks into single Runs - Preserve paragraph attributes (paraId, textId, formatting) - Handle marks - TextFormatting conversion

This file owns the top-level orchestrator (`fromProseDoc`) plus block extraction and the page-break paragraph factory. Per-domain converters live under ./fromProseDoc/ (marks, runs, paragraph, tables, textbox). The deep import `@eigenpal/.../prosemirror/conversion/fromProseDoc` is a tsup entry consumed by the Vue adapter — the barrel re-exports preserve that surface.

Functions(3)

Convert a ProseMirror document to our Document type

declare function fromProseDoc(pmDoc: Node, baseDocument?: Document): Document;

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)[];

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;