Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Image extends Element

이미지를 편집하는데 사용되는 API 모델입니다The API model used to edit images.

Methods

Table of Contents
maxLevel3
minLevel3


replace(html)

  • html <String> 교체할 <String> The HTML String to replace.

Element 자신을 인자로 넘겨받은 HTML String으로 교체합니다Replaces the element itself with the HTML String passed as an argument.

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

remove()

Removes the Element 자신을 제거합니다itself.

Status
subtletrue
colourRed
title모든 Element를 제거할 경우 이후의 작업에서 오류가 발생할 수 있습니다If all elements are removed, errors may occur in subsequent operations.

Code Block
languagejs
themeEmacs
var image = editor.getAPIModelById('id');
image.remove();

setSrc(url)

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

...

  • <String> The URL to set in the image src.

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

Code Block
languagejs
themeEmacs
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.

Code Block
languagejs
themeEmacs
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.

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

...