@veltdev/tiptap-velt-comments
Version:
Tiptap Extension to add Google Docs-style overlay comments to your Tiptap editor. Works with the Velt Collaboration SDK.
62 lines (61 loc) • 1.89 kB
TypeScript
/**
* Public API for Tiptap-Velt Comments extension.
*
* This module exports the public API surface for the v2 implementation.
*
* @example
* ```typescript
* import { TiptapVeltComments, addComment, renderComments } from 'tiptap-velt-comments';
*
* // Use the extension
* const editor = new Editor({
* extensions: [TiptapVeltComments.configure({ editorId: 'my-editor' })],
* });
*
* // Add a comment
* await addComment({ editorId: 'editor-id', editor, context: { customData: 'value' } });
*
* // Render existing comments
* renderComments({ editorId: 'editor-id', editor, commentAnnotations: annotations });
* ```
*/
declare module '@tiptap/core' {
interface Commands<ReturnType> {
tiptapVeltComments: {
setVeltComment: (annotationId?: string, multiThreadAnnotationId?: string, from?: number, to?: number) => ReturnType;
};
}
}
export { addComment } from '@/features/addComment';
/**
* Renders comment annotations as marks in the editor.
*
* @param request - Object containing editor, editorId (optional), and commentAnnotations (optional)
*
* @example
* ```typescript
* // Simple usage
* renderComments({ editor });
*
* // With editor ID and annotations
* renderComments({
* editorId: 'my-editor',
* editor,
* commentAnnotations: annotations
* });
* ```
*/
export { renderComments } from '@/features/renderComments';
/**
* Tiptap extension for Velt comments integration.
*
* @example
* ```typescript
* const editor = new Editor({
* extensions: [TiptapVeltComments.configure({ editorId: 'my-editor' })],
* });
* ```
*/
export { VeltCommentsExtension as TiptapVeltComments } from '@/core/extension';
export type { AddCommentRequest, CommentAnnotationContext, RenderCommentsRequest } from '@/types/common';
export type { VeltCommentsExtensionConfig as TiptapVeltCommentsOptions } from '@/types/host';