Javascript: TXTextControl.getCanPaste Method
Description
Informs whether the document's text and/or formatting attributes can be changed. The value depends on DocumentPermissions.readOnly and the currently set edit mode.
Syntax
<void> TXTextControl.getCanPaste(<RequestBooleanCallback> callback, [<ErrorCallback> errorCallback])Parameters
| Parameter | Description |
|---|---|
| callback | The callback function that receives the requested value. |
| errorCallback | Optional. Is called when the operation failed with an error. |
Examples
The following example demonstrates TXTextControl.getCanPaste in a practical document-editing workflow. Informs whether the document's text and/or formatting attributes can be changed. The value depends on DocumentPermissions.readOnly and the currently set edit mode.
function onTxError(error) {
console.error("TX Text Control error:", error.msg);
error.handled = true;
}
TXTextControl.getCanPaste(
function(result) {
if (result) {
console.log("get can paste is available.");
} else {
console.warn("get can paste is not available in the current document state.");
}
},
onTxError
);