Page tree
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 12 Next »

Image extends Element

이미지를 편집하는데 사용되는 API 모델입니다.

Methods

NameParamReturn설명
replace{String} html
자신을 교체합니다.
remove

자신을 제거합니다.
setSrc{String} url
src를 교체합니다.
setWidth{Number} value,
{String} [unit]

너비를 설정합니다.
setHeight{Number} value,
{String} [unit]

높이를 설정합니다.

replace(html)

  • html <String> 교체할 HTML String.

자신을 파라메터로 넘겨받은 HTML String으로 교체합니다.

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

remove

자신을 제거합니다.

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

setSrc(url)

  • url <String> 이미지 src에 설정할 URL.

이미지의 src 속성을 파라메터로 넘겨받은 url로 설정합니다.

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

setWidth(value[, unit]);

  • value <Number> 너비.
  • unit <String> 단위 ('px' 또는 '%'). 기본값 'px'.

이미지의 너비를 설정합니다.

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

setHeight(value[, unit]);

  • value <Number> 높이.
  • unit <String> 단위 ('px' 또는 '%'). 기본값 'px'.

이미지의 높이를 설정합니다.

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