Javascript: DocumentLinkCollection.clear Method
Description
Removes all document links from the collection.
Syntax
<void> DocumentLinkCollection.clear(<boolean> keepText, [<EmptyRequestCallback> callback], [<ErrorCallback> errorCallback])Parameters
| Parameter | Description |
|---|---|
| keepText | If this parameter is set to true, all document links are removed without deleting their texts. Otherwise, the texts are also deleted. |
| callback | Optional. Is called when the operation completed. |
| errorCallback | Optional. Is called when the operation failed with an error. |
Examples
The following example demonstrates DocumentLinkCollection.clear in a practical document-editing workflow. It removes all document links from the collection.
function onTxError(error) {
console.error("TX Text Control error:", error.msg);
error.handled = true;
}
TXTextControl.textParts.getMainText(function(mainText) {
const documentLinks = mainText.documentLinks;
documentLinks.clear(
true,
function() {
console.log("clear completed.");
},
onTxError
);
}, onTxError);