/** * RICH TEXT EDITOR CORE * ContentEditable-based collaborative text editor * Integrates with OT for character-level operations * * Features: * - Character-level insert/delete operations * - Formatting: bold, italic, underline, strikethrough * - Lists: ordered, unordered, nested * - Links and mentions * - Collaboration cursors (other users' positions) * - Undo/redo with OT-based history * - Paste handling with format preservation */ import type { OTOperation, UserId } from '../types'; export interface RichTextFormat { bold?: boolean; italic?: boolean; underline?: boolean; strikethrough?: boolean; link?: string; mention?: UserId; code?: boolean; } export interface FormattedText { text: string; format: RichTextFormat; } export interface EditorSelection { anchor: number; focus: number; } export interface CollaborationCursor { userId: UserId; position: number; selection: EditorSelection; color: string; name: string; timestamp: number; } /** * Convert selection to character-level OT operations */ export declare function selectionToOperations(oldContent: string, newContent: string, _position: number, userId: UserId): OTOperation[]; /** * Apply formatting to text range */ export declare function applyFormatting(text: string, _start: number, _end: number, _format: RichTextFormat): string; /** * Remove formatting from text range */ export declare function removeFormatting(text: string, _start: number, _end: number, _formatKey: keyof RichTextFormat): string; /** * Get formatting at cursor position */ export declare function getFormatAtPosition(_content: string, _position: number): RichTextFormat; /** * Insert link at selection */ export declare function insertLink(text: string, start: number, end: number, _url: string): string; /** * Insert mention at cursor */ export declare function insertMention(text: string, position: number, _userId: UserId, userName: string): string; /** * Handle paste event: strip unwanted formatting, preserve text */ export declare function sanitizePastedContent(html: string): string; /** * Transform cursor position when other user's operation applied */ export declare function transformCursorPosition(cursorPosition: number, operation: OTOperation): number; /** * Get formatted sections from content */ export declare function extractFormattedSections(content: string): FormattedText[]; /** * Export content as plain text */ export declare function exportAsPlainText(content: string): string; /** * Export content as HTML */ export declare function exportAsHTML(content: string, formats: Map): string; /** * Split content by lines */ export declare function splitByLines(content: string): string[]; /** * Join lines back */ export declare function joinLines(lines: string[]): string; //# sourceMappingURL=rich-text.d.ts.map