DS Server

Javascript: MisspelledWordCollection.ignore Method

Method|Introduced in 28.0

Description

Changes the text of the specified misspelled word and marks it as ignored. Ignored misspelled words are not underlined with a red zigzag line.

Syntax

<void> MisspelledWordCollection.ignore(<MisspelledWord> misspelledWord, <String> changedText, <RequestBooleanCallback> callback, [<ErrorCallback> errorCallback])

Parameters

ParameterDescription
misspelledWord

Specifies the misspelled word to change.

changedText

Specifies the changed text. The current text of the word is replaced with this text.

callback

Receives whether the misspelled word could be changed.

errorCallback

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

Examples

The following example demonstrates MisspelledWordCollection.ignore in a practical document-editing workflow. It changes the text of the specified misspelled word and marks it as ignored. Ignored misspelled words are not underlined with a red zigzag line.

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

function ignore(misspelledWords, misspelledWord) {
    misspelledWords.ignore(
        misspelledWord,
        "Quarterly report",
        function(result) {
            if (result) {
                console.log("ignore is available.");
            } else {
                console.warn("ignore is not available in the current document state.");
            }
        },
        onTxError
    );
}