@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)

fromProseDocfunctionSource ↗

Convert a ProseMirror document to our Document type

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

proseDocToBlocksfunctionSource ↗

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

updateDocumentContentfunctionSource ↗

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;

On this page