Fix: Creating Knowledge Base Support Enter Key (#7258)

### What problem does this PR solve?


[https://github.com/infiniflow/ragflow/issues/7180](https://github.com/infiniflow/ragflow/issues/7180)
When creating a knowledge base, support the enter key
### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
Stephen Hu
2025-04-25 18:53:52 +08:00
committed by GitHub
parent 3052006ba8
commit 3da8776a3c
11 changed files with 157 additions and 59 deletions

View File

@ -142,6 +142,18 @@ const ChatConfigurationModal = ({
}
}, [initialDialog, form, visible, modelId]);
const handleKeyDown = (e: React.KeyboardEvent) => {
// Allow Enter in textareas
if (e.target instanceof HTMLTextAreaElement) {
return;
}
if (e.key === 'Enter' && !e.shiftKey) {
e.preventDefault();
handleOk();
}
};
return (
<Modal
title={title}
@ -171,6 +183,7 @@ const ChatConfigurationModal = ({
style={{ maxWidth: 600 }}
validateMessages={validateMessages}
colon={false}
onKeyDown={handleKeyDown}
>
{Object.entries(segmentedMap).map(([key, Element]) => (
<Element