Skip to content

Instantly share code, notes, and snippets.

@bjoerntx
Created January 17, 2023 12:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bjoerntx/3839fb4ff97f4abe4fd23322e45d3d7f to your computer and use it in GitHub Desktop.
Save bjoerntx/3839fb4ff97f4abe4fd23322e45d3d7f to your computer and use it in GitHub Desktop.
TXTextControl.addEventListener("inputPositionChanged", function (position) {
// if input position is is not coherent, reset character array
if (position.textPosition < trackedInputPosition - 1 || position.textPosition > trackedInputPosition + 1) {
charCodes = [];
}
// set current input position
trackedInputPosition = position.textPosition;
})
document.getElementById("txTemplateDesignerContainer").addEventListener("keydown", (event) => {
// reset character array for all keys including ENTER, TAB and others except SPACE
if (event.keyCode < 0x30 && event.keyCode != 32) {
charCodes = [];
}
}, true);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment