saving
, fetching
, and management
, you can use the following callbacks for saving, fetching, and manage custom block.mailui.init({
saveToBlock: {
enabled: true,
},
});
done(data[], meta: object)
function.mailui.registerProvider(
"block:collections",
async (params: { page: number; perPage: number }, done: Function) => {
done(data, meta);
}
);
Property | Description | Type | Default |
---|---|---|---|
page | The current page number | number | 1 |
perPage | The number of items displayed per page | number | 20 |
Property | Description | Type | Default |
---|---|---|---|
id | Unique number | any | - |
name | Block specific name | string | - |
thumbnailUrl | Thumbnail full url | string | - |
elementType | The element type should be one of the following | SECTION ROW COLUMN ELEMENT | - |
Property | Description | Type | Default |
---|---|---|---|
page | The current page number | number | 1 |
lastPage | The total number of pages | number | - |
perPage | The number of items displayed per page | number | 20 |
total | The total number of items | number | - |
mailui.registerProvider("block:collectionData",
async (params, done) => {
const data = {}; // template JSON
done(data);
}
);
Property | Description | Type | Default |
---|---|---|---|
id | Unique number | any | - |
name | Block specific name | string | - |
thumbnailUrl | Thumbnail full url | string | - |
elementType | The element type should be one of the following | SECTION ROW COLUMN ELEMENT | - |
mailui.registerProvider("block:saved", async (params, done) => {
try {
// Run your save block code here
const block = {};
done(block);
} catch (error) {
done(null)
console.log("An error has occurred during save data.");
}
}
);
Property | Description | Type | Default |
---|---|---|---|
thumbnail | Uploaded BLOB file type | file | - |
name | Block specific name | string | - |
data | JSON data | object | - |
elementType | The element type should be one of the following | SECTION ROW COLUMN ELEMENT | - |
Property | Description | Type | Default |
---|---|---|---|
id | Unique number | any | - |
name | Block specific name | string | - |
thumbnailUrl | Thumbnail full url | string | - |
elementType | The element type should be one of the following | SECTION ROW COLUMN ELEMENT | - |
mailui.registerCallback("block:removed", async (params, done) => {
done();
});
Property | Description | Type | Default |
---|---|---|---|
id | Unique number | any | - |
name | Block specific name | string | - |
thumbnailUrl | Thumbnail full url | string | - |
elementType | The element type should be one of the following | SECTION ROW COLUMN ELEMENT | - |