@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)
createRemoveMarkCommand
Create a command that removes a mark from the selection
declare function createRemoveMarkCommand(markType: MarkType): Command;createSetMarkCommand
Create a command that sets a mark on the selection
declare function createSetMarkCommand(markType: MarkType, attrs?: Record<string, unknown>): Command;findHyperlinkRangeAt
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;getHyperlinkAttrs
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;insertHyperlink
declare function insertHyperlink(text: string, href: string, tooltip?: string): Command;isHyperlinkActive
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;setFontFamily
declare function setFontFamily(fontName: string): Command;declare function setFontSize(size: number): Command;setHighlight
declare function setHighlight(color: string): Command;setHyperlink
declare function setHyperlink(href: string, tooltip?: string): Command;setTextColor
declare function setTextColor(attrs: TextColorAttrs): Command;setUnderlineStyle
declare function setUnderlineStyle(style: string, color?: TextColorAttrs): Command;textFormattingToMarks
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
clearFontFamily: CommandclearFontSize
clearFontSize: CommandclearFormatting
Clear all text formatting (remove all marks)
clearFormatting: CommandclearHighlight
clearHighlight: CommandclearTextColor
clearTextColor: CommandremoveHyperlink
removeHyperlink: CommandtoggleBold
toggleBold: CommandtoggleItalic
toggleItalic: CommandtoggleStrike
toggleStrike: CommandtoggleSubscript
toggleSubscript: CommandtoggleSuperscript
toggleSuperscript: CommandtoggleUnderline
toggleUnderline: Command