@veltdev/tiptap-velt-comments
Version:
Tiptap Extension to add Google Docs-style overlay comments to your Tiptap editor. Works with the Velt Collaboration SDK.
55 lines (54 loc) • 1.59 kB
TypeScript
/**
* Host adapter type definitions.
* These types represent editor-specific concepts.
* NOTE: This is the ONLY place where editor-specific types should be defined.
*/
import type { AnnotationData } from '@/types/state';
/**
* Extension configuration options for VeltCommentsExtension.
*/
export interface VeltCommentsExtensionConfig {
HTMLAttributes: Record<string, unknown>;
persistVeltMarks: boolean;
editorId?: string;
extensionName?: string;
}
/**
* Extension storage interface.
* Represents the storage structure for the extension.
* This is editor-specific as it represents the storage pattern used by the editor.
*/
export interface ExtensionStorage {
persistVeltMarks?: boolean;
editorId?: string;
}
/**
* Context extracted from the current editor selection.
* Contains text, position, occurrence, and container information.
*/
export interface SelectionContext {
text: string;
from: number;
to: number;
occurrence: number;
targetTextNodeId?: string;
locationId?: string;
}
/**
* Represents a detected change to an annotation during document editing.
* Matches legacy AnnotationChange interface.
*/
export interface AnnotationChange {
annotationId: string;
multiThreadAnnotationId?: string;
originalText: string;
currentText: string;
originalOccurrence: number;
currentOccurrence: number;
originalTargetTextNodeId: string;
newTargetTextNodeId: string;
annotation: AnnotationData;
contentChanged: boolean;
occurrenceChanged: boolean;
targetTextNodeIdChanged: boolean;
}