Documentation

Autosave

autosave

Arguments
name Stringname of textarea or the value of autosaveName option
data Objectan object with the data sent to the server
response JSON the server response

Called when autosave is triggered and the server-side sent a response.

$R('#content', {
    callbacks: {
        autosave: function(name, data, response)
        {
            // ...
        }
    }
});

Listen to the message in a plugin:

(function($R)
{
    $R.add('plugin', 'myplugin', {
        init: function(app)
        {
            // define app
            this.app = app;
        },

        // messages
        onautosave: function(name, data, reponse)
        {
            // ...
        }
    });
})(Redactor);

autosaveError

Arguments
name Stringname of textarea or the value of autosaveName option
data Objectan object with the data sent to the server
response JSON the server response

Triggered when the server-side script has formed JSON with autosave error. JSON must contain the error parameter, for example:

{
    "error": true,
    "message": "Something went wrong..."
}

Callback example:

$R('#content', {
    callbacks: {
        autosaveError: function(name, data, response)
        {
            // ...
        }
    }
});

Listen to the message in a plugin:

(function($R)
{
    $R.add('plugin', 'myplugin', {
        init: function(app)
        {
            // define app
            this.app = app;
        },

        // messages
        onautosaveError: function(name, data, reponse)
        {
            // ...
        }
    });
})(Redactor);