Javascript: EditableRegionCollection.getItems Method
Description
Gets all editable regions at the current text input position. The callback returns null, if there is no region at the current input position.
Syntax
<void> EditableRegionCollection.getItems(<RequestEditableRegionsCallback> callback, [<ErrorCallback> errorCallback])Parameters
| Parameter | Description |
|---|---|
| callback | Receives all editable regions at the current text input position. |
| errorCallback | Optional. Is called when the operation failed with an error. |
Examples
The following example demonstrates EditableRegionCollection.getItems in a practical document-editing workflow. It gets all editable regions at the current text input position. The callback returns null, if there is no region at the current input position.
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);