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 정보를 반환합니다. Selection 정보는 아래와 같이 네가지 위치정보를 포함하고 있습니다Returns Selection information from the editor. Selection information includes four types of location information as follows.

종류설명
start문서상에서 Selection의 시작위치
end문서상에서 Selection의 마지막 위치
anchorSelection을 시작한 위치 (ex; 마우스를 클릭 후 Darg한 경우 마우스를 클릭한 위치)
focusSelection이 끝난 위치The start position of the selection on the document
endThe end position of the Selection in the document
anchorThe location where the selection started (ex; the location where the mouse was clicked in case of darting after clicking the mouse)
focusLocation where selection is finished


Example:

Code Block
languagejs
themeEmacs
var selection = editor.getSelection();

var startPosition = selection.start;
var endPosition = selection.end;
var anchorPosition = selection.anchor;
var focusPosition = selection.focus;



또한 Selection은 선택된 컨텐츠의 종류에 따라 Also, Selection is divided into text, cell, drawingObject로 구분됩니다.
이 타입에 따라서 위치정보가 포함하고 있는 내용이 아래와 같이 다르게 구성됩니다and drawingObject according to the selected content type.
Depending on this type, the contents of location information are configured differently as follows.

typeposition
text

id : 문단 Paragraph ID

offset : 문단에서 selection의 위치 Position of selection in paragraph

cell

id: 셀에 포함된 첫번째 문단의 IDFirst paragraph ID included in the cell

offset : anchor position의 경우 문단내에서 Selection을 시작한 위치 정보 In the case of anchor position, the position where the selection started within the paragraph

tableCellId : 셀의 Cell ID

tableId : 표의 Table ID

drawingObject

drawingObjectId : drawingObject의 drawingObject ID

id : drawingObject가 포함된 문단의 ID Paragraph ID containing the drawingObject

offset : 문단에서 drawingObject의 위치

...

 Position of drawingObject in paragraph

In Selection, type information can be checked as follows.

Example:

Code Block
languagejs
themeEmacs
var selection = editor.getSelection();
var anchorType = selection.anchor.getType();
var focusType = selection.focus.getType();

...