Content templates

This example shows how to replace editor content with predefined layouts using the Templates plugin.

Code

<div id="entry-templates"></div>
<script src="/assets/redactor/plugins/templates/templates.js"></script>
const app = Redactor('#entry-templates', {
    plugins: ['templates'],
    templates: {
        templates: {
            article: {
                name: 'Article',
                html: '<h1>Title</h1><p>Introduction paragraph.</p><h2>Section</h2><p>Body text.</p>'
            }
        }
    }
});