TX Text Control .NET Server

EditableRegionCollection Object

Object|Introduced in 28.0

Description

Contains all editable regions in the main text or another part of a document. When the EditMode has been set to ReadAndSelect, editable regions can still be edited, by a certain user.

Syntax

EditableRegionCollection

Examples

The following example demonstrates EditableRegionCollection in a practical document-editing workflow. It contains all editable regions in the main text or another part of a document. When the EditMode has been set to ReadAndSelect, editable regions can still be edited, by a certain user.

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

TXTextControl.textParts.getMainText(function(mainText) {
    const editableRegions = mainText.editableRegions;
    editableRegions.getItems(
        function(result) {
            if (!result) {
                console.warn("No editable region was returned.");
                return;
            }
            
            console.log("get items result:", result);
        },
        onTxError
    );
}, onTxError);

Members

Methods

MethodDescription
addAdds a new editable region to the document. Its position is defined through the start and length parameters. If the editable region's length is zero, the current text selection is used to define the position.
elementAtReturns the element at a specified index in the collection. (Inherited from Collection.)
forEachExecutes a callback function for each element. (Inherited from Collection.)
getCountGets the number of elements contained in the collection. (Inherited from Collection.)
getItemsGets all editable regions at the current text input position. The callback returns null, if there is no region at the current input position.
removeRemoves an editable region from the collection. The region's text is not removed.

Further Reading

  • Web Document Editor: Using Document Permissions –