Skip to content

Commit

Permalink
Support backward compatibility for tags attr name (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
cp-sumi-k authored Oct 16, 2024
1 parent 026498b commit 2a2f6da
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

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

<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>
<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>

This plugin is used to add tagsinput in your strapi admin panel.
Read more about it at [tagsinput guidence](https://blog.canopas.com/the-simple-guidance-how-to-add-tagsinput-customfield-plugin-in-strapi-b5d2b5af7c3b).
Expand Down
4 changes: 2 additions & 2 deletions admin/src/components/Input.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ const Tags = ({
}) => {
const { formatMessage } = useIntl();
const apiUrl = attribute?.options?.apiUrl || "";
const attrName = apiUrl.slice(apiUrl.lastIndexOf("=") + 1);
const attrName = apiUrl.slice(apiUrl.lastIndexOf("=") + 1) || "name";
const inputEle = useRef(null);

const [tags, setTags] = useState(() => {
try {
const values = typeof value === "string" ? JSON.parse(value) : value;
return values.map((value) => value[attrName]);
return values.map((value) => value[attrName] || value["name"]);
} catch (e) {
return [];
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "strapi-plugin-tagsinput",
"version": "2.0.1",
"version": "2.0.2",
"description": "Tagsinput plugin for your strapi project",
"strapi": {
"name": "tagsinput",
Expand Down

0 comments on commit 2a2f6da

Please sign in to comment.