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 @@
-
+
@@ -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