App

start #

Start the Redactor application manually.

// call in plugins
this.app.start();

// external API
$R('#content', 'start');

stop #

Stop the Redactor application manually.

// call in plugins
this.app.stop();

// external API
$R('#content', 'stop');

destroy #

Stop Redactor and destroy its instance, for example, for further launch with another options.

// first launch
 $R('#content');

// destroy and call with another options
$R('#content', 'destroy');

// second launch
$R('#content', { air: true });

isStarted #

Returns: Boolean

Check if the Redactor application is started.

// call in plugins
var is = this.app.isStarted();

// external API
var is = $R('#content', 'isStarted');

isStopped #

Returns: Boolean

Check if the Redactor application is stopped.

// call in plugins
var is = this.app.isStopped();

// external API
var is = $R('#content', 'isStopped');

broadcast #

Arguments
name Stringarguments (optional)

Broadcast the message to modules and plugins.

this.app.broadcast('messagename');
this.app.broadcast('messagename', arg1, argN);

In a nutshell, you can intercept the message in a module or a plugin with its method like this:

$R.Plugin.Myplugin.prototype = {
    onmessagename: function(arg1, argN)
    {
        // code...
    }
};

isReadOnly #

Returns: Boolean

Check if Redactor is in the read-only mode.

// call in plugins
var is = this.app.isReadOnly();

// external API
var is = $R('#content', 'isReadOnly');

enableReadOnly #

Set the read-only mode for Redactor. The content in the editor becomes not editable.

// call in plugins
this.app.enableReadOnly();

// external API
$R('#content', 'enableReadOnly');

disableReadOnly
#

Disable the read-only mode for Redactor. The content in the editor becomes editable.

// call in plugins
this.app.disableReadOnly();

// external API
$R('#content', 'disableReadOnly');

extend #

Arguments
obj1 Object
objN Object
deep Boolean

Returns: Object

Extend one object with another object. If deep is true the merge becomes recursive.

// merge to new object
var newobj = $R.extend({}, ob1, obj2);

// deep copy
var newobj = $R.extend({}, true, ob1, obj2);

// merge objects
obj1 = $R.extend(ob1, obj2);

// deep copy
obj1 = $R.extend(true, ob1, obj2);

error #

Arguments
message Exception

Call the exception thrown to show an error message.

$R.error(new Error('your message'));