Autosave

autosave.before.send #

Arguments
xhr ObjectXMLHttpRequest object
name StringTextarea name or value from the 'autosave.name' option
data ObjectObject with data sent to the server

Occurs before sending the autosave request to the server.

This event has event.stop method.

Redactor('#entry', {
    subscribe: {
        'autosave.before.send': function(event) {
            let xhr = event.get('xhr');
            xhr.setRequestHeader('X-CSRF-Token', 'your-token-value');
        }
    }
});

autosave.send #

Arguments
response ObjectJSON response
name StringTextarea name or value from the 'autosave.name' option
data ObjectObject with data sent to the server

Occurs whenever the autosave request is sent.

Redactor('#entry', {
    subscribe: {
        'autosave.send': function(event) {
            ...
        }
    }
});

autosave.error #

Arguments
response ObjectJSON response
name StringTextarea name or value from the 'autosave.name' option
data ObjectObject with data sent to the server

Occurs when the autosave request fails.

Redactor('#entry', {
    subscribe: {
        'autosave.error': function(event) {
            ...
        }
    }
});

Here is the example of JSON error response:

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