Javascript: Selection.getFormattingStyle Method
Description
Gets the formatting style of the selected text.
Syntax
<void> Selection.getFormattingStyle(<RequestStringCallback> callback, [<ErrorCallback> errorCallback])Parameters
| Parameter | Description |
|---|---|
| callback | Receives the formatting style of the selected text or an empty string when the text selection contains multiple characters with different styles. |
| errorCallback | Optional. Is called when the operation failed with an error. |
Examples
The following example demonstrates Selection.getFormattingStyle in a practical document-editing workflow. It gets the formatting style of the selected text.
function onTxError(error) {
console.error("TX Text Control error:", error.msg);
error.handled = true;
}
TXTextControl.selection.getFormattingStyle(
function(result) {
console.log("get formatting style result:", result);
},
onTxError
);