@rulab/adminjs-components 0.2.1 → 0.2.2
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
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# adminjs-components
|
|
2
2
|
|
|
3
|
+
<a id="top"></a>
|
|
4
|
+
|
|
3
5
|
Prebuilt AdminJS components and features for common UI needs: colored status
|
|
4
6
|
badges, slug and UUID generation, Editor.js content, sortable string lists, tabs
|
|
5
7
|
layout, and record preview.
|
|
@@ -46,6 +48,14 @@ You can also pass `componentLoader` into every feature instead of calling
|
|
|
46
48
|
|
|
47
49
|
## Components and features
|
|
48
50
|
|
|
51
|
+
- [ColorStatus](#colorstatus)
|
|
52
|
+
- [Slug](#slug)
|
|
53
|
+
- [UUID](#uuid)
|
|
54
|
+
- [Editor](#editor)
|
|
55
|
+
- [StringList](#stringlist)
|
|
56
|
+
- [Tabs](#tabs)
|
|
57
|
+
- [Preview](#preview)
|
|
58
|
+
|
|
49
59
|
### ColorStatus
|
|
50
60
|
|
|
51
61
|
Renders a colored badge in edit/list/show based on a list of available values.
|
|
@@ -68,6 +78,8 @@ features: [
|
|
|
68
78
|
]
|
|
69
79
|
```
|
|
70
80
|
|
|
81
|
+
[Back to top](#top)
|
|
82
|
+
|
|
71
83
|
### Slug
|
|
72
84
|
|
|
73
85
|
Generates a slug from another field and stores it in the target property.
|
|
@@ -85,6 +97,8 @@ features: [
|
|
|
85
97
|
]
|
|
86
98
|
```
|
|
87
99
|
|
|
100
|
+
[Back to top](#top)
|
|
101
|
+
|
|
88
102
|
### UUID
|
|
89
103
|
|
|
90
104
|
Adds a UUID field with a "Generate UUID" button in edit view.
|
|
@@ -101,10 +115,12 @@ features: [
|
|
|
101
115
|
]
|
|
102
116
|
```
|
|
103
117
|
|
|
118
|
+
[Back to top](#top)
|
|
119
|
+
|
|
104
120
|
### Editor
|
|
105
121
|
|
|
106
122
|
Editor.js field for rich content. Supports optional image upload via
|
|
107
|
-
`@adminjs/upload` provider.
|
|
123
|
+
`@adminjs/upload` provider, plus built-in audio and video blocks.
|
|
108
124
|
|
|
109
125
|
```ts
|
|
110
126
|
import { EditorFeature } from "@rulab/adminjs-components";
|
|
@@ -123,6 +139,8 @@ features: [
|
|
|
123
139
|
]
|
|
124
140
|
```
|
|
125
141
|
|
|
142
|
+
[Back to top](#top)
|
|
143
|
+
|
|
126
144
|
### StringList
|
|
127
145
|
|
|
128
146
|
Sortable list stored as a single string (comma-separated by default).
|
|
@@ -139,6 +157,8 @@ features: [
|
|
|
139
157
|
]
|
|
140
158
|
```
|
|
141
159
|
|
|
160
|
+
[Back to top](#top)
|
|
161
|
+
|
|
142
162
|
### Tabs
|
|
143
163
|
|
|
144
164
|
Groups edit/show fields into tabs based on property `props.tab` or
|
|
@@ -163,6 +183,8 @@ properties: {
|
|
|
163
183
|
},
|
|
164
184
|
```
|
|
165
185
|
|
|
186
|
+
[Back to top](#top)
|
|
187
|
+
|
|
166
188
|
### Preview
|
|
167
189
|
|
|
168
190
|
Adds a record action that renders an iframe preview. The `url` can include
|
|
@@ -179,6 +201,8 @@ features: [
|
|
|
179
201
|
]
|
|
180
202
|
```
|
|
181
203
|
|
|
204
|
+
[Back to top](#top)
|
|
205
|
+
|
|
182
206
|
## Utilities
|
|
183
207
|
|
|
184
208
|
- `setComponentLoader(loader)` and `getComponentLoader()` to reuse a single
|
|
@@ -5,6 +5,8 @@ import Quote from "@editorjs/quote";
|
|
|
5
5
|
import Table from "@editorjs/table";
|
|
6
6
|
// @ts-ignore
|
|
7
7
|
import AudioPlayer from "editorjs-audio-player";
|
|
8
|
+
// @ts-ignore
|
|
9
|
+
import SimpleVideo from "simple-video-editorjs";
|
|
8
10
|
export const EDITOR_TOOLS = {
|
|
9
11
|
paragraph: {
|
|
10
12
|
class: Paragraph,
|
|
@@ -31,4 +33,5 @@ export const EDITOR_TOOLS = {
|
|
|
31
33
|
inlineToolbar: true,
|
|
32
34
|
},
|
|
33
35
|
audioPlayer: AudioPlayer,
|
|
36
|
+
video: SimpleVideo,
|
|
34
37
|
};
|
package/dist/utils/parseHtml.js
CHANGED
|
@@ -20,12 +20,20 @@ const tableParser = (block) => {
|
|
|
20
20
|
}
|
|
21
21
|
};
|
|
22
22
|
const audioPlayerParser = (block) => {
|
|
23
|
-
return `<audio controls src=
|
|
23
|
+
return `<audio controls src="${block.data.src}"></audio>`;
|
|
24
|
+
};
|
|
25
|
+
const videoParser = (block) => {
|
|
26
|
+
const controls = block.data.controls === false ? "" : " controls";
|
|
27
|
+
const autoplay = block.data.autoplay ? " autoplay" : "";
|
|
28
|
+
const muted = block.data.muted ? " muted" : "";
|
|
29
|
+
const caption = block.data.caption ? `<figcaption>${block.data.caption}</figcaption>` : "";
|
|
30
|
+
return `<figure><video src="${block.data.url}"${controls}${autoplay}${muted}></video>${caption}</figure>`;
|
|
24
31
|
};
|
|
25
32
|
export const parseHtml = (jsonData) => {
|
|
26
33
|
const edjsParser = edjsHTML({
|
|
27
34
|
table: tableParser,
|
|
28
35
|
audioPlayer: audioPlayerParser,
|
|
36
|
+
video: videoParser,
|
|
29
37
|
});
|
|
30
38
|
try {
|
|
31
39
|
const data = edjsParser.parse(JSON.parse(jsonData));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rulab/adminjs-components",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "Prebuilt AdminJS features for common UI needs.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -51,6 +51,7 @@
|
|
|
51
51
|
"editorjs-audio-player": "~0.0.3",
|
|
52
52
|
"editorjs-html": "~3.4.3",
|
|
53
53
|
"react-select": "^5.8.0",
|
|
54
|
+
"simple-video-editorjs": "~1.4.9",
|
|
54
55
|
"slugify": "^1.6.6"
|
|
55
56
|
},
|
|
56
57
|
"peerDependencies": {
|