<!--element -->
<textarea id="content"></textarea>
<!-- plugin code -->
<script>
(function($R)
{
$R.add('plugin', 'myplugin', {
translations: {
en: {
"myplugin": "My Plugin"
}
},
init: function(app)
{
// define app
this.app = app;
// define services
this.lang = app.lang;
this.toolbar = app.toolbar;
},
start: function()
{
// create the button data
var buttonData = {
title: this.lang.get('myplugin'),
api: 'plugin.myplugin.toggle'
};
// create the button
var $button = this.toolbar.addButton('myplugin', buttonData);
},
toggle: function()
{
alert('My Plugin is toggled!');
}
});
})(Redactor);
</script>
<!-- call -->
<script>
$R('#content', { plugins: ['myplugin'] });
</script>