New

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

API Referencev1.0.2

@eigenpal/docx-editor-core/prosemirror/commands/formatting

Text Formatting Commands — thin re-exports from extension system

Toggle marks, set marks, clear formatting, hyperlinks. All implementations live in extensions/marks/; this file re-exports for backward compatibility.

Functions(16)

Create a command that removes a mark from the selection

declare function createRemoveMarkCommand(markType: MarkType): Command;

Create a command that sets a mark on the selection

declare function createSetMarkCommand(markType: MarkType, attrs?: Record<string, unknown>): Command;

Resolve the hyperlink mark + contiguous range that surrounds the current cursor. Used by edit/remove popup actions in both adapters.

Resolution order for the mark itself: 1. `$from.marks()` — the normal active-marks lookup 2. `$from.nodeAfter`/`nodeBefore` marks — boundary positions don't report active marks via `marks()` 3. (optional) text-node search by `fallbackHref` — last resort when the popup knows the href but the cursor sits at a gap

The returned range walks the parent block grouping consecutive text nodes that share the same href, and returns whichever range contains the cursor.

declare function findHyperlinkRangeAt(state: EditorState, fallbackHref?: string): {
    mark: Mark;
    start: number;
    end: number;
} | null;
declare function getHyperlinkAttrs(state: EditorState): {
    href: string;
    tooltip?: string;
} | null;

Get the current value of a mark attribute

declare function getMarkAttr(state: EditorState, markType: MarkType, attr: string): unknown | null;
declare function getSelectedText(state: EditorState): string;
declare function isHyperlinkActive(state: EditorState): boolean;

Check if a mark is active in the current selection

declare function isMarkActive(state: EditorState, markType: MarkType, attrs?: Record<string, unknown>): boolean;
declare function setFontFamily(fontName: string): Command;
declare function setFontSize(size: number): Command;
declare function setHighlight(color: string): Command;
declare function setTextColor(attrs: TextColorAttrs): Command;
declare function setUnderlineStyle(style: string, color?: TextColorAttrs): Command;

Text Formatting Commands — thin re-exports from extension system

Toggle marks, set marks, clear formatting, hyperlinks. All implementations live in extensions/marks/; this file re-exports for backward compatibility.

declare function textFormattingToMarks(formatting: TextFormatting): Mark[];

Variables(12)

clearFontFamily: Command
clearFontSize: Command

Clear all text formatting (remove all marks)

clearFormatting: Command
clearHighlight: Command
clearTextColor: Command
toggleBold: Command
toggleItalic: Command
toggleStrike: Command
toggleSubscript: Command
toggleSuperscript: Command
toggleUnderline: Command