...
...
Returns an HTML Element based on Position. If Position is not specified, returns the HTML Element at the current caret position.
Parameters:
Name | Type | Attribute | Description |
---|
position | Position |
| [ Optional ] |
Selection에서 Position 정보. 이 값이 지정되지 않으면 현재 캐럿의 위치정보로 처리됩니다 Position information in Selection. If this value is not specified, it is treated as the current caret position information. |
Return:
Type | Description |
---|
HTML Element |
Position에 해당하는 HTML Element corresponding to Position |
Example:
Code Block |
---|
language | js |
---|
theme | Emacs |
---|
title | position을 지정하지 않은 경우If position is not specified |
---|
|
var element = editor.getHTMLElement();
console.log(element.innerHTML); |
...
Code Block |
---|
language | js |
---|
theme | Emacs |
---|
title | Selection을 이용해서 position을 지정한 경우If position is specified using Selection |
---|
|
var selection = editor.getSelection();
var startElement = editor.getHTMLElement(selection.start);
console.log(startElement.innerHTML);
var endElement = editor.getHTMLElement(selection.end);
console.log(endElement.innerHTML); |
...