Arguments:
Object
Object
Occurs whenever an image is uploaded into the editor.
Redactor('#entry', {
subscribe: {
'image.upload': function(event) {
let data = event.get('data');
let instance = event.get('instance');
let $image = instance.getImage();
if (data.hasOwnProperty('alt')) {
$image.attr('alt', data.alt);
}
}
}
});
Arguments:
Object
Object
Occurs whenever an image is selected from the thumbnail list.
Redactor('#entry', {
subscribe: {
'image.select': function(event) {
let instance = event.get('instance');
let $image = instance.getImage();
let data = event.get('data');
console.log(data.url)
}
}
});
Arguments:
Object
Occurs whenever an image in the editor is replaced with a new one.
Redactor('#entry', {
subscribe: {
'image.change': function(event) {
...
}
}
});
Arguments:
String
String
Occurs whenever an image removed.
Redactor('#entry', {
subscribe: {
'image.remove': function(event) {
...
}
}
});
Arguments:
Object
Occurs when the image upload fails.
Redactor('#entry', {
subscribe: {
'image.upload.error': function(event) {
...
}
}
});
Here is the example of JSON error response:
{
"error": true,
"message": "Something went wrong..."
}
Arguments:
Object
Dom
Occurs when a link is added to the image or the image link is edited.
Redactor('#entry', {
subscribe: {
'image.link': function(event) {
let instance = event.get('instance');
let link = event.get('link');
}
}
});
Arguments:
Object
Occurs when the image has a link removed.
Redactor('#entry', {
subscribe: {
'image.unlink': function(event) {
let instance = event.get('instance');
}
}
});
Arguments:
Dom
String
Occurs whenever the width of the image changes if the image.width setting is enabled.
Redactor('#entry', {
subscribe: {
'image.width': function(event) {
let $image = event.get('image');
let width = event.get('width');
}
}
});