@vibesfr/avatar-media
v1.0.5
Published
AvatarMedia Tool for Editor.js
Maintainers
Readme
AvatarMedia Tool
Provides Blog avatar for the Editor.js.
Installation
Get the package
yarn add @vibesfr/avatar-mediaInclude module at your application
import AvatarMedia from "@vibesfr/avatar-media";It requires TailwindCSS to work properly !
## Usage
Add a new Tool to the `tools` property of the Editor.js initial config.
```javascript
var editor = EditorJS({
...
tools: {
...
avatarMedia: AvatarMedia,
}
...
});Config Params
config: {
users: yourUsers,
currentUser: yourCurrentUser,
}Tool's settings
Change the read time
Change the user
Output data
| Field | Type | Description |
|--------------|-----------|-----------------------------|
| readTime | integer | read time duration |
| creationDate | string | creation date formated |
| user | object | user associated to the post |
| avatar | string | avatar url for the user |
{
"type": "avatarMedia",
"data": {
"readTime": "25",
"creationDate": "12 mai 2024",
"user": {
"id": 2,
"name": "Jean Dupont"
},
"avatar": "https://api.dicebear.com/8.x/initials/svg?seed=Jean%20DUPONT"
}
}