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

@ -23,10 +23,15 @@ const KnowledgeCreatingModal = ({
const handleOk = async () => {
const ret = await form.validateFields();
onOk(ret.name);
};
const handleKeyDown = async (e) => {
if (e.key === 'Enter') {
await handleOk();
}
};
return (
<Modal
title={t('createKnowledgeBase')}
@ -48,7 +53,7 @@ const KnowledgeCreatingModal = ({
name="name"
rules={[{ required: true, message: t('namePlaceholder') }]}
>
<Input placeholder={t('namePlaceholder')} />
<Input placeholder={t('namePlaceholder')} onKeyDown={handleKeyDown} />
</Form.Item>
</Form>
</Modal>