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

Version 1 Current »

Paragraph extends Element

문단을 편집하는데 사용되는 API 모델입니다.

Methods

append(html)

  • html <String> 추가할 HTML String.

인자로 넘겨받은 HTML String으로 Element의 뒤쪽에 자식으로 추가합니다.

var paragraph = editor.getAPIModelById('id');
paragraph.append('<span>TEXT</span>');

prepend(html)

  • html <String> 추가할 HTML String.

인자로 넘겨받은 HTML String으로 Element의 앞쪽에 자식으로 추가합니다.

var paragraph = editor.getAPIModelById('id');
paragraph.prepend('<span>TEXT</span>');

remove()

Element 자신을 제거합니다.

모든 ELEMENT를 제거할 경우 이후의 작업에서 오류가 발생할 수 있습니다.

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

replace(html)

  • html <String> 교체할 HTML String.

Element 자신을 인자로 넘겨받은 HTML String으로 교체합니다.

var paragraph = editor.getAPIModelById('id');
paragraph.replace('<p><span>Paragraph replaced</span></p>');

setHeading(value)

  • value <String> tagName ('P', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6')

문단을 표현할 tagName을 설정합니다. 
ex) 'P', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6'

P tag로 설정되어 있는 문단을 'H1'으로 설정하면 <H1> tag로 변경됩니다.

var paragraph = editor.getAPIModelById('id');
paragraph.setHeading('H1');

setText(text)

  • text <String> 문단에 설정할 Text 문자열

문단에 인자로 넘겨받은 Text 문자열값을 Text로 설정합니다.

var paragraph = editor.getAPIModelById('id');
paragraph.setText('문단에 들어가는 내용입니다.');
  • No labels