# EditableRegionCollection Object

> 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.

- **Product:** DS Server
- **Section:** Reference
- **Kind:** Object
- **Introduced:** 28.0
- **Path:** DS Server > Reference > JavaScript API > EditableRegionCollection Object
- **760 words**
- **Web URL:** https://docs.textcontrol.com/ds-server/reference/javascript/editableregioncollection/
- **LLMs URL:** https://docs.textcontrol.com/ds-server/reference/javascript/editableregioncollection/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/ds-server/reference/javascript/editableregioncollection/llms-full.txt

---

### Description

Contains all [editable regions](https://docs.textcontrol.com/ds-server/reference/javascript/editableregion/llms-full.txt) in the main text or another part of a document. When the [EditMode](https://docs.textcontrol.com/ds-server/reference/javascript/txtextcontrol/geteditmode-method/llms-full.txt) has been set to ReadAndSelect, editable regions can still be edited, by a certain [user](https://docs.textcontrol.com/ds-server/reference/javascript/editableregion/getusername-method/llms-full.txt).

### Syntax

```javascript
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.

```javascript
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);
```

---

## In This Section

- [Javascript: EditableRegionCollection.add Method](https://docs.textcontrol.com/ds-server/reference/javascript/editableregioncollection/add-method/llms-full.txt): Adds 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.
- [Javascript: EditableRegionCollection.getItems Method](https://docs.textcontrol.com/ds-server/reference/javascript/editableregioncollection/getitems-method/llms-full.txt): Gets all editable regions at the current text input position. The callback returns null, if there is no region at the current input position.
- [Javascript: EditableRegionCollection.remove Method](https://docs.textcontrol.com/ds-server/reference/javascript/editableregioncollection/remove-method/llms-full.txt): Removes an editable region from the collection. The region's text is not removed.

---

## Nearby

- **Previous:** [Javascript: EditableRegionCallbackData.editableRegion Property](https://docs.textcontrol.com/ds-server/reference/javascript/editableregioncallbackdata/editableregion-property/llms-full.txt)
- **Next:** [Javascript: EditableRegionCollection.add Method](https://docs.textcontrol.com/ds-server/reference/javascript/editableregioncollection/add-method/llms-full.txt)
