Skip to content

Commit 859255a

Browse files
authored
Merge pull request ricklamers#43 from jarvisar/pr-43
Disable line break on enter key in message input
2 parents 17a21bd + 48881b2 commit 859255a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

client/js/chat.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -461,11 +461,12 @@ window.onload = async () => {
461461
}
462462
}
463463

464-
message_input.addEventListener(`keydown`, async (evt) => {
464+
message_input.addEventListener(`keydown`, async (evt) => {
465465
if (prompt_lock) return;
466466
if (evt.keyCode === 13 && !evt.shiftKey) {
467-
console.log("pressed enter");
468-
await handle_ask();
467+
evt.preventDefault();
468+
console.log('pressed enter');
469+
await handle_ask();
469470
} else {
470471
message_input.style.removeProperty("height");
471472
message_input.style.height = message_input.scrollHeight + 4 + "px";

0 commit comments

Comments
 (0)