UNPKG

@veltdev/tiptap-velt-comments

Version:

Tiptap Extension to add Google Docs-style overlay comments to your Tiptap editor. Works with the Velt Collaboration SDK.

50 lines (45 loc) 1.95 kB
import { Editor, Mark } from '@tiptap/core'; import { CommentAnnotation } from '@veltdev/types'; interface TiptapVeltCommentConfig { context?: any; } declare const triggerAddComment: (editor: Editor, config?: TiptapVeltCommentConfig) => Promise<void>; interface AddCommentRequest { editorId?: string; editor: Editor; context?: unknown; } /** * Creates a comment annotation for the currently selected text in the editor * This function handles the entire flow from getting the selected text to creating * the actual comment through the Velt service */ declare const addComment: ({ editorId, editor, context: clientContext, }: AddCommentRequest) => Promise<void>; declare const addTiptapVeltComment: (editor: Editor, config?: TiptapVeltCommentConfig) => Promise<void>; interface TiptapVeltCommentsOptions { HTMLAttributes: Record<string, any>; persistVeltMarks: boolean; editorId?: string; } declare module '@tiptap/core' { interface Commands<ReturnType> { tiptapVeltComments: { setVeltComment: (annotationId?: string, multiThreadAnnotationId?: string, from?: number, to?: number) => ReturnType; }; } interface Storage { tiptapVeltComments: { persistVeltMarks: boolean; editorId?: string; }; } } declare const TiptapVeltComments: Mark<TiptapVeltCommentsOptions, any>; declare function highlightComments(editor: Editor, commentAnnotations: CommentAnnotation[], editorId?: string): void; interface RenderCommentsRequest { editor: Editor; editorId?: string; commentAnnotations?: CommentAnnotation[]; } declare const renderComments: ({ editor, editorId, commentAnnotations }: RenderCommentsRequest) => void; export { AddCommentRequest, RenderCommentsRequest, TiptapVeltComments, TiptapVeltCommentsOptions, addComment, addTiptapVeltComment, TiptapVeltComments as default, highlightComments, renderComments, triggerAddComment };