Javascript: CommentedText.getRepliedComment Method
Description
Gets the comment for which this comment is a reply. When this comment is not a reply, null is returned.
Syntax
<void> CommentedText.getRepliedComment(<RequestCommentCallback> callback, [<ErrorCallback> errorCallback])Parameters
| Parameter | Description |
|---|---|
| callback | Receives the property value. |
| errorCallback | Optional. Is called when the operation failed with an error. |
Examples
The following example demonstrates CommentedText.getRepliedComment in a practical document-editing workflow. It gets the comment for which this comment is a reply. When this comment is not a reply, null is returned.
function onTxError(error) {
console.error("TX Text Control error:", error.msg);
error.handled = true;
}
TXTextControl.textParts.getMainText(function(mainText) {
const comments = mainText.comments;
comments.getItem(function(commentedText) {
if (!commentedText) {
console.warn("No commented text is available at the current input position.");
return;
}
commentedText.getRepliedComment(
function(comment) {
if (!comment) {
console.warn("No commented text was returned.");
return;
}
console.log("get replied comment result:", comment);
},
onTxError
);
}, onTxError);
}, onTxError);