strapi-plugin-tags-custom-field 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -79
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,103 +1,60 @@
|
|
|
1
|
-
# strapi-plugin-tags-custom-field
|
|
1
|
+
# strapi-plugin-tags-custom-field
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
NPM package: https://www.npmjs.com/package/strapi-plugin-tags-custom-field
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Custom field plugin for Strapi 5 to manage tags as a native JSON array (`string[]`).
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
- Registers the custom field in the admin panel with a tags input component.
|
|
9
|
-
- Saves tags as JSON array values (e.g. `["news","featured","tech"]`).
|
|
10
|
-
- Uses Strapi Design System components for native admin look and feel.
|
|
11
|
-
- Supports keyboard and clipboard workflows for faster data entry.
|
|
12
|
-
|
|
13
|
-
## Requirements
|
|
14
|
-
|
|
15
|
-
- Node.js 18+ (recommended: Node.js 20)
|
|
16
|
-
- Strapi 5
|
|
17
|
-
|
|
18
|
-
## Local plugin development
|
|
19
|
-
|
|
20
|
-
```bash
|
|
21
|
-
npm install
|
|
22
|
-
npm run build
|
|
23
|
-
npm run test:ts
|
|
24
|
-
npm run verify
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
## Install from npm (recommended)
|
|
7
|
+
## Installation
|
|
28
8
|
|
|
29
9
|
```bash
|
|
30
10
|
npm install strapi-plugin-tags-custom-field
|
|
31
11
|
```
|
|
32
12
|
|
|
33
|
-
|
|
13
|
+
Restart your Strapi server after installation.
|
|
34
14
|
|
|
35
|
-
|
|
36
|
-
- Open the Custom fields category.
|
|
37
|
-
- Select `Tags`.
|
|
38
|
-
- Configure the custom field options if needed (see below).
|
|
15
|
+
## Usage in Strapi
|
|
39
16
|
|
|
40
|
-
|
|
17
|
+
1. Open Content-Type Builder.
|
|
18
|
+
2. Add a new field.
|
|
19
|
+
3. Open **Custom fields**.
|
|
20
|
+
4. Select **Tags**.
|
|
21
|
+
5. Configure field options if needed.
|
|
41
22
|
|
|
42
|
-
|
|
23
|
+
## Field options
|
|
43
24
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
25
|
+
- `maxTags` (default: `20`): maximum number of tags.
|
|
26
|
+
- `maxTagLength` (default: `40`): maximum characters per tag.
|
|
27
|
+
- `allowDuplicates` (default: `false`): allow repeated tags.
|
|
28
|
+
- `separator` (default: `,`): character used to split typed/pasted values.
|
|
29
|
+
- `normalizeCase` (default: `none`): `none`, `lowercase`, or `UPPERCASE`.
|
|
48
30
|
|
|
49
|
-
|
|
31
|
+
## Input behavior
|
|
50
32
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
```
|
|
33
|
+
- `Enter` adds the current tag.
|
|
34
|
+
- The configured separator also adds the current tag.
|
|
35
|
+
- Paste supports multiple tags (newline or configured separator).
|
|
36
|
+
- `Backspace` on empty input removes the last tag.
|
|
56
37
|
|
|
57
|
-
|
|
38
|
+
## Data format
|
|
58
39
|
|
|
59
|
-
|
|
40
|
+
The value is stored as native JSON array and returned as array by Strapi APIs.
|
|
60
41
|
|
|
61
|
-
|
|
62
|
-
- Press the configured separator (default: `,`) to add the current tag.
|
|
63
|
-
- Paste multiple tags at once (separated by newline or the configured separator).
|
|
64
|
-
- Press `Backspace` on an empty input to remove the last tag.
|
|
65
|
-
- Each draft tag has a configurable character limit with a live counter in the UI.
|
|
42
|
+
Example:
|
|
66
43
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
- `separator` (text, default: `,`): character used for splitting input/paste.
|
|
73
|
-
- `normalizeCase` (select, default: `none`): `none`, `lowercase`, or `UPPERCASE`.
|
|
74
|
-
|
|
75
|
-
## Database value format
|
|
76
|
-
|
|
77
|
-
The value is stored as a native JSON array. Examples:
|
|
78
|
-
|
|
79
|
-
- No tags: `[]`
|
|
80
|
-
- With tags: `["javascript","strapi","cms"]`
|
|
81
|
-
|
|
82
|
-
## Main structure
|
|
44
|
+
```json
|
|
45
|
+
{
|
|
46
|
+
"tags": ["javascript", "strapi", "cms"]
|
|
47
|
+
}
|
|
48
|
+
```
|
|
83
49
|
|
|
84
|
-
|
|
85
|
-
- `admin/src/index.ts`: admin custom field registration.
|
|
86
|
-
- `admin/src/components/TagsInput.tsx`: visual input with add/remove tag behavior.
|
|
50
|
+
## Compatibility
|
|
87
51
|
|
|
88
|
-
|
|
52
|
+
- Strapi: `v5`
|
|
53
|
+
- Node.js: `>=18`
|
|
89
54
|
|
|
90
|
-
|
|
91
|
-
2. Run:
|
|
55
|
+
## Local development (plugin repo)
|
|
92
56
|
|
|
93
57
|
```bash
|
|
94
|
-
npm
|
|
58
|
+
npm install
|
|
95
59
|
npm run release:check
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
3. Publish to npm:
|
|
99
|
-
|
|
100
|
-
```bash
|
|
101
|
-
npm publish
|
|
102
|
-
```
|
|
103
|
-
|
|
60
|
+
```
|