Reset caret position on clearInput, replaceInput

This commit is contained in:
Francisco Hodge 2019-04-15 10:40:26 -04:00
parent 72c9a75279
commit 2e20230cf7
2 changed files with 11 additions and 1 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "simple-keyboard", "name": "simple-keyboard",
"version": "2.20.5", "version": "2.20.6",
"description": "On-screen Javascript Virtual Keyboard", "description": "On-screen Javascript Virtual Keyboard",
"main": "build/index.js", "main": "build/index.js",
"types": "build/index.d.ts", "types": "build/index.d.ts",

View File

@ -307,6 +307,11 @@ class SimpleKeyboard {
inputName = inputName || this.options.inputName; inputName = inputName || this.options.inputName;
this.input[inputName] = ""; this.input[inputName] = "";
/**
* Reset caretPosition
*/
this.caretPosition = 0;
/** /**
* Enforce syncInstanceInputs, if set * Enforce syncInstanceInputs, if set
*/ */
@ -349,6 +354,11 @@ class SimpleKeyboard {
*/ */
replaceInput(inputObj) { replaceInput(inputObj) {
this.input = inputObj; this.input = inputObj;
/**
* Reset caretPosition
*/
this.caretPosition = null;
} }
/** /**