DS Server

Javascript: CommentCollection.remove Method

Method|Introduced in 30.0

Description

Removes a comment from the collection.

Syntax

<void> CommentCollection.remove(<CommentedText> comment, [<RequestBooleanCallback> callback], [<ErrorCallback> errorCallback])

Parameters

ParameterDescription
comment

Specifies the comment to remove.

callback

Optional. Receives whether the removal was successful.

errorCallback

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

Examples

The following example demonstrates CommentCollection.remove in a practical document-editing workflow. It removes a comment from the collection.

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

function remove(comment) {
    TXTextControl.textParts.getMainText(function(mainText) {
        const comments = mainText.comments;
        comments.remove(
            comment,
            function(result) {
                if (result) {
                    console.log("remove is available.");
                } else {
                    console.warn("remove is not available in the current document state.");
                }
            },
            onTxError
        );
    }, onTxError);
}