diff --git a/modules/tiptap/client/extensions/Comment/Comment.ts b/modules/tiptap/client/extensions/Comment/Comment.ts index ea9b5b8fcd792d24ba0d483840523471aebe6528..8c5f1aabfd1ee4bc0f9afe5ecd5fa15fd92880d4 100644 --- a/modules/tiptap/client/extensions/Comment/Comment.ts +++ b/modules/tiptap/client/extensions/Comment/Comment.ts @@ -30,6 +30,7 @@ const COMMENT_EXTENSION_NAME = 'comments'; interface CommentExtensionOptions { /** Custom provider for username or username+userID */ userProvider?: Observable<string | { userID: string; username: string }>; + addCommentCallback?: () => void; } /** @@ -180,6 +181,9 @@ export function createCommentExtension(options: CommentExtensionOptions): { icon: 'add_comment', tooltip: host.translator.translate('tiptap', 'comment', 'tooltip', 'addComment'), action: () => { + if (options.addCommentCallback) { + options.addCommentCallback(); + } editor.chain().addComment().run(); }, },