@eigenpal/docx-editor-core/prosemirror/styles
Style utilities for ProseMirror editor
Functions (2)
createStyleResolverfunctionSource ↗
Create a style resolver from document's style definitions
declare function createStyleResolver(styleDefinitions: StyleDefinitions | undefined): StyleResolver;resolvePreferredNewTableStyleIdfunctionSource ↗
Resolve the styleId a newly inserted table should adopt, or undefined when the document declares no usable default table style (caller falls back to a plain border).
declare function resolvePreferredNewTableStyleId(defaultTableStyleId: string | undefined | null, resolver: StyleResolver | null | undefined): string | undefined;Classes (1)
StyleResolverclassSource ↗
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 |
| getNextStyleId | | Resolve the style applied to the paragraph that follows one styled with `styleId` when the user presses Enter (OOXML `w:next`, §17.7.4.10). |
| 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)
ResolvedParagraphStyleinterfaceSource ↗
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 |
Variables (1)
DEFAULT_NEW_TABLE_LOOKconstSource ↗
tblLook Word applies to a brand-new table (val="04A0"): style the first row and first column, enable horizontal banding, disable vertical banding. Setting this lets a resolved table style paint its header-row and banding conditional formatting on the inserted table, matching how Word renders a fresh table created with that style.
DEFAULT_NEW_TABLE_LOOK: TableLook