import { Extension } from '@tiptap/core'; import { PluginKey } from '@tiptap/pm/state'; import { SuggestionType } from '../../types'; import { CommentAnchor } from '../comment/comment-decoration-plugin'; import * as Y from 'yjs'; export interface SuggestionReadyData { suggestionId: string; anchorFrom: Y.RelativePosition; anchorTo: Y.RelativePosition; suggestionType: SuggestionType; originalContent: string; suggestedContent: string; } export interface SuggestionTrackingOptions { /** Returns true when the editor is in suggestion mode. */ getIsSuggestionMode: () => boolean; /** Viewer types text with a collapsed cursor (Add gesture). */ onTextInput: (text: string) => void; /** Viewer types text over a non-empty selection (Replace gesture). */ onReplaceTyping: (from: number, to: number, text: string) => void; /** Viewer presses Backspace/Delete with a non-empty selection. */ onDeleteSelection: (from: number, to: number) => void; /** Viewer pastes a link over selected text. */ onPasteLink: (from: number, to: number, href: string) => void; /** Viewer attempted an unsupported paste/drop in suggestion mode. */ onUnsupportedPaste?: () => void; /** * Viewer presses Backspace/Delete with a collapsed cursor. * The consumer decides whether this should shrink an active draft or create * a new one-character delete suggestion at the caret. */ onDeleteAtCursor: (direction: 'backward' | 'forward') => void; /** * Browser attempted to delete a concrete range without an explicit * user selection (for example, a beforeinput/IME path that bypassed * keydown). Lets the consumer preserve "undo active draft" semantics * while still creating delete drafts for normal text. */ onDeleteRangeWithoutSelection: (from: number, to: number) => void; /** Viewer presses Cmd+Z (or Ctrl+Z). Shrinks the active draft by one keystroke. */ onUndo: () => void; onLiveSuggestion?: ((anchor: CommentAnchor) => void) | null; onSuggestionReady?: ((data: SuggestionReadyData) => void) | null; } export declare const suggestionTrackingPluginKey: PluginKey; /** * Meta key set on transactions that toggle a heading's `isCollapsed` attribute. * Such transactions are UI-state changes (folding/unfolding sections), not * content edits — `filterTransaction` lets them through in suggest mode. */ export declare const HEADING_COLLAPSE_TOGGLE_META = "heading-collapse-toggle"; export declare const SuggestionTrackingExtension: Extension;