Image extends Element
The API model used to edit images.
Methods
replace(html)
- html <String> The HTML String to replace.
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.
IF ALL ELEMENTS ARE REMOVED, ERRORS MAY OCCUR IN SUBSEQUENT OPERATIONS.
var image = editor.getAPIModelById('id'); image.remove();
setSrc(url)
- url <String> The URL to set in the image src.
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']);
- value <Number> Width
- unit <String> Unit of width ('px', '%'). default 'px'.
Sets the width of the image.
var image = editor.getAPIModelById('id'); image.setWidth(200); image.setWidth(100, '%');
setHeight(value[, unit = 'px']);
- value <Number> Height
- unit <String> Unit of height ('px', '%'). default 'px'.
Sets the height of the image.
var image = editor.getAPIModelById('id'); image.setHeight(200); image.setHeight(100, 'px');