Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/plugin/Panel/ChatInput/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ export const ChatInput: FC = () => {
dispatch({ type: "setConversationState", conversationState: "idle" });
}

async function handleSubmit(e: React.FormEvent<HTMLFormElement>) {
e.preventDefault();
async function handleSubmit(e?: React.FormEvent<HTMLFormElement>) {
if (e) e.preventDefault();
const input = textareaValue.trim();

if (!input) {
Expand Down Expand Up @@ -84,6 +84,12 @@ export const ChatInput: FC = () => {
const PromptInputButtons = state?.provider?.PromptInputButtons?.bind(state.provider) ?? null; // bind `this`;
return (
<form
onKeyDown={(e) => {
if ((e.metaKey || e.ctrlKey) && e.key === "Enter") {
e.preventDefault();
handleSubmit();
}
}}
onSubmit={async (e) => {
handleSubmit(e);
}}
Expand Down
Loading