From bde4c5428d7424c86ab3cb22538034c916b494f3 Mon Sep 17 00:00:00 2001 From: "info@pi-farm.de" Date: Fri, 6 Mar 2026 23:18:22 +0000 Subject: [PATCH] templates/index.html aktualisiert --- templates/index.html | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/templates/index.html b/templates/index.html index 3dbf17e..fed95aa 100644 --- a/templates/index.html +++ b/templates/index.html @@ -179,7 +179,11 @@
💬 J.A.R.V.I.S. - Chat
- +
@@ -280,15 +284,27 @@ // 1. CHAT LOGIK function initChat(chatWs) { const input = document.getElementById('user-input'); + window.sendMessage = function() { const msg = input.value.trim(); if(!msg) return; chatWs.send(msg); appendChat("Du", msg, "text-slate-400 font-bold"); + + // Input zurücksetzen input.value = ''; + input.style.height = 'auto'; // Höhe wieder einklappen input.focus(); }; - input.addEventListener('keydown', (e) => { if (e.key === 'Enter') { e.preventDefault(); sendMessage(); } }); + + input.addEventListener('keydown', (e) => { + // Wenn ENTER gedrückt wird OHNE Shift -> Senden + if (e.key === 'Enter' && !e.shiftKey) { + e.preventDefault(); // Verhindert den Zeilenumbruch + sendMessage(); + } + // Wenn ENTER + Shift gedrückt wird -> Standardverhalten (neue Zeile) bleibt + }); } // 2. MODAL LOGIK