<!--element -->
<textarea id="content"></textarea>
<!-- plugin code -->
<script>
(function($R)
{
$R.add('plugin', 'myplugin', {
// construct
init: function(app)
{
// define app
this.app = app;
// define services
this.source = app.source;
},
// public
start: function()
{
this._build();
},
stop: function()
{
},
// private
_build: function()
{
this.source.setCode('<p>I am the plugin. I am started and change the initial code of Redactor.</p>');
}
});
})(Redactor);
</script>
<!-- call -->
<script>
$R('#content', { plugins: ['myplugin'] });
</script>