modules: { comments: { readOnly: false, allowResolve: true } }
// Add comment at selection editor.commands.addComment({ content: 'Please review' }); // Work with comments editor.commands.replyToComment(commentId, { content: 'Done' }); editor.commands.resolveComment(commentId); editor.commands.deleteComment(commentId); // Navigate editor.commands.goToNextComment(); editor.commands.goToPreviousComment();
superdoc.on('commentsUpdate', ({ type, comment }) => { switch(type) { case 'add': // Comment created case 'update': // Comment edited case 'delete': // Comment removed case 'resolved': // Comment resolved } });
// Access all comments const comments = editor.storage.comments.items; // Filter comments const active = comments.filter(c => !c.resolved); const byUser = comments.filter(c => c.user.email === email);
// Include comments await superdoc.export({ commentsType: 'external' }); // Clean export await superdoc.export({ commentsType: 'clean' });
.comment-mark { background: #fff3cd; } .comment-mark.resolved { opacity: 0.6; } .comment-mark.active { background: #ffd700; }
Was this page helpful?