TextRun extends Element
텍스트를 편집하는데 사용되는 API 모델입니다.
Methods
Name | Param | Return | 설명 |
---|---|---|---|
append | {String} html | 자식을 뒤에 추가 합니다. | |
prepend | {String} html | 자식을 앞에 추가합니다. | |
setText | {String} text | 글자를 설정합니다. |
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 자신을 제거합니다.
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로 변경됩니다.
setText(text)
- text <String> 문단에 설정할 Text 문자열
문단에 파라메터로 넘겨받은 Text 문자열값을 Text로 설정합니다.
var paragraph = editor.getAPIModelById('id'); paragraph.setText('문단에 들어가는 내용입니다.');