If you already have an document
object you saved from the editor, you can create a thumbnail with it. This is very similar to the email preview, but the difference is that you can set the size and scale value of the thumbnail, and attach it to an HTML element. For example, you can create email cards with thumbnails, or you can preview the email, before opening the editor.
const thumbnailInstance = await chamaileonPlugins.createThumbnail({
document: {}, // email document JSON
container: "#email-thumbnail",
height: 640,
width: 480,
scale: 0.5 // the real size will be 320x240 in this case
});
Property | Type | Description |
---|---|---|
document | object | The document descriptor object. You might want to save it as a JSON object. |
container | string or HTMLElement | A CSS selector or a reference to an empty element in which the thumbnail will be inserted. |
width | number | The original width of your thumbnail. |
height | number | The original height of your thumbnail. |
scale | float | The scale number for your preview. Default is 0.5 . If you want to disable scaling set it to 1.0 . |
scroll | boolean | To enable vertical scrolling in the thumbnail. Default is false . |
Removes the thumbnail completely.
thumbnailInstance.destroy();
We put together a demo and you can check out the code here.
You can also check out the email thumbnail plugin on the Chamaileon SDK Playground.