export type FormatType = 'bold' | 'italic' | 'underline' | 'strikethrough' | 'link' | 'orderedList' | 'unorderedList' | 'blockquote' | 'codeInline' | 'codeBlock'; /** * Creates a rich text formatting utility bound to a specific document context * Supports iframe embedding by accepting document/window from IframeContext */ export declare function createRichTextFormatter(getDocument: () => Document, getWindow: () => Window): { getSelection: () => Selection | null; saveSelection: () => Range | null; restoreSelection: (range: Range | null) => void; hasSelection: () => boolean; getSelectedText: (savedRange?: Range | null) => string; isFormatted: (formatType: FormatType, containerElement: HTMLElement) => boolean; isFormattingModeActive: () => boolean; getActiveFormats: (containerElement: HTMLElement) => FormatType[]; getActiveFormattingModes: () => FormatType[]; findFormattingAncestor: () => HTMLElement | null; applyFormat: () => void; removeFormat: () => void; toggleFormat: (formatType: FormatType, containerElement: HTMLElement) => void; toggleFormattingMode: () => void; toggleBold: (containerElement: HTMLElement) => void; toggleItalic: (containerElement: HTMLElement) => void; toggleUnderline: (containerElement: HTMLElement) => void; toggleStrikethrough: (containerElement: HTMLElement) => void; insertLink: (url: string, displayText: string | undefined, containerElement: HTMLElement) => void; updateLink: (url: string, displayText: string | undefined, containerElement: HTMLElement) => void; removeLink: (containerElement: HTMLElement) => void; isInsideLink: (containerElement: HTMLElement) => boolean; toggleOrderedList: (containerElement: HTMLElement) => void; toggleUnorderedList: (containerElement: HTMLElement) => void; fixOrderedListContinuation: (containerElement: HTMLElement) => void; isInsideList: (listType: "orderedList" | "unorderedList", containerElement: HTMLElement) => HTMLElement | null; isInsideAnyList: (containerElement: HTMLElement) => HTMLElement | null; getCurrentListItem: (containerElement: HTMLElement) => HTMLLIElement | null; isCurrentListItemEmpty: (containerElement: HTMLElement) => boolean; isCursorAtListItemStart: (containerElement: HTMLElement) => boolean; handleListBackspace: (containerElement: HTMLElement) => boolean; handleListEnter: (containerElement: HTMLElement) => boolean; handleListTab: (containerElement: HTMLElement, shiftKey: boolean) => boolean; handleCodeBlockEnter: (containerElement: HTMLElement) => boolean; handleCodeBlockBackspace: (containerElement: HTMLElement) => boolean; handleAutoListTrigger: (containerElement: HTMLElement) => "orderedList" | "unorderedList" | null; applyListInlineStyles: (containerElement: HTMLElement) => void; toggleBlockquote: (containerElement: HTMLElement) => void; isInsideBlockquote: (containerElement: HTMLElement) => HTMLElement | null; toggleCodeInline: (containerElement: HTMLElement) => void; toggleCodeBlock: (containerElement: HTMLElement) => void; isInsideCodeInline: (containerElement: HTMLElement) => HTMLElement | null; isInsideCodeBlock: (containerElement: HTMLElement) => HTMLElement | null; handleInlineCodePreservation: (containerElement: HTMLElement, wasInsideInlineCode: boolean) => void; clearFormattingModes: () => void; resetFontContext: (containerElement?: HTMLElement) => void; handleKeyboardShortcut: (event: KeyboardEvent, containerElement: HTMLElement) => boolean; handleArrowKeyInCode: (event: KeyboardEvent, containerElement: HTMLElement) => boolean; getPlainText: (htmlContent: string) => string; normalizeHtml: (htmlContent: string) => string; trimRichTextWhitespace: (html: string | null | undefined) => string; handleMarkdownShortcuts: (containerElement: HTMLElement, onBeforeConversion?: () => void) => boolean; clearPendingFormats: () => void; getPendingFormats: () => FormatType[]; getTextOffsetAtCursor: (containerElement: HTMLElement) => number; setCursorByTextOffset: (containerElement: HTMLElement, offset: number) => void; convertMarkdownToFormat: (containerElement: HTMLElement, startOffset: number, endOffset: number, contentStart: number, contentEnd: number, formatType: FormatType, linkUrl?: string) => void; positionCursorAfterFormat: (containerElement: HTMLElement, formattedNode: Node) => void; applyMarkdownConversion: (containerElement: HTMLElement, match: { startOffset: number; endOffset: number; contentStart: number; contentEnd: number; linkUrl?: string; }, formatType: FormatType) => void; }; /** * React hook for rich text formatting */ export declare function useRichTextFormatting(getDocument: () => Document, getWindow: () => Window): { getSelection: () => Selection | null; saveSelection: () => Range | null; restoreSelection: (range: Range | null) => void; hasSelection: () => boolean; getSelectedText: (savedRange?: Range | null) => string; isFormatted: (formatType: FormatType, containerElement: HTMLElement) => boolean; isFormattingModeActive: () => boolean; getActiveFormats: (containerElement: HTMLElement) => FormatType[]; getActiveFormattingModes: () => FormatType[]; findFormattingAncestor: () => HTMLElement | null; applyFormat: () => void; removeFormat: () => void; toggleFormat: (formatType: FormatType, containerElement: HTMLElement) => void; toggleFormattingMode: () => void; toggleBold: (containerElement: HTMLElement) => void; toggleItalic: (containerElement: HTMLElement) => void; toggleUnderline: (containerElement: HTMLElement) => void; toggleStrikethrough: (containerElement: HTMLElement) => void; insertLink: (url: string, displayText: string | undefined, containerElement: HTMLElement) => void; updateLink: (url: string, displayText: string | undefined, containerElement: HTMLElement) => void; removeLink: (containerElement: HTMLElement) => void; isInsideLink: (containerElement: HTMLElement) => boolean; toggleOrderedList: (containerElement: HTMLElement) => void; toggleUnorderedList: (containerElement: HTMLElement) => void; fixOrderedListContinuation: (containerElement: HTMLElement) => void; isInsideList: (listType: "orderedList" | "unorderedList", containerElement: HTMLElement) => HTMLElement | null; isInsideAnyList: (containerElement: HTMLElement) => HTMLElement | null; getCurrentListItem: (containerElement: HTMLElement) => HTMLLIElement | null; isCurrentListItemEmpty: (containerElement: HTMLElement) => boolean; isCursorAtListItemStart: (containerElement: HTMLElement) => boolean; handleListBackspace: (containerElement: HTMLElement) => boolean; handleListEnter: (containerElement: HTMLElement) => boolean; handleListTab: (containerElement: HTMLElement, shiftKey: boolean) => boolean; handleCodeBlockEnter: (containerElement: HTMLElement) => boolean; handleCodeBlockBackspace: (containerElement: HTMLElement) => boolean; handleAutoListTrigger: (containerElement: HTMLElement) => "orderedList" | "unorderedList" | null; applyListInlineStyles: (containerElement: HTMLElement) => void; toggleBlockquote: (containerElement: HTMLElement) => void; isInsideBlockquote: (containerElement: HTMLElement) => HTMLElement | null; toggleCodeInline: (containerElement: HTMLElement) => void; toggleCodeBlock: (containerElement: HTMLElement) => void; isInsideCodeInline: (containerElement: HTMLElement) => HTMLElement | null; isInsideCodeBlock: (containerElement: HTMLElement) => HTMLElement | null; handleInlineCodePreservation: (containerElement: HTMLElement, wasInsideInlineCode: boolean) => void; clearFormattingModes: () => void; resetFontContext: (containerElement?: HTMLElement) => void; handleKeyboardShortcut: (event: KeyboardEvent, containerElement: HTMLElement) => boolean; handleArrowKeyInCode: (event: KeyboardEvent, containerElement: HTMLElement) => boolean; getPlainText: (htmlContent: string) => string; normalizeHtml: (htmlContent: string) => string; trimRichTextWhitespace: (html: string | null | undefined) => string; handleMarkdownShortcuts: (containerElement: HTMLElement, onBeforeConversion?: () => void) => boolean; clearPendingFormats: () => void; getPendingFormats: () => FormatType[]; getTextOffsetAtCursor: (containerElement: HTMLElement) => number; setCursorByTextOffset: (containerElement: HTMLElement, offset: number) => void; convertMarkdownToFormat: (containerElement: HTMLElement, startOffset: number, endOffset: number, contentStart: number, contentEnd: number, formatType: FormatType, linkUrl?: string) => void; positionCursorAfterFormat: (containerElement: HTMLElement, formattedNode: Node) => void; applyMarkdownConversion: (containerElement: HTMLElement, match: { startOffset: number; endOffset: number; contentStart: number; contentEnd: number; linkUrl?: string; }, formatType: FormatType) => void; }; export default useRichTextFormatting;