From 7526bcc816ffb759e3708f30167b4d3367955b64 Mon Sep 17 00:00:00 2001 From: retoor Date: Fri, 31 Jan 2025 19:17:40 +0100 Subject: [PATCH] Word break --- src/snek/static/chat-input.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/snek/static/chat-input.js b/src/snek/static/chat-input.js index 1ea2c2e..661bf8b 100644 --- a/src/snek/static/chat-input.js +++ b/src/snek/static/chat-input.js @@ -27,10 +27,12 @@ class ChatInputElement extends HTMLElement { button.disabled = !message; }) this.textBox.addEventListener('change', (e) => { + e.preventDefault() this.dispatchEvent(new CustomEvent("change", { detail: e.target.value, bubbles: true })) console.error(e.target.value) }) this.textBox.addEventListener('keyup', (e) => { + e.preventDefault() if (e.key == 'Enter' && !e.shiftKey) { this.dispatchEvent(new CustomEvent("submit", { detail: e.target.value, bubbles: true })) e.target.value = '' @@ -47,4 +49,4 @@ class ChatInputElement extends HTMLElement { this.component.appendChild(this.container) } } -customElements.define('chat-input', ChatInputElement); \ No newline at end of file +customElements.define('chat-input', ChatInputElement);