Image extends Element

The API model used to edit images.

Methods


replace(html)

Replaces the element itself with the HTML String passed as an argument.

var image = editor.getAPIModelById('id');
image.replace('<span>Image replaced</span>');

remove()

Removes the Element itself.

var image = editor.getAPIModelById('id');
image.remove();

setSrc(url)

Set the src attribute of the image to the url passed as an argument.

var image = editor.getAPIModelById('id');
image.setSrc('/images/test.png');

setWidth(value[, unit = 'px']);

Sets the width of the image.

var image = editor.getAPIModelById('id');
image.setWidth(200);
image.setWidth(100, '%');

setHeight(value[, unit = 'px']);

Sets the height of the image.

var image = editor.getAPIModelById('id');
image.setHeight(200);
image.setHeight(100, 'px');