Usage Example
The TextAreaTextWriter implementation is provided to write in TextArea elements. The TextWriter must be established after the session starts via the API.
Use the API to call this writer: INVOX.TextAreaTextWriter.
Setup
- Assign the TextWriter to be used:
INVOX.SetTextWriter(INVOX.TextAreaTextWriter); - Create the target element(s):
<textarea id="invox-textarea-1" class="form-control" placeholder="Recognized text..."></textarea> <textarea id="invox-textarea-2" class="form-control" placeholder="Recognized text..."></textarea> - Set the active writing target:
const editorInstance = document.querySelector("#invox-textarea-1"); INVOX.SetWriterTarget(editorInstance); - To switch to the other WriterTarget:
const editorInstance = document.querySelector("#invox-textarea-2"); INVOX.SetWriterTarget(editorInstance);When switching to a different target of the same writer type, you do not need to callSetTextWriteragain.
Full example
document.addEventListener(INVOX.eventTypeReport.LOGIN_SUCCESS, () => {
// Set the writer type
INVOX.SetTextWriter(INVOX.TextAreaTextWriter);
// Set the first target
const firstTextarea = document.querySelector("#invox-textarea-1");
INVOX.SetWriterTarget(firstTextarea);
});
// Switch to another target on click
document.querySelector("#invox-textarea-2").addEventListener("focus", function() {
INVOX.SetWriterTarget(this);
});
Table of Contents