DS Server

Javascript: Selection.removeFormatting Method

Method|Introduced in 24.0

Description

Resets all character based formatting attributes of the selected text to its default values. If nothing or more than one paragraph is selected, all paragraph based formatting attributes are also reset.

Syntax

<void> Selection.removeFormatting([<EmptyRequestCallback> callback], [<ErrorCallback> errorCallback])

Parameters

ParameterDescription
callback

Optional. Is called when the operation completed.

errorCallback

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

Examples

The following example demonstrates Selection.removeFormatting in a practical document-editing workflow. Resets all character based formatting attributes of the selected text to its default values. If nothing or more than one paragraph is selected, all paragraph based formatting attributes are also reset.

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

TXTextControl.selection.removeFormatting(
    function() {
        console.log("remove formatting completed.");
    },
    onTxError
);