DS Server

Javascript: TXTextControl.saveSelection Method

MethodDeprecated|Introduced in 23.0

Description

Obsolete. This method will be removed in one of the next versions. Saves the current selection in a certain format and sends the result back asynchronously by calling a given callback function.

Syntax

<void> TXTextControl.saveSelection(<StreamType> streamType, <SaveDocumentResultCallback> callback)

Parameters

ParameterDescription
streamType

Specifies one of the StreamType values.

callback

A function with one parameter. Is called with an argument object of type SaveDocumentResult containing the selection content after the selection has been saved successfully.

Examples

For an example on how to use this function have a look at the description of the saveDocument function.

The following example demonstrates TXTextControl.saveSelection in a practical document-editing workflow. Obsolete. This method will be removed in one of the next versions. Saves the current selection in a certain format and sends the result back asynchronously by calling a given callback function.

TXTextControl.saveSelection(
    TXTextControl.StreamType.HTMLFormat,
    function(args) {
        if (!args) {
            console.warn("No save document result was returned.");
            return;
        }
        
        console.log("save selection result:", args);
    }
);