image.upload

Arguments
instance ObjectThe instance of the image block
data ObjectThe response object with data of the uploaded image

Occurs whenever an image is uploaded into the editor.

RedactorX('#entry', {
    subscribe: {
        'image.upload': function(event) {
            var data = event.get('data');
            var instance = event.get('instance');
            var $image = instance.getImage();

            if (data.hasOwnProperty('alt')) {
                $image.attr('alt', data.alt);
            }
        }
    }
});

image.select

Arguments
instance ObjectThe instance of the image block
data ObjectThe response object with data of the image

Occurs whenever an image is selected from the thumbnail list.

RedactorX('#entry', {
    subscribe: {
        'image.select': function(event) {
            var instance = event.get('instance');
            var $image = instance.getImage();
            var data = event.get('data');
            console.log(data.url)
        }
    }
});

image.change

Arguments
response ObjectThe response object with data of the uploaded image

Occurs whenever an image in the editor is replaced with a new one.

RedactorX('#entry', {
    subscribe: {
        'image.change': function(event) {
            ...
        }
    }
});

image.remove

Arguments
url StringAddress path of the image.
id Stringdata-image attribute of the image.

Occurs whenever an image removed.

RedactorX('#entry', {
    subscribe: {
        'image.remove': function(event) {
            ...
        }
    }
});

image.upload.error

Arguments
response ObjectJSON object with error data

Occurs when the image upload fails.

RedactorX('#entry', {
    subscribe: {
        'image.upload.error': function(event) {
            ...
        }
    }
});

Here is the example of JSON error response:

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

image.link

Arguments
instance Object The instance of the image block
link Dom Dom element of the link.

Occurs when a link is added to the image or the image link is edited.

RedactorX('#entry', {
    subscribe: {
        'image.link': function(event) {
            var instance = event.get('instance');
            var link = event.get('link');
        }
    }
});

image.unlink

Arguments
instance Object The instance of the image block

Occurs when the image has a link removed.

RedactorX('#entry', {
    subscribe: {
        'image.unlink': function(event) {
            var instance = event.get('instance');
        }
    }
});

image.width

Arguments
image Dom Dom element of the image.
width StringWidth value.

Occurs whenever the width of the image changes if the image.width setting is enabled.

RedactorX('#entry', {
    subscribe: {
        'image.width': function(event) {
            var $image = event.get('image');
            var width = event.get('width');
        }
    }
});