Documentation
Sync
syncBefore
html | String | code form Redactor prior to inserting into textarea |
This callback is triggered upon synchronization of code between visual layer and textarea. syncBefore callback is triggered before text from visual layer is pasted to textarea.
This callback must return HTML code.
Visual layer contains multiple temporary tags that allow visual editing. Synchronization with textarea inserts clean code to the textarea, removing all temporary tags, styles and attributes. This callback allows to intercept this code before it is cleaned and inserted into the textarea to make necessary changes to the code prior to synchronization.
$R('#content', {
callbacks: {
syncBefore: function(html)
{
return html;
}
}
});
Listen to the message in a plugin:
(function($R)
{
$R.add('plugin', 'myplugin', {
init: function(app)
{
// define app
this.app = app;
},
// messages
onsyncBefore: function(html)
{
return html;
}
});
})(Redactor);
syncing
html | String | cleaned code form Redactor prior to inserting into textarea |
Triggered before the cleaned code after synchronization will be inserting to the textarea.
$R('#content', {
callbacks: {
syncing: function(html)
{
return html;
}
}
});
Listen to the message in a plugin:
(function($R)
{
$R.add('plugin', 'myplugin', {
init: function(app)
{
// define app
this.app = app;
},
// messages
onsyncing: function(html)
{
return html;
}
});
})(Redactor);
synced
html | String |
This callback is triggered after synchronization between visual layer and textarea. Resulting code will be in textarea.
This callback is identical to change callback and makes callback functions more consistent.
$R('#content', {
callbacks: {
synced: function(html)
{
// ...
}
}
});
Listen to the message in a plugin:
(function($R)
{
$R.add('plugin', 'myplugin', {
init: function(app)
{
// define app
this.app = app;
},
// messages
onsynced: function(html)
{
// ...
}
});
})(Redactor);
changed
html | String |
This callback is triggered after synchronization between visual layer and textarea. Resulting code will be in textarea.
$R('#content', {
callbacks: {
changed: function(html)
{
// ...
}
}
});
Listen to the message in a plugin:
(function($R)
{
$R.add('plugin', 'myplugin', {
init: function(app)
{
// define app
this.app = app;
},
// messages
onchanged: function(html)
{
// ...
}
});
})(Redactor);