mirror of
https://github.com/google-gemini/gemini-fullstack-langgraph-quickstart.git
synced 2025-08-08 00:41:45 +03:00
Merge pull request #17 from kahirokunn/fix/ime-input-form-submission
Fix IME input issues by implementing Ctrl/Cmd+Enter submission
This commit is contained in:
@@ -35,10 +35,9 @@ export const InputForm: React.FC<InputFormProps> = ({
|
|||||||
setInternalInputValue("");
|
setInternalInputValue("");
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleInternalKeyDown = (
|
const handleKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {
|
||||||
e: React.KeyboardEvent<HTMLTextAreaElement>
|
// Submit with Ctrl+Enter (Windows/Linux) or Cmd+Enter (Mac)
|
||||||
) => {
|
if (e.key === "Enter" && (e.ctrlKey || e.metaKey)) {
|
||||||
if (e.key === "Enter" && !e.shiftKey) {
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
handleInternalSubmit();
|
handleInternalSubmit();
|
||||||
}
|
}
|
||||||
@@ -59,9 +58,9 @@ export const InputForm: React.FC<InputFormProps> = ({
|
|||||||
<Textarea
|
<Textarea
|
||||||
value={internalInputValue}
|
value={internalInputValue}
|
||||||
onChange={(e) => setInternalInputValue(e.target.value)}
|
onChange={(e) => setInternalInputValue(e.target.value)}
|
||||||
onKeyDown={handleInternalKeyDown}
|
onKeyDown={handleKeyDown}
|
||||||
placeholder="Who won the Euro 2024 and scored the most goals?"
|
placeholder="Who won the Euro 2024 and scored the most goals?"
|
||||||
className={`w-full text-neutral-100 placeholder-neutral-500 resize-none border-0 focus:outline-none focus:ring-0 outline-none focus-visible:ring-0 shadow-none
|
className={`w-full text-neutral-100 placeholder-neutral-500 resize-none border-0 focus:outline-none focus:ring-0 outline-none focus-visible:ring-0 shadow-none
|
||||||
md:text-base min-h-[56px] max-h-[200px]`}
|
md:text-base min-h-[56px] max-h-[200px]`}
|
||||||
rows={1}
|
rows={1}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user