Documentation

Templates

Type: String, Object

Default: false

This setting allows you to get templates from JSON file.

ArticleEditor('#entry', {
    css: '/your-article-dist-path/',
    templates: '/my-templates/templates.json'
});

Example of JSON:

{
    "mytemplate": {
        "name": "My Template",
        "html": "...html code..."
    },
    "mytemplate2": {
        "name": "My Other Template",
        "html": "... html code ..."
    }
}

Or you can set the JSON object directly to the setting like this:

ArticleEditor('#entry', {
    css: '/your-article-dist-path/',
    templates: {
        "mytemplate": {
            "name": "My Template",
            "html": "... html code ..."
        },
        "mytemplate2": {
            "name": "My Other Template",
            "html": "... html code ..."
        }
    }
});

Article builds a preview of the template automatically as an html preview. But for more accurate display, you can specify a screenshot of the template with image size 200x250px:

{
    "mytemplate": {
        "name": "My Template",
        "image": "my-templates/my-template.png",
        "html": "..."
    }
}