Live comments API
Create and manage document review threads
Attach a comment to selected text, inspect its author and anchored range, add replies, and resolve or remove review items without changing the document content.
Ready to tryUse the controls above to interact with this demo.
What this demonstrates
Comments combine review metadata with an anchored text range
A CommentedText object stores the reviewer message together with the exact document range it discusses. This allows applications to build custom review experiences while retaining compatibility with the comments used by Microsoft Word.
Comment collection
TXTextControl.comments
New review item
CommentCollection.add
Thread replies
CommentCollection.addReply
Comment metadata
CommentedText
How it works
CommentCollection.add uses the current selection as the comment anchor. The callback returns the newly created CommentedText, which exposes its message, author, creation time, one-based start, length, highlight color, active state, and replies.
commentedTextEntered and commentedTextLeft keep the inspector synchronized as the caret enters or leaves highlighted text. Collection events such as commentCreated, commentChanged, and commentDeleted update the review list when either this panel or the built-in sidebar changes the document.
CommentedText.setComment edits the message without altering its anchor. setActive(false) resolves a comment by making it inactive, while CommentCollection.remove deletes only the review metadata and preserves the underlying document text.
TXTextControl.comments.add(
"Please review this wording.",
result => {
result.comment.scrollTo();
},
showCommentError);
NuGet packages
TXTextControl.TextControl.Core.SDK
34.0.4
Provides the core document model and server-side document processing APIs.
dotnet add package TXTextControl.TextControl.Core.SDK --version 34.0.4
Provides the browser-based TX Text Control document editor and JavaScript API.
dotnet add package TXTextControl.Web --version 34.4.0
TXTextControl.Web.DocumentEditor.Backend
34.4.0
Hosts the WebSocket-based backend used by the browser document editor.
dotnet add package TXTextControl.Web.DocumentEditor.Backend --version 34.4.0