Exclude arrows from triggering

Fix insert selection offset
This commit is contained in:
pythongosssss
2023-08-29 19:00:43 +01:00
parent 4990e18abf
commit 318adc1643
+3 -2
View File
@@ -291,8 +291,7 @@ class TextAreaCaretHelper {
this.el.value =
this.el.value.substring(0, startPos + offset) + value + this.el.value.substring(endPos, this.el.value.length);
this.el.selectionStart = startPos + value.length;
this.el.selectionEnd = startPos + value.length;
this.el.selectionEnd = this.el.selectionStart = startPos + value.length + offset;
} else {
this.el.value += value;
}
@@ -395,6 +394,8 @@ export class TextAreaAutoComplete {
this.#hide();
break;
}
} else if (e.key === "ArrowUp" || e.key === "ArrowDown" || e.key === "ArrowLeft" || e.key === "ArrowRight") {
return;
}
if (!e.defaultPrevented) {
this.#update();