diff --git a/public/app.js b/public/app.js index 00a95ad..46eb87e 100644 --- a/public/app.js +++ b/public/app.js @@ -289,6 +289,14 @@ if (styleToggleBtn) { }); } +const messageInput = document.getElementById('messageInput'); +messageInput.addEventListener('keydown', (e) => { + if (e.key === 'Enter' && !e.shiftKey) { + e.preventDefault(); + document.getElementById('messageForm').requestSubmit(); + } +}); + document.getElementById('messageForm').addEventListener('submit', async (e) => { e.preventDefault(); ui.setChatError(''); @@ -314,6 +322,7 @@ document.getElementById('messageForm').addEventListener('submit', async (e) => { msgId, }); input.value = ''; + input.style.height = 'auto'; } catch (err) { ui.setChatError(err.message); } diff --git a/public/index.html b/public/index.html index 41a290e..a177c27 100644 --- a/public/index.html +++ b/public/index.html @@ -4,7 +4,7 @@ Web OSCAR Chat - +
@@ -77,7 +77,7 @@
- +

@@ -86,6 +86,6 @@ - + diff --git a/public/style.css b/public/style.css index c330181..e71add9 100644 --- a/public/style.css +++ b/public/style.css @@ -25,18 +25,19 @@ body { color: var(--text); } -input, button { +input, button, textarea { font: inherit; border-radius: 8px; border: 1px solid var(--border); padding: 0.55rem 0.75rem; } -input { +input, textarea { background: #151922; color: var(--text); width: 100%; } -input:focus, button:focus { +textarea { resize: vertical; min-height: 2.4rem; max-height: 10rem; } +input:focus, button:focus, textarea:focus { outline: 2px solid rgba(77,163,255,0.35); outline-offset: 1px; border-color: var(--accent);