✨ feat(ui): enhance tag input
1. EditModelModal quality-of-life
• Added comma parsing to `Form.TagInput`; users can now paste
`tag1, tag2 , tag3` to bulk-create tags.
• Updated placeholder copy to reflect the new capability.
All files pass linting; no runtime changes outside the intended UI updates.
This commit is contained in:
@@ -285,10 +285,19 @@ const EditModelModal = (props) => {
|
|||||||
<Form.TagInput
|
<Form.TagInput
|
||||||
field='tags'
|
field='tags'
|
||||||
label={t('标签')}
|
label={t('标签')}
|
||||||
placeholder={t('输入标签后按回车添加')}
|
placeholder={t('输入标签或使用","分隔多个标签')}
|
||||||
addOnBlur
|
addOnBlur
|
||||||
showClear
|
showClear
|
||||||
style={{ width: '100%' }}
|
style={{ width: '100%' }}
|
||||||
|
onChange={(newTags) => {
|
||||||
|
if (!formApiRef.current) return;
|
||||||
|
const normalize = (tags) => {
|
||||||
|
if (!Array.isArray(tags)) return [];
|
||||||
|
return [...new Set(tags.flatMap(tag => tag.split(',').map(t => t.trim()).filter(Boolean)))];
|
||||||
|
};
|
||||||
|
const normalized = normalize(newTags);
|
||||||
|
formApiRef.current.setValue('tags', normalized);
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
|
|||||||
Reference in New Issue
Block a user