Skip to content

Commit

Permalink
Merge pull request xtekky#43 from jarvisar/pr-43
Browse files Browse the repository at this point in the history
Disable line break on enter key in message input
  • Loading branch information
xtekky authored Apr 27, 2023
2 parents 17a21bd + 48881b2 commit 859255a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions client/js/chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -461,11 +461,12 @@ window.onload = async () => {
}
}

message_input.addEventListener(`keydown`, async (evt) => {
message_input.addEventListener(`keydown`, async (evt) => {
if (prompt_lock) return;
if (evt.keyCode === 13 && !evt.shiftKey) {
console.log("pressed enter");
await handle_ask();
evt.preventDefault();
console.log('pressed enter');
await handle_ask();
} else {
message_input.style.removeProperty("height");
message_input.style.height = message_input.scrollHeight + 4 + "px";
Expand Down

0 comments on commit 859255a

Please sign in to comment.