From 5fe079168402b3ae36193820f68fdc9ee6349ebb Mon Sep 17 00:00:00 2001 From: so95 Date: Tue, 10 Dec 2024 09:29:27 +0700 Subject: [PATCH] Allows quick entry of entities separated by commas (#3914) Allows quick entry of entities separated by commas ### Type of change - [x] New Feature (non-breaking change which adds functionality) --- web/src/components/edit-tag/index.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/web/src/components/edit-tag/index.tsx b/web/src/components/edit-tag/index.tsx index 1c9f0aee8..aac8143b4 100644 --- a/web/src/components/edit-tag/index.tsx +++ b/web/src/components/edit-tag/index.tsx @@ -37,8 +37,12 @@ const EditTag = ({ tags, setTags }: EditTagsProps) => { }; const handleInputConfirm = () => { - if (inputValue && tags?.indexOf(inputValue) === -1) { - setTags?.([...tags, inputValue]); + if (inputValue && tags) { + const newTags = inputValue + .split(';') + .map((tag) => tag.trim()) + .filter((tag) => tag && !tags.includes(tag)); + setTags?.([...tags, ...newTags]); } setInputVisible(false); setInputValue('');