DS Server

Javascript: InlineStyle.isInheritedFromParagraph Method

Method|Introduced in 28.0

Description

Informs about whether one or more of the style's attributes are inherited from the surrounding paragraph.

Syntax

<void> InlineStyle.isInheritedFromParagraph(<InlineStyle.Attributes> attributes, <RequestBooleanCallback> callback, [<ErrorCallback> errorCallback])

Parameters

ParameterDescription
attributes

Specifies one or more attributes.

callback

Receives true, if the specified attributes are inherited from the paragraph. Otherwise it is false.

errorCallback

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

Examples

The following example demonstrates InlineStyle.isInheritedFromParagraph in a practical document-editing workflow. Informs about whether one or more of the style's attributes are inherited from the surrounding paragraph.

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

function isInheritedFromParagraph(inlineStyle, attributes) {
    inlineStyle.isInheritedFromParagraph(
        attributes,
        function(result) {
            if (result) {
                console.log("is inherited from paragraph is available.");
            } else {
                console.warn("is inherited from paragraph is not available in the current document state.");
            }
        },
        onTxError
    );
}