Plugins

Variable

Create and use variables like [%username%] as noneditable things in the content.

Click on an editable block and then on the variable icon on the toolbar. Choose a variable from the shown popup and insert it.

How the plugin works

The plugin replaces specially marked variables with visual elements in the editor.

By default, the variable template is: [%variable%], so in content, it should look like this:

<p>Hi, [%name%],<br>
    and your email is: [%email%]
</p>

When you start Article Editor, all of these variables will be replaced with visual elements so that they can be manipulated.

You can change the default template of variables with this setting:

ArticleEditor('#entry', {
    plugins: ['variable'],
    variable: {
        template: {
            start: '{{ ',
            end: ' }}'
        }
    }
});

Now the variables in the content can be like this:

<p>Hi, {{ name }},<br>
    and your email is: {{ email }}
</p>

By default, the variable popup has the following items:

'email', 'name', 'password'

This is easy to change by specifying the settings when starting the editor:

ArticleEditor('#entry', {
    plugins: ['variable'],
    variable: {
        items: ['email', 'name', 'password', 'lastname', 'country', 'city', 'whatever']
    }
});