From 6f86c0ee8f1a77cc3a1b481368db2f80b923a3a8 Mon Sep 17 00:00:00 2001 From: Shulhan Date: Fri, 8 Dec 2023 08:42:31 +0700 Subject: editor: set key control to false on blur Sometimes we got an issue where pressing enter may cause the editor being saved without pressing Control key. --- editor/editor.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/editor/editor.ts b/editor/editor.ts index 5b721a1..9cd4988 100644 --- a/editor/editor.ts +++ b/editor/editor.ts @@ -131,6 +131,9 @@ export class WuiEditor { this.elContent.onkeyup = (ev: KeyboardEvent) => { this.onKeyupDocument(this, ev); }; + this.elContent.addEventListener("blur", () => { + this.isKeyControl = false; + }); } this.elContent.classList.add(WUI_EDITOR_CLASS_CONTENT); this.el.appendChild(this.elContent); -- cgit v1.3