DS Server

Javascript: CommentCollection.addReply Method

Method|Introduced in 30.0

Description

Creates a reply to an existing comment using the specified comment string.

Syntax

<void> CommentCollection.addReply(<string> comment, <CommentedText> repliedComment, [<AddCommentCallback> callback], [<ErrorCallback> errorCallback])

Parameters

ParameterDescription
comment

The comment string.

repliedComment

The comment to which to reply.

callback

Optional. Receives the result of the add operation.

errorCallback

Optional. Is called when the operation failed with an error.

Examples

The following example resolves the comment at the input position and adds a review reply to it.

function onTxError(error) {
    console.error("TX Text Control error:", error.msg);
    error.handled = true;
}

TXTextControl.textParts.getMainText(function(mainText) {
    mainText.comments.getItem(function(currentComment) {
        if (!currentComment) {
            console.warn("Place the input position in a comment.");
            return;
        }

        mainText.comments.addReply(
            "I reviewed this section and approved the change.",
            currentComment,
            function(response) {
                console.log("Reply added:", response);
            },
            onTxError
        );
    }, onTxError);
}, onTxError);