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)
interface
packages/core/src/prosemirror/schema/marks.ts:39FontFamilyAttrs
Font family mark attributes
interface FontFamilyAttrs| Member | Type | Summary |
|---|---|---|
| ascii? | string | |
| asciiTheme? | string | |
| cs? | string | |
| csTheme? | string | |
| eastAsia? | string | |
| eastAsiaTheme? | string | |
| hAnsi? | string | |
| hAnsiTheme? | string |
interface
packages/core/src/prosemirror/schema/marks.ts:32FontSizeAttrs
Font size mark attributes
interface FontSizeAttrs| Member | Type | Summary |
|---|---|---|
| size | number |
interface
packages/core/src/prosemirror/schema/marks.ts:53HyperlinkAttrs
Hyperlink mark attributes
interface HyperlinkAttrs| Member | Type | Summary |
|---|---|---|
| href | string | |
| rId? | string | |
| tooltip? | string |
interface
packages/core/src/prosemirror/schema/nodes.ts:155ImageAttrs
Image node attributes
interface ImageAttrs| Member | Type | Summary |
|---|---|---|
| allowOverlap? | boolean | `wp:anchor allowOverlap`. Same tri-state convention as `layoutInCell`. |
| alt? | string | |
| borderColor? | string | Border color as CSS color string |
| borderStyle? | string | Border style (CSS border-style value) |
| borderWidth? | number | Border 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? | number | Distance from text below (pixels) |
| distLeft? | number | Distance from text left (pixels) |
| distRight? | number | Distance from text right (pixels) |
| distTop? | number | Distance 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? | number | Height in pixels (already converted from EMU) |
| hlinkHref? | string | Hyperlink 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? | ImagePositionAttrs | Position for floating images (horizontal and vertical alignment) |
| rId? | string | |
| src | string | |
| title? | string | |
| transform? | string | CSS transform string (rotation, flip) |
| width? | number | Width in pixels (already converted from EMU) |
| wrapText? | string | Wrap text setting from DOCX (left, right, bothSides, largest) for round-trip |
| wrapType? | WrapType | Wrap type from DOCX: inline, square, tight, through, topAndBottom, behind, inFront |
interface
packages/core/src/prosemirror/schema/nodes.ts:139ImagePositionAttrs
Image position for floating images (horizontal and vertical positioning)
interface ImagePositionAttrs| Member | Type | Summary |
|---|---|---|
| horizontal? | {
relativeTo?: string;
posOffset?: number;
align?: string;
} | |
| vertical? | {
relativeTo?: string;
posOffset?: number;
align?: string;
} |
interface
packages/core/src/layout-engine/types.ts:291ParagraphAttrs
Paragraph node attributes - maps to ParagraphFormatting
interface ParagraphAttrs| Member | Type | Summary |
|---|---|---|
| _originalFormatting? | ParagraphFormatting | Original inline paragraph formatting from DOCX (pre-style-resolution). Used by fromProseDoc for lossless round-trip serialization. |
| _sectionProperties? | SectionProperties | Full 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? | boolean | Contextual 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? | number | See ListRendering.abstractNumId. |
| listIsBullet? | boolean | Whether 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? | string | Computed list marker text (e.g., "1.", "1.1.", "•") |
| listMarkerFontFamily? | string | Marker font family from numbering level rPr |
| listMarkerFontSize? | number | Marker font size from numbering level rPr, in points |
| listNumFmt? | NumberFormat | List number format (decimal, lowerRoman, upperRoman, etc.) for CSS counter styling |
| listStartOverride? | number | See ListRendering.startOverride. |
| numPr? | {
numId?: number;
ilvl?: number;
} | |
| outlineLevel? | number | |
| pageBreakBefore? | boolean | |
| paraId? | string | |
| renderedPageBreakBefore? | boolean | Word'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? | SpacingExplicit | See ParagraphFormatting.spacingExplicit. |
| styleId? | string | |
| tabs? | TabStop[] | |
| textId? | string |
interface
packages/core/src/prosemirror/schema/nodes.ts:223TableAttrs
Table node attributes
interface TableAttrs| Member | Type | Summary |
|---|---|---|
| _originalFormatting? | TableFormatting | Original 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? | FloatingTableProperties | Floating table properties (w:tblpPr) |
| justification? | 'left' | 'center' | 'right' | Table justification/alignment |
| look? | TableLook | Table look flags for conditional formatting (w:tblLook) |
| styleId? | string | Table style ID |
| width? | number | Table width (in twips) |
| widthType? | string | Table width type ('auto', 'pct', 'dxa') |
interface
packages/core/src/prosemirror/schema/nodes.ts:261TableCellAttrs
Table cell attributes
interface TableCellAttrs| Member | Type | Summary |
|---|---|---|
| _originalFormatting? | TableCellFormatting | Original cell formatting from DOCX for lossless round-trip serialization |
| _originalResolvedFill? | string | The 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? | string | Background color (RGB hex) |
| borders? | {
top?: BorderSpec;
bottom?: BorderSpec;
left?: BorderSpec;
right?: BorderSpec;
} | Cell borders — full BorderSpec per side (style, color, size) |
| colspan | number | Column span |
| colwidth? | number[] | null | Column 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? | boolean | No text wrapping in cell |
| rowspan | number | Row span |
| textDirection? | string | OOXML text direction (e.g. 'tbRl', 'btLr') |
| verticalAlign? | 'top' | 'center' | 'bottom' | Vertical alignment |
| width? | number | Cell width (in twips) |
| widthType? | string | Cell width type |
interface
packages/core/src/prosemirror/schema/nodes.ts:247TableRowAttrs
Table row attributes
interface TableRowAttrs| Member | Type | Summary |
|---|---|---|
| _originalFormatting? | TableRowFormatting | Original row formatting from DOCX for lossless round-trip serialization |
| height? | number | Row height (in twips) |
| heightRule? | string | Height rule ('auto', 'exact', 'atLeast') |
| isHeader? | boolean | Is header row |
interface
packages/core/src/prosemirror/schema/marks.ts:14TextColorAttrs
Text color mark attributes
interface TextColorAttrs| Member | Type | Summary |
|---|---|---|
| rgb? | string | |
| themeColor? | ThemeColorSlot | |
| themeShade? | string | |
| themeTint? | string |
interface
packages/core/src/prosemirror/schema/marks.ts:24UnderlineAttrs
Underline mark attributes
interface UnderlineAttrs| Member | Type | Summary |
|---|---|---|
| color? | TextColorAttrs | |
| style? | UnderlineStyle |
Type aliases(3)
type
packages/core/src/prosemirror/schema/index.ts:46DocxMark
type DocxMark = ReturnType<typeof schema.mark>;type
packages/core/src/prosemirror/schema/index.ts:45DocxNode
type DocxNode = ReturnType<typeof schema.node>;type
packages/core/src/prosemirror/schema/index.ts:44DocxSchema
Export types for convenience
type DocxSchema = typeof schema;Variables(2)
const
packages/core/src/prosemirror/index.ts:23schema
schema: prosemirror_model.Schema<any, any>const
packages/core/src/prosemirror/schema/index.ts:38singletonManager
singletonManager: ExtensionManager