New

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

API Referencev1.0.2

@eigenpal/docx-editor-core/prosemirror/schema

ProseMirror Schema for DOCX Editor

Singleton ExtensionManager that builds the schema and initializes runtime. Legacy code imports `schema` and commands from here; new code should use ExtensionManager directly.

Interfaces(11)

Font family mark attributes

interface FontFamilyAttrs
MemberTypeSummary
ascii?string
asciiTheme?string
cs?string
csTheme?string
eastAsia?string
eastAsiaTheme?string
hAnsi?string
hAnsiTheme?string

Font size mark attributes

interface FontSizeAttrs
MemberTypeSummary
sizenumber

Hyperlink mark attributes

interface HyperlinkAttrs
MemberTypeSummary
hrefstring
rId?string
tooltip?string

Image node attributes

interface ImageAttrs
MemberTypeSummary
allowOverlap?boolean`wp:anchor allowOverlap`. Same tri-state convention as `layoutInCell`.
alt?string
borderColor?stringBorder color as CSS color string
borderStyle?stringBorder style (CSS border-style value)
borderWidth?numberBorder width in pixels
cropBottom?number
cropLeft?number
cropRight?number
cropTop?number`wp:srcRect` crop fractions in [0, 1]. Each side is the fraction of the source image that should be hidden. Renders as CSS `clip-path: inset(...)`.
cssFloat?'left' | 'right' | 'none'CSS float direction for floating images
displayMode?'inline' | 'float' | 'block'Display mode for CSS: inline (flows with text), float (left/right float), block (centered)
distBottom?numberDistance from text below (pixels)
distLeft?numberDistance from text left (pixels)
distRight?numberDistance from text right (pixels)
distTop?numberDistance from text above (pixels)
effectExtentBottom?number
effectExtentLeft?number
effectExtentRight?number
effectExtentTop?number`wp:effectExtent` padding (pixels) — extra space reserved around the image for shadows, glows, soft edges, etc. Applied as outer margin so the effect isn't clipped by surrounding content.
height?numberHeight in pixels (already converted from EMU)
hlinkHref?stringHyperlink URL for clickable image
layoutInCell?boolean`wp:anchor layoutInCell`. Tri-state: true / false / undefined (= Word's default "1"). Floating-only; round-tripped on save.
opacity?number`a:alphaModFix amt` mapped to CSS `opacity` in [0, 1].
position?ImagePositionAttrsPosition for floating images (horizontal and vertical alignment)
rId?string
srcstring
title?string
transform?stringCSS transform string (rotation, flip)
width?numberWidth in pixels (already converted from EMU)
wrapText?stringWrap text setting from DOCX (left, right, bothSides, largest) for round-trip
wrapType?WrapTypeWrap type from DOCX: inline, square, tight, through, topAndBottom, behind, inFront

Image position for floating images (horizontal and vertical positioning)

interface ImagePositionAttrs
MemberTypeSummary
horizontal?{ relativeTo?: string; posOffset?: number; align?: string; }
vertical?{ relativeTo?: string; posOffset?: number; align?: string; }

Paragraph node attributes - maps to ParagraphFormatting

interface ParagraphAttrs
MemberTypeSummary
_originalFormatting?ParagraphFormattingOriginal inline paragraph formatting from DOCX (pre-style-resolution). Used by fromProseDoc for lossless round-trip serialization.
_sectionProperties?SectionPropertiesFull section properties for paragraphs that end a section. Used by layout engine for per-section column/page config and round-trip.
alignment?ParagraphAlignment
bidi?boolean
bookmarks?Array<{ id: number; name: string; }>
borders?{ top?: BorderSpec; bottom?: BorderSpec; left?: BorderSpec; right?: BorderSpec; between?: BorderSpec; bar?: BorderSpec; }
contextualSpacing?booleanContextual spacing — suppress space between same-style paragraphs
defaultTextFormatting?TextFormatting
hangingIndent?boolean
indentFirstLine?number
indentLeft?number
indentRight?number
keepLines?boolean
keepNext?boolean
lineSpacing?number
lineSpacingRule?LineSpacingRule
listAbstractNumId?numberSee ListRendering.abstractNumId.
listIsBullet?booleanWhether this is a bullet list
listLevelNumFmts?NumberFormat[]NumberFormat for each level 0..ilvl (inclusive). Lets toFlowBlocks resolve multi-level templates like "%1.%2." with the correct format per token.
listMarker?stringComputed list marker text (e.g., "1.", "1.1.", "•")
listMarkerFontFamily?stringMarker font family from numbering level rPr
listMarkerFontSize?numberMarker font size from numbering level rPr, in points
listMarkerHidden?booleanWhether the list marker is hidden (w:vanish on numbering level rPr)
listNumFmt?NumberFormatList number format (decimal, lowerRoman, upperRoman, etc.) for CSS counter styling
listStartOverride?numberSee ListRendering.startOverride.
numPr?{ numId?: number; ilvl?: number; }
outlineLevel?number
pageBreakBefore?boolean
paraId?string
renderedPageBreakBefore?booleanWord's cached layout marker (`<w:lastRenderedPageBreak/>`). Treated like `pageBreakBefore` for layout, kept as a separate attr so save+reload preserves the marker at the same position Word recorded.
sectionBreakType?'nextPage' | 'continuous' | 'oddPage' | 'evenPage'
shading?ShadingProperties
spaceAfter?number
spaceBefore?number
spacingExplicit?SpacingExplicitSee ParagraphFormatting.spacingExplicit.
styleId?string
tabs?TabStop[]
textId?string

Table node attributes

interface TableAttrs
MemberTypeSummary
_originalFormatting?TableFormattingOriginal table formatting from DOCX for lossless round-trip serialization
cellMargins?{ top?: number; bottom?: number; left?: number; right?: number; }Default cell margins for the table (w:tblCellMar), in twips
columnWidths?number[]Column widths (in twips) from w:tblGrid
floating?FloatingTablePropertiesFloating table properties (w:tblpPr)
justification?'left' | 'center' | 'right'Table justification/alignment
look?TableLookTable look flags for conditional formatting (w:tblLook)
styleId?stringTable style ID
width?numberTable width (in twips)
widthType?stringTable width type ('auto', 'pct', 'dxa')

Table cell attributes

interface TableCellAttrs
MemberTypeSummary
_originalFormatting?TableCellFormattingOriginal cell formatting from DOCX for lossless round-trip serialization
_originalResolvedFill?stringThe resolved hex of the original `shading.fill` at parse time. Used by fromProseDoc to detect whether the user changed `backgroundColor`: if they didn't, we preserve `_originalFormatting.shading` (keeping themeFill + tint/shade); if they did, we write plain rgb.
backgroundColor?stringBackground color (RGB hex)
borders?{ top?: BorderSpec; bottom?: BorderSpec; left?: BorderSpec; right?: BorderSpec; }Cell borders — full BorderSpec per side (style, color, size)
colspannumberColumn span
colwidth?number[] | nullColumn widths for prosemirror-tables resizing (array of pixel widths)
margins?{ top?: number; bottom?: number; left?: number; right?: number; }Cell margins/padding in twips per side
noWrap?booleanNo text wrapping in cell
rowspannumberRow span
textDirection?stringOOXML text direction (e.g. 'tbRl', 'btLr')
verticalAlign?'top' | 'center' | 'bottom'Vertical alignment
width?numberCell width (in twips)
widthType?stringCell width type

Table row attributes

interface TableRowAttrs
MemberTypeSummary
_originalFormatting?TableRowFormattingOriginal row formatting from DOCX for lossless round-trip serialization
height?numberRow height (in twips)
heightRule?stringHeight rule ('auto', 'exact', 'atLeast')
isHeader?booleanIs header row

Text color mark attributes

interface TextColorAttrs
MemberTypeSummary
rgb?string
themeColor?ThemeColorSlot
themeShade?string
themeTint?string

Underline mark attributes

interface UnderlineAttrs
MemberTypeSummary
color?TextColorAttrs
style?UnderlineStyle

Type aliases(3)

type DocxMark = ReturnType<typeof schema.mark>;
type DocxNode = ReturnType<typeof schema.node>;

Export types for convenience

type DocxSchema = typeof schema;

Variables(2)

schema: prosemirror_model.Schema<any, any>
singletonManager: ExtensionManager