Page tree

Versions Compared

Key

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

Status
colourYellow
titleRELEASE 2.11.0 OR ABOVE

Selection을 기준으로 HTML Element 배열을 반환합니다. Selection이 지정되지 않은 경우 현재 Selection에 해당하는 HTML Element를 반환합니다Returns an array of HTML Elements based on Selection. If no Selection is specified, returns the HTML Element corresponding to the current Selection.


Parameters:

Name

Type

Attribute

Description

selectionObject

Object

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

[ Optional ] anchor position과 focus position을 가지는 selection object. 이 값이 없으면 현재 Selection기준으로 동작합니다. A selection object with an anchor position and a focus position. If this value is not present, it operates based on the current selection.

Return:

TypeDescription
HTML Element[]Selection에 해당하는 HTML Element 배열. 캐럿 상태에서는 캐럿이 위치한 HTML Element를 배열로 반환합니다An array of HTML Elements corresponding to Selection. In the caret state, the HTML Element where the caret is located is returned as an array.



Example:

Code Block
languagejs
themeEmacs
titleselection을 지정하지 않은 경우If no selection is specified
var elements = editor.getHTMLElements();
console.log(elements[0].innerHTML);

...

Code Block
languagejs
themeEmacs
titleSelection을 지정한 경우If selection is specified
var selection = editor.getSelection();
var elements = editor.getHTMLElements(selection);
console.log(elements[0].innerHTML);

...