Redactor / Documentation / Callbacks

Source

visual #

This callback triggers whenever a user switch from source code to visual mode. The callback requires Source Code or Codemirror plugin.

$('#redactor').redactor({
    callbacks: {
	    visual: function()
        {
            console.log('switched!');
        }
	}	
});

source #

This callback triggers whenever a user switch from visual mode to source code. The callback requires Source Code or Codemirror plugin.

Callback must return html.

The callback passes following argument:

  • html — inserted text
$('#redactor').redactor({
    callbacks: {
	    source: function(html)
        {
            console.log(html);
            return html;
        }
	}	
});