How to connect EditorJS in admiral
10 minutes
Frontend
Backend
Admiral
Jun 23, 2025
7 minutes
<TextInput label="Title" name="title" placeholder="Title" required columnSpan={2}/>
<SelectInput label="By attribute" name="facet_id" placeholder="By attribute" required mode="multiple"columnSpan={2}/>
<FilePictureInput columnSpan={2} label="Avatar" name="avatar" accept="image/*" maxCount={1} />
<BooleanInput label="Active?" name="active" />
<ArrayInput label="Schedule" name="schedule" required>
<SelectInput
label="Day of the week"
name="day"
placeholder="Day of the week"
required
/>
<TimePickerInput
label="Opening time"
name="start_time"
placeholder="Opening time"
format="HH:mm"
/>
<TimePickerInput
label="Closing time"
name="end_time"
placeholder="Closing time"
format="HH:mm"
/>
</ArrayInput>
const fields = (<>
<TextInput label="Name" name="name" placeholder="Enter a name" required />
<SelectInput label="Position" name="position" placeholder="Choose a position" required />
<FilePictureInput label="Avatar" name="avatar" accept="image/*" maxCount={1} />
<BooleanInput label="Active" name="is_active" />
<AjaxSelectInput label="Department" name="department_id" placeholder="Choose a department" />
<ArrayInput label="Schedule" name="schedule">
<TimePickerInput label="Start" name="start_time" placeholder="Start" format="HH:mm" />
<TimePickerInput label="End" name="end_time" placeholder="End" format="HH:mm" />
<BooleanInput label="Day off?" name="day_off" />
</ArrayInput>
<>)
export const CRUD = createCRUD({path: '/employers',
resource: resource,
index: {
title: 'Employers',
newButtonText: 'Add',
tableColumns: [
{
sorter: true,
title: 'ID',
dataIndex: 'id',
key: 'id',
width: 90,
},
],
},
form: {
create: {
fields,
},
edit: {
fields,
},
},
create: {
title: 'Addition'
},
update: {
title: (id: string) => `Editing`,
},
})
https://admiral.dev.family/admin/emploers/489/update?id=489
export const CRUD = createCRUD({path: '/employers',
resource: resource,
index: {
title: 'Employers',
newButtonText: 'Add',
tableColumns: [
{
sorter: true,
title: 'ID',
dataIndex: 'id',
key: 'id',
width: 90,
},
{
sorter: true,
title: 'Active',
dataIndex: 'is_active',
key: 'is_active',
render: (value) => (value ? 'Yes' : 'No'),
},
],
},
....
})
{
"data": {
"name": "Name",
"position": "Position",
"avatar": {
"uid": "uid", //unique file identifier
"name": "name.png",
"url": "https://admiral.dev.family/photo.png" //url to the image
},
"is_active": true,
"departmen_id": 1,
"schedule.start_time": "10:20",
"schedule.end_time": "11:20",
"schedule.day_off": true
},
"values": {
"departmen_id": [
{
"label": "Marketing",
"value": "7"
},
{
"label": "Accounting",
"value": "8"
}
]
}
}
https://admiral.dev.family/admin/emploers/489 (POST)
{
"name": "Name",
"position": "Position",
"avatar": {
"uid": "uid",
"name": "name.png",
"url": "https://admiral.dev.family/photo.png"
}, //will either be a binary file when uploading for the first time,or an object if the photo has already been uploaded.
"is_active": true,
"departmen_id": 1,
"schedule": [
{
"day_id": 1,
"start_time": "10:20",
"end_time": "11:20",
"day_off": true
},
{
"day_id": 2,
"start_time": "09:20",
"end_time": "12:20",
"day_off": true
}
]
}