Documentation
Image
image.uploaded
image | Object | object of uploaded image |
response | Object | JSON object with data from upload script |
Triggered on successful image upload (including via drag and drop).
$R('#content', {
imageUpload: '/myadmin/images/upload/',
callbacks: {
image: {
uploaded: function(image, response)
{
// ...
}
}
}
});
Listen to the message in a plugin:
(function($R)
{
$R.add('plugin', 'myplugin', {
init: function(app)
{
// define app
this.app = app;
},
// messages
onimage: {
uploaded: function(image, response)
{
// ...
}
}
});
})(Redactor);
Upload script forms a JSON string:
{
"url": "/images/myimage.jpg",
"id": 1
}
JSON may contain any data, however, url
are required.
image.uploadError
response | Object | JSON object with error data |
Triggered whenever there is an error in image upload. JSON example:
{
"error": true,
"message": "Something went wrong..."
}
Callback example:
$R('#content', {
imageUpload: '/myadmin/images/upload/',
callbacks: {
image: {
uploadError: function(response)
{
alert(response.message);
}
}
}
});
Listen to the message in a plugin:
(function($R)
{
$R.add('plugin', 'myplugin', {
init: function(app)
{
// define app
this.app = app;
},
// messages
onimage: {
uploadError: function(response)
{
// ...
}
}
});
})(Redactor);
image.delete
image | Object | object of the image to be deleted |
Triggered before the image will be deleted. This callback allows you to prevent image deletion if you return false
.
$R('#content', {
callbacks: {
image: {
delete: function(image)
{
if (some_condition)
{
// success
return true;
}
else
{
// fail
return false;
}
}
}
}
});
Listen to the message in a plugin:
(function($R)
{
$R.add('plugin', 'myplugin', {
init: function(app)
{
// define app
this.app = app;
},
// messages
onimage: {
delete: function(image)
{
if (some_condition)
{
// success
return true;
}
else
{
// fail
return false;
}
}
}
});
})(Redactor);
image.deleted
image | Object | object of deleted image |
Triggered when the image is deleted.
$R('#content', {
imageUpload: '/myadmin/images/upload/',
callbacks: {
image: {
deleted: function(image)
{
// ...
}
}
}
});
Listen to the message in a plugin:
(function($R)
{
$R.add('plugin', 'myplugin', {
init: function(app)
{
// define app
this.app = app;
},
// messages
onimage: {
deleted: function(image)
{
// ...
}
}
});
})(Redactor);
image.resize
image | Object | object of resizable image |
Triggered before the image resize is started.
$R('#content', {
callbacks: {
image: {
resize: function(image)
{
// ...
}
}
}
});
Listen to the message in a plugin:
(function($R)
{
$R.add('plugin', 'myplugin', {
init: function(app)
{
// define app
this.app = app;
},
// messages
onimage: {
resize: function(image)
{
// ...
}
}
});
})(Redactor);
image.resized
image | Object | object of resized image |
Triggered when the image is resized.
$R('#content', {
callbacks: {
image: {
resized: function(image)
{
// ...
}
}
}
});
Listen to the message in a plugin:
(function($R)
{
$R.add('plugin', 'myplugin', {
init: function(app)
{
// define app
this.app = app;
},
// messages
onimage: {
resized: function(image)
{
// ...
}
}
});
})(Redactor);
image.changed
image | Object | object of changed image |
Triggered when the image is changed. If the new image replaces the old one or if the image was edited.
$R('#content', {
callbacks: {
image: {
changed: function(image)
{
// ...
}
}
}
});
Listen to the message in a plugin:
(function($R)
{
$R.add('plugin', 'myplugin', {
init: function(app)
{
// define app
this.app = app;
},
// messages
onimage: {
changed: function(image)
{
// ...
}
}
});
})(Redactor);
image.inserted
image | Object | image object |
Triggered when the image is inserted to Redactor with Insertion service API.
$R('#content', {
callbacks: {
image: {
inserted: function(image)
{
// ...
}
}
}
});
Listen to the message in a plugin:
(function($R)
{
$R.add('plugin', 'myplugin', {
init: function(app)
{
// define app
this.app = app;
},
// messages
onimage: {
inserted: function(image)
{
// ...
}
}
});
})(Redactor);