@veltdev/tiptap-velt-comments
Version:
Tiptap Extension to add Google Docs-style overlay comments to your Tiptap editor. Works with the Velt Collaboration SDK.
44 lines (43 loc) • 1.82 kB
TypeScript
import { Editor, Mark } from '@tiptap/core';
import { CommentAnnotation } from '@veltdev/types';
import { TiptapVeltCommentConfig } from "./types";
export declare const triggerAddComment: (editor: Editor, config?: TiptapVeltCommentConfig) => Promise<void>;
export 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
*/
export declare const addComment: ({ editorId, editor, context: clientContext, }: AddCommentRequest) => Promise<void>;
export declare const addTiptapVeltComment: (editor: Editor, config?: TiptapVeltCommentConfig) => Promise<void>;
export 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;
};
}
}
export declare const TiptapVeltComments: Mark<TiptapVeltCommentsOptions, any>;
export default TiptapVeltComments;
export declare function highlightComments(editor: Editor, commentAnnotations: CommentAnnotation[], editorId?: string): void;
export interface RenderCommentsRequest {
editor: Editor;
editorId?: string;
commentAnnotations?: CommentAnnotation[];
}
export declare const renderComments: ({ editor, editorId, commentAnnotations }: RenderCommentsRequest) => void;