API Referencev1.0.2
@eigenpal/docx-editor-core/prosemirror/styles
Style utilities for ProseMirror editor
Functions(1)
fn
packages/core/src/prosemirror/index.ts:46createStyleResolver
Create a style resolver from document's style definitions
declare function createStyleResolver(styleDefinitions: StyleDefinitions | undefined): StyleResolver;Classes(1)
class
packages/core/src/prosemirror/index.ts:46StyleResolver
StyleResolver provides efficient access to resolved style properties
declare class StyleResolver| Member | Type | Summary |
|---|---|---|
| (constructor) | — | Constructs a new instance of the `StyleResolver` class |
| getDefaultCharacterStyle | — | Get the default character style (the one marked `w:default="1"`). |
| getDefaultParagraphStyle | — | Get default paragraph style (usually "Normal") |
| getDefaultTableStyle | — | Get the default table style (the one marked `w:default="1"`). |
| getDocDefaults | — | Get document defaults |
| getParagraphStyles | — | Get all available paragraph styles (for toolbar dropdown) |
| getRunStyleOwnProperties | — | Get a character style's own properties WITHOUT docDefaults. Used when the caller already has docDefaults applied (e.g., from paragraph style resolution). This prevents docDefault fonts from incorrectly overriding paragraph style fonts. |
| getStyle | — | Get a style by ID |
| getTableStyles | — | Get all available table styles (for style gallery) |
| hasParagraphStyle | — | Whether a paragraph style with the given id is defined in the document's `styles.xml`. Used by the agent toolkit to refuse `set_paragraph_style({ styleId: 'NoSuchStyle' })` instead of silently writing an invalid `<w:pStyle>` reference. |
| hasStyle | — | Check if a style exists |
| resolveParagraphStyle | — | Resolve paragraph style properties, including docDefaults cascade |
| resolveRunStyle | — | Resolve run (character) style properties |
Interfaces(1)
interface
packages/core/src/prosemirror/styles/styleResolver.ts:26ResolvedParagraphStyle
Resolved style properties ready for rendering
interface ResolvedParagraphStyle| Member | Type | Summary |
|---|---|---|
| paragraphFormatting? | ParagraphFormatting | Paragraph formatting (alignment, spacing, indentation, etc.) |
| runFormatting? | TextFormatting | Default run formatting from the style |