Skip to content

Commit

Permalink
Merge pull request #24 from Pelps12/main
Browse files Browse the repository at this point in the history
Change "Enter" submit logic
  • Loading branch information
Dhravya committed Apr 19, 2024
2 parents a8e0e67 + 5f68924 commit b23fadc
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions apps/web/src/components/Main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,8 @@ export default function Main({ sidebarOpen }: { sidebarOpen: boolean }) {
autoFocus: true,
onChange: onValueChange,
onKeyDown: (e) => {
if (e.key === "Enter") {
if (e.key === "Enter" && !e.shiftKey) {
e.preventDefault();
onSend();
}
},
Expand Down Expand Up @@ -388,7 +389,8 @@ export default function Main({ sidebarOpen }: { sidebarOpen: boolean }) {
autoFocus: true,
onChange: (e) => setValue(e.target.value),
onKeyDown: (e) => {
if (e.key === "Enter" && (e.ctrlKey || e.metaKey)) {
if (e.key === "Enter" && !e.shiftKey) {
e.preventDefault();
onSend();
}
},
Expand Down Expand Up @@ -507,7 +509,8 @@ export function Chat({
autoFocus: true,
onChange: onValueChange,
onKeyDown: (e) => {
if (e.key === "Enter" && (e.ctrlKey || e.metaKey)) {
if (e.key === "Enter" && !e.shiftKey) {
e.preventDefault();
askQuestion();
}
},
Expand Down

0 comments on commit b23fadc

Please sign in to comment.