Enter sendet, Shift+Enter für Zeilenumbruch

This commit is contained in:
Meleki committed 2026-02-28 00:18:42 +01:00
1 parent da5959f5a0
commit 1bd14cdf94
2 files changed
+6 -4

No files matched your search

+2 -2
View File
@@ -18,7 +18,7 @@ body {
flex-direction: column;
}
body, button, input, select, textarea {
body, button, input, select, textarea, #input {
font-family: var(--font);
color: var(--text);
}
@@ -27,7 +27,7 @@ body {
font-size: var(--font-size);
}
button, input, select, textarea, h1, h2, h3, h4, h5 {
button, input, select, textarea, #input, h1, h2, h3, h4, h5 {
font-size: 1em;
}
+4 -2
View File
@@ -60,11 +60,13 @@ registerPage('chat', {
const sendBtn = document.getElementById('send');
if (sendBtn) sendBtn.addEventListener('click', sendMessage);
// Ctrl+Enter
const inputEl = document.getElementById('input');
if (inputEl) {
inputEl.addEventListener('keydown', (e) => {
if (e.ctrlKey && e.key === 'Enter') sendMessage();
if (e.key === 'Enter' && !e.shiftKey && !e.ctrlKey && !e.altKey && !e.metaKey) {
e.preventDefault();
sendMessage();
}
});
inputEl.addEventListener('input', function () {
this.style.height = 'auto';