@veltdev/tiptap-velt-comments
Version:
Tiptap Extension to add Google Docs-style overlay comments to your Tiptap editor. Works with the Velt Collaboration SDK.
54 lines (53 loc) • 1.45 kB
TypeScript
/**
* Common type definitions shared across the entire codebase.
* These types are SDK-agnostic and represent domain concepts.
*/
import type { CommentAnnotation } from '@/types/velt';
/**
* Context object for comment annotations.
* Contains text editor configuration and any additional context data.
*/
export interface CommentAnnotationContext {
textEditorConfig?: {
text: string;
occurrence: number;
editorId?: string;
targetTextNodeId?: string;
};
[key: string]: unknown;
}
/**
* Request interface for addComment function.
* Matches legacy AddCommentRequest interface.
*/
export interface AddCommentRequest {
editorId?: string;
editor: unknown;
context?: CommentAnnotationContext;
}
/**
* Request interface for renderComments function.
* Matches legacy RenderCommentsRequest interface.
*/
export interface RenderCommentsRequest {
editor: unknown;
editorId?: string;
commentAnnotations?: CommentAnnotation[];
}
/**
* Extension configuration for registry.
*/
export interface ExtensionConfig {
persistVeltMarks?: boolean;
editorId?: string;
HTMLAttributes?: Record<string, unknown>;
}
/**
* Editor context containing editor instance and related state.
* Note: Editor type is generic to avoid importing editor types here.
*/
export interface EditorContext<TEditor = unknown> {
editorId: string;
editor: TEditor;
config: ExtensionConfig;
}