From 318adc1643e0b6bbdbece51eabcd14aa1700b0b3 Mon Sep 17 00:00:00 2001 From: pythongosssss <125205205+pythongosssss@users.noreply.github.com> Date: Tue, 29 Aug 2023 19:00:43 +0100 Subject: [PATCH] Exclude arrows from triggering Fix insert selection offset --- web/js/common/autocomplete.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/web/js/common/autocomplete.js b/web/js/common/autocomplete.js index 6c169ae..ecfea7b 100644 --- a/web/js/common/autocomplete.js +++ b/web/js/common/autocomplete.js @@ -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();