import { Mark, Range } from '@tiptap/core'; import { Mark as PMMark } from '@tiptap/pm/model'; import { PluginKey, EditorState } from '@tiptap/pm/state'; import { DecorationSet } from '@tiptap/pm/view'; import { SuggestionType } from '../../types'; declare module '@tiptap/core' { interface Commands { comment: { /** * Set a comment (add) */ setComment: (commentId: string) => ReturnType; /** * Unset a comment (remove completely) */ unsetComment: (commentId: string) => ReturnType; /** * Resolve a comment (keep ID but update styling) */ resolveComment: (commentId: string) => ReturnType; /** * Unresolve a comment (switch back to unresolved state) */ unresolveComment: (commentId: string) => ReturnType; /** * Set a comment active */ setCommentActive: (commentId: string) => ReturnType; /** * Unset comment active */ unsetCommentActive: () => ReturnType; /** * Add a local draft anchor that tracks through transactions. */ setDraftComment: (draftId: string) => ReturnType; /** * Remove a local draft anchor. */ unsetDraftComment: (draftId: string) => ReturnType; /** * Replace a draft anchor with a persisted comment mark. */ promoteDraftComment: (draftId: string, commentId: string) => ReturnType; }; } } export interface MarkWithRange { mark: PMMark; range: Range; } export interface CommentMarkMatch { commentId: string; resolved: boolean; } export interface CommentOptions { HTMLAttributes: Record; onCommentActivated: (commentId: string) => void; onCommentResolved?: (commentId: string) => void; onCommentUnresolved?: (commentId: string) => void; onCommentDeleted?: (commentId: string) => void; } export interface CommentStorage { activeCommentId: string | null; } export interface DraftCommentRange { draftId: string; from: number; to: number; } interface DraftCommentPluginState { decorations: DecorationSet; drafts: Map; } export declare const draftCommentPluginKey: PluginKey; export declare const getDraftCommentState: (state: EditorState) => DraftCommentPluginState | undefined; export declare const getDraftCommentRange: (state: EditorState, draftId: string) => DraftCommentRange | null; export declare const getCommentMarkAtPosition: (state: EditorState, pos: number) => CommentMarkMatch | null; export declare const getCommentMarkRange: (state: EditorState, commentId: string) => Range | null; export interface IComment { id?: string; tabId?: string; username?: string; reactions?: { count: number; type: string; }[]; selectedContent?: string; content?: string; replies?: IComment[]; createdAt?: Date; resolved?: boolean; deleted?: boolean; commentIndex?: number; version?: string; isSuggestion?: boolean; suggestionType?: SuggestionType; originalContent?: string; suggestedContent?: string; } export declare const CommentExtension: Mark; export {};