Selection을 기준으로 HTML Element 배열을 반환합니다. Selection이 지정되지 않은 경우 현재 Selection에 해당하는 HTML Element를 반환합니다.


Parameters:

Name

Type

Attribute

Description

selectionObject

Object

{
    anchor: { Position },
    focus:  { Position }
}

[ Optional ] anchor position과 focus position을 가지는 selection object. 이 값이 없으면 현재 Selection기준으로 동작합니다.

Return:

TypeDescription
HTML Element[]Selection에 해당하는 HTML Element 배열. 캐럿 상태에서는 캐럿이 위치한 HTML Element를 배열로 반환합니다.



Example:

var elements = editor.getHTMLElements();
console.log(elements[0].innerHTML);


var selection = editor.getSelection();
var elements = editor.getHTMLElements(selection);
console.log(elements[0].innerHTML);