Skip to content

Commit 2a2f6da

Browse files
authored
Support backward compatibility for tags attr name (#26)
1 parent 026498b commit 2a2f6da

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<h1><strong>Tagsinput plugin for strapi with suggestions</strong></h1>
44

5-
<h3>🚀<strong>Use version <a href="https://github.com/canopas/strapi-plugin-tagsinput/releases/tag/2.0.1">2.0.1</a> for Strapi 5 support</strong>🚀</h3>
5+
<h3>🚀<strong>Use version <a href="https://github.com/canopas/strapi-plugin-tagsinput/releases/tag/2.0.2">2.0.2</a> for Strapi 5 support</strong>🚀</h3>
66

77
This plugin is used to add tagsinput in your strapi admin panel.
88
Read more about it at [tagsinput guidence](https://blog.canopas.com/the-simple-guidance-how-to-add-tagsinput-customfield-plugin-in-strapi-b5d2b5af7c3b).

admin/src/components/Input.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ const Tags = ({
2020
}) => {
2121
const { formatMessage } = useIntl();
2222
const apiUrl = attribute?.options?.apiUrl || "";
23-
const attrName = apiUrl.slice(apiUrl.lastIndexOf("=") + 1);
23+
const attrName = apiUrl.slice(apiUrl.lastIndexOf("=") + 1) || "name";
2424
const inputEle = useRef(null);
2525

2626
const [tags, setTags] = useState(() => {
2727
try {
2828
const values = typeof value === "string" ? JSON.parse(value) : value;
29-
return values.map((value) => value[attrName]);
29+
return values.map((value) => value[attrName] || value["name"]);
3030
} catch (e) {
3131
return [];
3232
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "strapi-plugin-tagsinput",
3-
"version": "2.0.1",
3+
"version": "2.0.2",
44
"description": "Tagsinput plugin for your strapi project",
55
"strapi": {
66
"name": "tagsinput",

0 commit comments

Comments
 (0)