/** * Type definitions for the docs module. */ import type { Editor } from '@tiptap/core'; export interface SearchState { query: string; caseSensitive: boolean; regex: boolean; results: SearchResult[]; currentIndex: number; } export interface SearchResult { from: number; to: number; } export interface OutlineItem { level: number; text: string; id: string; } export interface OutlineTreeNode extends OutlineItem { children: OutlineTreeNode[]; } export interface SlashCommandItem { id: string; name: string; description: string; category: string; icon: string; shortcut: string | null; } export interface SlashCommandCategory { id: string; label: string; } export interface SlashCommandGroup { id: string; label: string; items: SlashCommandItem[]; } export interface MarkdownOptions { gfm?: boolean; tables?: boolean; taskLists?: boolean; } export interface BlockHandlePosition { top: number; left: number; } export interface BlockHandleAction { id: string; label: string; icon: string; } export interface TurnIntoItem { id: string; name: string; icon: string; } export interface TooltipPosition { top: number; left: number; } export interface LinkPreviewData { href: string; position: TooltipPosition; } export interface TableCommand { label: string; icon: string; command: string; } export interface TableCommandMap { [key: string]: TableCommand; } export interface CellAttrs { background?: string; backgroundColor?: string; } export interface PdfExportOptions { editorHtml: string; title: string; } export interface DocxConvertResult { html: string; messages: DocxMessage[]; } export interface DocxMessage { type: string; message: string; } export type TabAction = 'indent' | 'outdent' | 'insertTab' | 'noop'; export interface TabContext { isInList: boolean; isInCodeBlock: boolean; shiftKey: boolean; } export interface AutoformatRule { id: string; description: string; trigger: string; regex: RegExp; source: string; custom: boolean; } export interface AutoformatMatch { id: string; match: RegExpMatchArray; } export interface ParsedLink { text: string; href: string; } export interface MarkdownToggleOptions { getEditorHtml: () => string; setEditorHtml: (html: string) => void; htmlToMarkdown: (html: string) => string; markdownToHtml: (md: string) => string; onModeChange?: (mode: string) => void; } export interface MarkdownToggleApi { toggle: () => void; getMode: () => string; isMarkdownMode: () => boolean; getMarkdownContent: () => string; setMarkdownContent: (content: string) => void; } export interface ShortcutEntry { keys: string[]; label: string; } export interface ShortcutCategory { category: string; shortcuts: ShortcutEntry[]; } export type CommandExecutor = (editor: Editor) => void; export interface SlashCommandsConfig { onStart?: (props: SuggestionCallbackProps) => void; onUpdate?: (props: SuggestionCallbackProps) => void; onExit?: () => void; onKeyDown?: (props: { event: KeyboardEvent }) => boolean; items: (query: string) => SlashCommandExecutableItem[]; } export interface SlashCommandExecutableItem extends SlashCommandItem { execute: CommandExecutor; } export interface SuggestionCallbackProps { query: string; command: (item: SlashCommandExecutableItem) => void; clientRect?: (() => DOMRect | null) | null; } export interface SearchReplaceStorage { searchTerm: string; replaceTerm: string; caseSensitive: boolean; matches: SearchResult[]; activeIndex: number; isOpen: boolean; showReplace: boolean; } export type BlockHandleMode = 'normal' | 'zen' | 'print'; export interface LinkAttrs { href?: string; } export interface CommentAttrs { commentId: string; author: string; timestamp: string; text: string; } export interface SuggestionMarkAttrs { suggestionId: string | null; author: string | null; timestamp: string | null; } export interface ActiveComment { id: string; element: Element; } export interface ActiveSuggestion { id: string; element: Element; type: 'insert' | 'delete'; }