Documentation

Snippets

json #

Type: Boolean

Default: false

This setting allows you to get snippets from JSON file.

ArticleEditor('#entry', {
    snippets: {
        json: '/my-snippets/snippets.json'
    }
});

Example of JSON:

{
    "mysnippet": {
        "name": "My Snippet",
        "html": "<div class="mysnippet"><p>Hi everyone! This is my snippet</p></div>"
    },
    "mysnippet2": {
        "name": "My Other Snippet",
        "html": "<div class="mysnippet"><p>Hi everyone! This is my other snippet</p></div>"
    }
}

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

ArticleEditor('#entry', {
    snippets: {
        json: {
            "mysnippet": {
                "name": "My Snippet",
                "html": "<div class="mysnippet"><p>Hi everyone! This is my snippet</p></div>"
            },
            "mysnippet2": {
                "name": "My Other Snippet",
                "html": "<div class="mysnippet"><p>Hi everyone! This is my other snippet</p></div>"
            }
        }
    }
});