@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
MemberTypeSummary
(constructor)Constructs a new instance of the `StyleResolver` class
getDefaultCharacterStyleGet the default character style (the one marked `w:default="1"`).
getDefaultParagraphStyleGet default paragraph style (usually "Normal")
getDefaultTableStyleGet the default table style (the one marked `w:default="1"`).
getDocDefaultsGet document defaults
getNextStyleIdResolve the style applied to the paragraph that follows one styled with `styleId` when the user presses Enter (OOXML `w:next`, §17.7.4.10).
getParagraphStylesGet all available paragraph styles (for toolbar dropdown)
getRunStyleOwnPropertiesGet 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.
getStyleGet a style by ID
getTableStylesGet all available table styles (for style gallery)
hasParagraphStyleWhether 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.
hasStyleCheck if a style exists
resolveParagraphStyleResolve paragraph style properties, including docDefaults cascade
resolveRunStyleResolve run (character) style properties

Interfaces (1)

ResolvedParagraphStyleinterfaceSource ↗

Resolved style properties ready for rendering

interface ResolvedParagraphStyle
MemberTypeSummary
paragraphFormatting?ParagraphFormattingParagraph formatting (alignment, spacing, indentation, etc.)
runFormatting?TextFormattingDefault 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

On this page