Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support backward compatibility for tags attr name #26

Merged
merged 1 commit into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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